Thanks for the quick reply. I am a complete novice (read only 3 chapters from a
Java book) in this so my questions may seem weird. I know I need to read more before going into "difficult" things like this but just want to try to see how it works and then will understand it completely :-)
I changed to JApplet and JTextField.
OK, the "Instead of adding components to the applet, add them to a JPanel and then add the panel instance to the applet using the JApplet#getContentPane()#add method" part first:
1. I added "private JPanel myPanel;" in line 5
2. I replaced lines 25, 26 and 27 with "myPanel.add(inputLabel); myPanel.add(sizeVariable); myPanel.add(doButton);
The "You should be overriding the paintComponent(Graphics g) method of the JPanel instead of paint " I kind of understand as "I should not be adding anything to the paint method of the JApplet itself but instead to the paintComponent method of the JPanel. I tried and added this at the end of my code:
Then "TestPanelClass myPanel = new TestPanelClass();" before the add() operations and "getContentPane().add(myPanel);" after the add operations of line 25-27;
This compiles and I see the red circle. But I do not know how to use all this in the actionPerformed part of the program...
edit: I think I got this :-). I declared the variable size at the begining of the class and then in actionPerformed was calling redraw() and in the declaration of my class the size was used to set the color of the circle. I don't understand exactly what I did but it looks promising.