Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Making co-ordinates co-operate!

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
Mikey
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you thought about trying a JPanel with using a GridLayout Layout Manager? I think it will accomplish what you need.

http://java.sun.com/docs/books/tutorial/uiswing/layout/grid.html

Landon
 
Mike Smike
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Mike
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Swing / AWT / SWT / JFace forum...
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Mike Smike
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you muchos Mr Craig Wood! That will help me heaps! You're a very good ranch hand!

Mike
 
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic