by Dinesh Thakur

 

import java.awt.*;

import javax.swing.*;
import java.awt.event.*;
public class JavaExampleSeperatorEventInJApplet extends JApplet implements ComponentListener
 {
    JSeparator Sprtr = new JSeparator(JSeparator.VERTICAL);
    Dimension Dimnsn = Sprtr.getPreferredSize();
    public void init()
     {
        Container Cntnr = getContentPane();
        Cntnr.setLayout(new FlowLayout());
        Cntnr.add(new JTextField("Welcome To Java"));
        Cntnr.add(Sprtr);
        Cntnr.add(new JTextField("Welcome To Java"));
        addComponentListener(this);
     }   
        public void componentShown(ComponentEvent e1)
          {
             Sprtr.setPreferredSize(new Dimension(Dimnsn.width,getSize().height));
             Sprtr.revalidate();
          }
             public void componentResized(ComponentEvent e2)
             {
               Sprtr.setPreferredSize(new Dimension(Dimnsn.width,getSize().height));
               Sprtr.revalidate();
             }
               public void componentMoved(ComponentEvent e3) {}
               public void componentHidden(ComponentEvent e4) {}
 }
/*<APPLET CODE =JavaExampleSeperatorEventInJApplet.class WIDTH=410 HEIGHT=210></APPLET>*/
JSeparator Event in Java Example