Tuesday, November 21, 2006



import javax.swing.*;

public class MySecondGUI extends JFrame{

// Step 1: Declare the componentw
private JButton tongjin;

public MySecondGUI(){
// Step 2: Create the component
tongjin = new JButton("Click me");

// Step 3: Add the component to the container
getContentPane().add(tongjin);
}



public static void main(String args[]){
MySecondGUI barnet = new MySecondGUI();

barnet.setSize(100,200);
barnet.setVisible(true);

} //end main

}//end class

No comments: