Hey guys... so here's the "problem" now. When you compile and run this code as of now, it will bring up a screen with a button on it - when you click teh button it will do nothing.
We're supposed to make the button increment by 1 every time we click it.
I'm somewhat new to GUI's, and the teacher is of no help at all.
Thanks in advance.
package FourthFrame; import javax.swing.*; import java.awt.*; import java.awt.event.*; class MyJFrame extends JFrame implements ActionListener{ // private instance variables JButton button1; JButton button2; int button1Count; int button2Count; public static void main (String [] args) { MyJFrame mine = new MyJFrame(); mine.setVisible(true); } public MyJFrame () { setTitle ("This is a \"MyJFrame\" object (V4)"); setSize (300, 500); setDefaultCloseOperation( EXIT_ON_CLOSE ); // get the content pane and set properties Container contentPane = getContentPane(); contentPane.setBackground (Color.blue); contentPane.setLayout(null); // so that we can use absolute positioning // construct two buttons button1 = new JButton("0"); button1.setBounds(110,230,80,40); button1.addActionListener(this); contentPane.add(button1); button2 = new JButton("0"); button2.setBounds(110,300,80,40); button2.addActionListener(this); contentPane.add(button2); // start their counts at 0 button1Count = 0; button2Count = 0; } public void actionPerformed(ActionEvent event) { button1Count++; button1.setText(Integer.toString(button1Count)); button2Count++; button2.setText(Integer.toString(button2Count)); } }