Hey Guys,
I'm currently writing a java applet for my class and I've run into a quirky little problem. I assure you answering this won't be considered cheating in anyway since it's just a bug and not the solution to the assignment.
I have 5 buttons that I need to use at different times in the applet. initially I need to have two on the screen (buttons B1 and B2). so in my init() I have these two added to the applet. Then once either of these buttons is pressed it should remove them and place three other buttons (B3, B4, B5). so in my event() I have it handle the click by this.remove() B1 and B2 then this.add() B3-B5. Then I change a variable and call repaint() since there are other changes on the applet depending on the button pressed. Unfortunately buttons B3-B5 don't appear on the applet, the repaint() happens but the buttons are strangely missing.
Is there something else I have to do to assure that my buttons get added properly?
I'm currently writing a java applet for my class and I've run into a quirky little problem. I assure you answering this won't be considered cheating in anyway since it's just a bug and not the solution to the assignment.
I have 5 buttons that I need to use at different times in the applet. initially I need to have two on the screen (buttons B1 and B2). so in my init() I have these two added to the applet. Then once either of these buttons is pressed it should remove them and place three other buttons (B3, B4, B5). so in my event() I have it handle the click by this.remove() B1 and B2 then this.add() B3-B5. Then I change a variable and call repaint() since there are other changes on the applet depending on the button pressed. Unfortunately buttons B3-B5 don't appear on the applet, the repaint() happens but the buttons are strangely missing.
Is there something else I have to do to assure that my buttons get added properly?
Comment