This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Applets and the fly likes Button to change colour's of a grid of boxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Button to change colour Watch "Button to change colour New topic
Author

Button to change colour's of a grid of boxes

Dave menday
Greenhorn

Joined: Jun 05, 2013
Posts: 2
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

Joined: Jul 26, 2007
Posts: 10171
    
    8

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/


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Dave menday
Greenhorn

Joined: Jun 05, 2013
Posts: 2
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

Joined: Jul 26, 2007
Posts: 10171
    
    8

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.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Button to change colour's of a grid of boxes
 
Similar Threads
Graphics Graphics Graphics - Where are my circles?
need help with making a 4x4 grid. code and details inside.
Confused on how to create a rectangle
In need of help with making 4x4 grid
Graphics Graphics Graphics - Where are my circles?