wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Layout problem with the gaps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Layout problem with the gaps" Watch "Layout problem with the gaps" New topic
Author

Layout problem with the gaps

Michail Petrov
Ranch Hand

Joined: Sep 04, 2008
Posts: 32
Hi i have one rutien problem

i use the GridLayot and i want to set a space betwean the JLabels in the aplication. When i chainge the gaps i only chaige the JTextField space

The oder problem is haw to set the 4 buttons in the right corner i use the FlowLayout i dont know what actualy to do

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
I told you before - read the tutorials, otherwise we'll be spoon-feeding you for the next 10 years.

http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2153
    
    7
When you use a GridLayout, each component is the same size. Therefore the gap between the label and the text field appears larger because of the extra whitespace of the label. Change the labels horizontal alignment to RIGHT and you will see what I mean.

If you want a bigger gap betwen the first text field and second label, then create a panel that uses two grids so you can specify a different gap.

haw to set the 4 buttons in the right corner i use the FlowLayout


Read the FlowLayout API. By default components are aligned to the center, but you can change this to be right aligned.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Layout problem with the gaps
 
Similar Threads
filewriter not working
filewriter not working
why
jmenubar,menuitem
Not able to read the value of a component on one JPanel from a different JPanel