diff --git a/src/FirstGUI.java b/src/FirstGUI.java index fa1bf80..a584601 100644 --- a/src/FirstGUI.java +++ b/src/FirstGUI.java @@ -4,6 +4,7 @@ import javax.swing.JButton; import javax.swing.JFrame; +import javax.swing.JOptionPane; class MyJButton extends JButton implements ActionListener { public MyJButton(String label){ @@ -29,12 +30,12 @@ MyJButton jb = new MyJButton("Label Label Label"); jb.addActionListener(jb); jb.addActionListener( e -> System.out.println("Button was pressed") ); - // jb.addActionListener(new ActionListener() { - // @Override - // public void actionPerformed(ActionEvent e) { - // JOptionPane.showMessageDialog(jb,"Button was pressed."); - // } - // }); + jb.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JOptionPane.showMessageDialog(jb,"Button was pressed."); + } + }); jf.getContentPane().add(jb); // jf.setSize(300,200); jf.pack();