• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difficulty in arranging data in gridlayout  RSS feed

 
Smita BalgarKashi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to swing and working in a health insurance project. I have problem in arranging components in gridlayout. Here is my code. Just trying to arrange these components in gridlayout properly one by one.


 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell us about the problem, then? Read our FAQ entry TellTheDetails to see what kind of information is useful to people who might answer such questions.
 
Smita BalgarKashi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure. Thankyou for the reply. After running the code im not getting the components properly arranged one after the other. They are spread all over the frame.Thanks in advance.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand that.
 
Smita BalgarKashi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is with the displaying of the elements in my frame . Those textfields, labels and radiobuttons which are mentioned in the program are visible but not one after the other, they are spread all over the frame and are not aligned properly. so my question is how to arrange them in a sequence?? I used gridlayout but still couldnot align them in a sequence.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All you are saying is that you don't like what you see. Remember that you're the only one who can see what you are seeing, though. You're going to have to explain what is wrong with what you are seeing, and what you hoped to see instead.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gridlayout will do what it thinks best when the numbers are incorrect
contentPane.setLayout(new GridLayout(8,3));
and you are trying to add 40 components? - does 8 x 3 = 40?

change the 8 to 0, then really think what the 3 should be
i.e. how many 'columns' should there be.

also, set the layout prior to adding any components
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!