I have an Applet that has three buttons on it, one being a clear screen button. I have it setup right now so it draws a rectangle the size of the applet and fills it with the background color. But when it does that my other two buttons disappear until I mouse over them again. Is there a better way to clear screen or anyway for the buttons to show back up after the "clear screen"?
Don't draw the rectangle over the buttons! Instead of drawing directly on the applet, pack a subclass of JPanel into the applet , and do the drawing in that JPanel's paintComponent() method.
Sounds like a good idea, I'll just have to figure out how to do that. My book I have isn't very good. Ill research it on various websites. Thanks for the advice.
I changed the name of the method from Paint(raphics g) to paintComponent(Graphics g) along with the editions I mentioned earlier and when I click Clear Screen the Red and Black buttons do not go away, but now I cant draw on the Panel. Any ideas why?
I was told to "do the drawing in that JPanel's paintComponent() method" so I thought that is what I did. I dont have any examples of this so im kinda taking a shot in the dark when trying to implement the suggestions I get. If I call super.paintComponent() then I get an erros that says cannot find symbol.
I think when I get home I will design this in NetBeans and see what it looks like. Even Sun's tutorial is not enough for me. Im using a content Pane and in Suns tutorials they are using Frames.