hi you can use NetBeans IDE. which will be helpful for Swing components. and implement the action listener easily.
Tariq Masood > Date: Wed, 24 Jun 2009 13:17:41 -0700 > Subject: [java ee programming] New Programmer needs help > From: tedpot...@gmail.com > To: java-ee-j2ee-programming-with-passion@googlegroups.com > > > Hi, > I'm trying to learn how to use buttons, I have the following code > public class mySwing { > > > > class action implements ActionListener { > > public void actionPerformed(ActionEvent e) > { > // do something > System.out.println("ted"); > > } > } > > > public static void main(String[] arg) > { > JFrame frame = new JFrame("The Frame"); > frame.setSize(400,400); > frame.setLocation(10,10); > frame.setVisible(true); > > Container con = frame.getContentPane(); > con.setLayout(new FlowLayout()); > con.add( new JLabel("hi")); > con.add(new JLabel("ted")); > > // ad a button > JButton but = new JButton("fred"); > action a = new action(); > > but.addActionListener( a); > > con.add(but); > > > } > } > > I get a error on > action a = new action() > eclipse says > Description > No enclosing instance of type mySwing is accessible. Must qualify the > allocation with an enclosing instance of type mySwing (e.g. x.new A() > where x is an instance of mySwing). mySwing.java testswing/src line 34 > Java Problem > Can somebody explains what this means????????? > -Ted > > > _________________________________________________________________ Hotmail® has ever-growing storage! Don’t worry about storage limits. http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en -~----------~----~----~----~------~----~------~--~---