I'm struggling with my first applet. I'm trying to make a group of buttons using a method named CreateAndShowGUI (guess what it does.)
If I make CreateAndShowGUI static, I get this error:
wishlist.java:103: non-static variable this cannot be referenced from a static context
actionButton[looper].addActionListener(this);
^
If I make CreateAndShowGUI nonstatic, I get this error:
wishlist.java:258: non-static method createAndShowGUI(int,int,boolean) cannot be referenced from a static context
createAndShowGUI(wishCount, wishDisplay, (viewer.equals("Platonix ")));
^
Line 258, the "static context", is part of main(), which has to be static or God kills a kitten. So I suppose CreateAndShowGUI also has to be static, meaning I need to know how to set an ActionListener on a JButton in a static context where I'm not allowed to use the
this keyword.