by Dinesh Thakur Category: Swing

 

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

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content





Popular Article