Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To close this window and open new window ?
10-12-2012, 12:41 AM,
Post: #1
How To close this window and open new window ?
macam mana bila kita click button pertama atau button kedua dia tutup sendiri window tersebut dan keluarkan window baru iaitu game tersebut ?

Code:
public static void main(String argv[]) {
        JFrame frame = new JFrame("choose multiplayer");
        frame.setVisible(true);
        frame.setSize(400,200);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JLabel label = new JLabel("Choose MultiPlayer");
        JPanel panel = new JPanel();
        frame.add(panel);
        panel.add(label);
        JButton button = new JButton("1");
        panel.add(button);
        button.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent ae){
                
                start1Player();
                
            }
        });
        
        JButton button2 = new JButton("2");
        panel.add(button2);
        button2.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent ae){
                start2Player();

            }
        });
[Image: Captu3re.jpg]
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  how to open .class file Timon 3 791 08-12-2012, 06:03 PM
Last Post: Timon

Forum Jump: