Event Handling in Swing

import javax.swing.*;

public class JFrameTester {

  public static void main(String[] args) {
    
     SwingUtilities.invokeLater(new Runnable() {
         public void run() {
             createAndShowFrame();
         }
     });
    
  }
  
  public static void createAndShowFrame() {
    
    JFrame jf = new JFrame("My JFrame");
    jf.setSize(250, 250);
    jf.setLocation(300,200);
    jf.getContentPane().add(
     BorderLayout.CENTER, new JTextArea(10, 40));
    jf.setVisible(true);
    
  }
  
}

Previous | Next | Top | Cafe au Lait

Copyright 2005, 2006 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified September 18, 2006