• Post Reply Bookmark Topic Watch Topic
  • New Topic

Looking for a good guide.  RSS feed

 
tim gallagher
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I was wondering if anybody has a good online guide to help me create a an applet with an invisible 8x8 grid layout. I am aware of the basics but if i could get some good articles, or even be aware of key words to google for, it would be a great help :-)

Thanks in advance,

Tim.

p.s. Hope everyone hada good xmas :-)
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLD,GGLD:2004-20,GGLD:en&q=applet+tutorial+grid+layout

But honestly, if you know the basics, you'd probably be better off just getting down to business and tweaking some code until you figure out how to make it do what you want!
 
tim gallagher
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephen,

Firstly, thankyou for your reply :-)

Unfortunately i may have worded my question wrong, so let me rephrase it.
When i say "grid layout" i meant, for example, an area of "tiles". I can do this easily with jpanels or buttons for example, but is not what i want (i dont want the edges very visable). i have made an advancement on this.

So far I have written a very small and simple program that creates a line of 8 boxes. I have made only 8 boxes so i can get a very basic version to work (when i say very basic i mean 8 lines cut and paste :-) ).

here is the code.

"public class Frame1 extends JFrame {
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
public void paint(Graphics g) {
g.drawRect(4, 30, 40, 40);
g.drawRect (4,30,80,40);
g.drawRect (4,30,120,40);
g.drawRect (4,30,160,40);
g.drawRect (4,30,200,40);
g.drawRect (4,30,240,40);
g.drawRect (4,30,280,40);
g.drawRect (4,30,320,40);
g.drawRect (4,30,360,40);"

I can repeat this till i get a screen filled up. Ok.. What i would like to know is this - is it possible to give each rectangle a name (ie an identifier), so that values can be attributed to them? (eg "RECT1", "RECT2" etc)

Example.

"RECTCOLOR" is a value between 1 and 100. It is attributable to all 8 rectangles. Each retangle will have an "if.. else" statement that basically says if "RECTCOLOR" is less than 50, that rectangle color is green, otherwise red.

If this is really simple for you, i would be grateful if you could tell me >>>Can this be done with this method<<< if you could show me it would be great :-) Even keywords to look for in google will be a help. I have been experimenting, and im sure you realise that jave can hard to learn but easy to remember :-)

thankyou for reading my post,

Tim.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!