• Post Reply Bookmark Topic Watch Topic
  • New Topic

Design Custom Box Class to be Displayed in Applet  RSS feed

 
diaz cesar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still trying to DEFINE setBoxColor() in Grid, when this is ALREADY defined in Box. Let's back up a bit and try to get back on track... Let's start by setting up a proper Applet outline. You've done a few things that I think you got from the internet. So I want to remind you of how the lesson showed you how to set up your ActionListner...


Okay- these are the ONLY methods you need to define here in Grid.
-Boxes are created and drawn.
-Button changes their color.
-Applet repaints, boxes are redrawn with their new Color.

Let me know how it goes.






 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I have added more code tags, which you obviously know about and removed a lot of unnecessary empty space.
Why are you using applets in the first place? If you are going to use applets you should extend JApplet not Applet.
There might be such a method in Box, but your Grid class cannot extend Box, so it cannot have the setBoxColor method. You would have to add such a method to Grid, possibly as part of an interface.
 
diaz cesar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Welcome to the Ranch

I have added more code tags, which you obviously know about and removed a lot of unnecessary empty space.
Why are you using applets in the first place? If you are going to use applets you should extend JApplet not Applet.
There might be such a method in Box, but your Grid class cannot extend Box, so it cannot have the setBoxColor method. You would have to add such a method to Grid, possibly as part of an interface.


well I was asked to use an applet and I tried exteding it to JApplet and I was told that was not correct, the instruction on the top was what I was give after I change it to JApplet.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!