View Single Post
  #1 (permalink)  
Old 04-03-2008, 10:19 PM
Cymro Cymro is offline
Member
 
Join Date: Jan 2008
Posts: 7
Cymro is on a distinguished road
[SOLVED] Actionevent problem
I have decided to shy away from IDEs to try my hand at a text editor (proper? ) approach to coding. However, a major problem:

Code:
import javax.swing.*; import java.awt.*; public class SandBox extends JFrame{ private static void makeGUI(){ JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new FlowLayout()); JButton button = new JButton("Login"); button.addActionListener(new ActionListener()); frame.add(button); frame.pack(); frame.setVisible(true); } public void actionPerformed(ActionEvent e){ System.out.println("Test"); } public static void main(String[] args){ SwingUtilities.invokeLater(new Runnable(){ public void run(){ makeGUI(); } }); } }
when this code compiles, it informs me that it “cannot find symbol” whenver ActionEvent/Listener is referred to. Not exactly what was meant to happen
Reply With Quote
Sponsored Links