This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Making co-ordinates co-operate! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Making co-ordinates co-operate!" Watch "Making co-ordinates co-operate!" New topic

Making co-ordinates co-operate!

Mike Smike
Ranch Hand

Joined: Aug 25, 2004
Posts: 33
Hi guys!

I'm trying to make a grid of 10 x 10 textfields. I need each textfield to be referenced by an individual co-ordinate. They must start at (0,0) which should be at the bottom left of the grid (like on a normal graph).

So far I have managed to make a 10 x 10 grid of text fields, and each is simply numbered from 0 - 99 starting at the top left. This is no good unfortunately. This is what I've managed:

And then I just call
in my main method.

Any help would be greatly appreciated! Thank you muchos mooses!
Landon Blake
Ranch Hand

Joined: Oct 15, 2004
Posts: 44
Have you thought about trying a JPanel with using a GridLayout Layout Manager? I think it will accomplish what you need.

Mike Smike
Ranch Hand

Joined: Aug 25, 2004
Posts: 33
I am using the GridLayout. Here's a bit more of my code:

However, I want to somehow create a loop which numbers/references each cell, starting at the bottom left, with their co-ordinate, i.e (0,0),(0,1),(9,3) etc.

Sorry for not making that very clear. Please help

Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Swing / AWT / SWT / JFace forum...

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Mike Smike
Ranch Hand

Joined: Aug 25, 2004
Posts: 33
Thank you muchos Mr Craig Wood! That will help me heaps! You're a very good ranch hand!

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Making co-ordinates co-operate!
It's not a secret anymore!