public SwingDemoFrame() { this.setSize(new Dimension(400, 300)); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setTitle("Swing Demo"); this.setLayout(new FlowLayout());Back in main, call the frame's setVisible() method with the value "true" to get the frame to show up.
this.
and look at your options. One will look very appropriate!)this.button.addActionListener(this)A button responds to its own mouse clicks:
this.addActionListener(this)
if (event.getSource() == this.button) // then it was the button that was clicked