Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Button to change colour's of a grid of boxes

 
Dave menday
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have started this applet but I don't know how to get my button to change the colour's of the boxes any help would be great
this is what I have so far
Grid.java

 
Maneesh Godbole
Saloon Keeper
Posts: 11327
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.
In future, while posting code, please UseCodeTags. I have added them this time for you. As you can see they make the code much more easier to read and understand.

Where are you adding the "Box" to the applet? All you have is the change color button.
A few suggestions
1) You are extending Applet. That's AWT and no longer recommended. Switch to the Swing equivalent of JApplet
2) It is always a good idea to use Layout Managers http://docs.oracle.com/javase/tutorial/uiswing/layout/using.html
3) For custom painting of swing components http://docs.oracle.com/javase/tutorial/uiswing/painting/
 
Dave menday
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I'm sure you are right in what you are saying but this is for a course I am doing so it has to be an applet I seem to be getting things all wrong.
 
Maneesh Godbole
Saloon Keeper
Posts: 11327
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave menday wrote:... I seem to be getting things all wrong.

Yes
Maneesh Godbole wrote:Where are you adding the "Box" to the applet? All you have is the change color button.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic