Connecting Tech Pros Worldwide Forums | Help | Site Map

Why are my swing components so big?

Familiar Sight
 
Join Date: Nov 2007
Posts: 153
#1: Jun 18 '09
Hi all,

I might be being stupid here but for the life of me I can't understand/remember how to layouut my software so the buttons and textbox's don't go big, like filling the width and height of the jpanel the are contained in.

I have:

Jframe
it's content pane has a gridlayout(3,1)

I have added panel1(GridLayout(1,1)(contains a table ) to content pane
I have added panel2(GrisLayout(10, 2))(contains TextBoxes and Labels) to content pane
I have added panel3(GridLayout(1, 4)(contains 4 Huge Buttons) to content pane

My prolem is that my jbuttons are HUGE, filling whole of panel3 and so are my jtextboxes and jtextareas in panel2.

Is there something i'm missing - I just want nice small neatly spaced out buttons in panel3 and in panel2 I want the label and textbox to be on same row rather than different rows because the text box fills width of panel2.


Regards

brendan

JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#2: Jun 18 '09

re: Why are my swing components so big?


Some of the layout managers link to the appropriate section of the Sun tutorials (e.g. see the API documentation for the BoxLayout class). Read those tutorials.

kind regards,

Jos
Reply


Similar Java bytes