close

 

 

public class ForTest implements ActionListener
{
    JButton button;
    public static void main(String [] args)
    {
        ForTest gui = new ForTest();
        gui.go();
    }
    public void go()
    {
        JFrame frame = new JFrame();
        button = new JButton("click me");
        button.addActionListener(this);
        
        frame.getContentPane().add(button);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300, 300);
        frame.setVisible(true);
    }
 
    @Override
    public void actionPerformed(ActionEvent arg0) 
    {
        // TODO Auto-generated method stub
        button.setText("I've been click!");
    }
}

 

 

arrow
arrow
    文章標籤
    Eclipse button
    全站熱搜

    Eric 發表在 痞客邦 留言(0) 人氣()