• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

swing problem

 
rish obe
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am taking inputs from a xml file and setting the node names as "labels" and the data as "textfields" .

depending on the humber of nodes in the xml file, labels are created along with textfields and are displayed in a panel with labels on left side and textfields on eight side . , as in , a 2 columns and n rows depending on nodes.

Now , the problem i am facing is that , depending on the number of textfields , they are resized ... if less in number , textfields are larger in size and if more in number the textfields size shrinks

They are tied to the frame and cover up all the empty space. i m using gridlayout.

wat shud i do to avoid this.

i have tried using textfield.setPreferred(new Dimension(3,3))

but does'nt work.
 
Brian Cole
Author
Ranch Hand
Posts: 907
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by rish obe:
Now , the problem i am facing is that , depending on the number of textfields , they are resized ... if less in number , textfields are larger in size and if more in number the textfields size shrinks

They are tied to the frame and cover up all the empty space. i m using gridlayout.


Well that's how GridLayout works.

What you probably want to do is add your labels and text fields to a separate panel (using GridLayout), then put that panel into NORTH of a BorderLayout.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic