aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes swing problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "swing problem" Watch "swing problem" New topic
Author

swing problem

rish obe
Greenhorn

Joined: Jun 19, 2007
Posts: 6
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

Joined: Sep 20, 2005
Posts: 862
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.


bitguru blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: swing problem
 
Similar Threads
Weired Tabbing problem with textfields and labels ....
Writing to XML file using DOM4j
There's a problem here
how to hide and show contents with struts2 div tag
Width issue with JTextField and JComboBox in GridBagLayout