See this link, it has everything you need as a beginner to help you get started with GUI programming http://java.sun.com/docs/books/tutorial/uiswing/
Good luck, Evans http://www.javawug.org ----- Original Message ----- From: "tedpottel" <tedpot...@gmail.com> To: "Java EE (J2EE) Programming with Passion!" <java-ee-j2ee-programming-with-passion@googlegroups.com> Sent: Wednesday, June 24, 2009 9:17 PM Subject: [java ee programming] New Programmer needs help > > 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 > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---