Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Layout problem with the gaps

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 3272
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic