• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

basic swing layout problem.

 
Fernando Lopez Jr.
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i get my button to be 22 in height and use all width available to it? also i would like to align my label to the left...


Thank you.


 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html
 
Fernando Lopez Jr.
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i've been reading that... but i just cant get it to work... so i will appreciate if you help me tweaking my code...

thank you.
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should set the preferred with of the button to be 22:
That will not guarantee a height of 22, but you won't get any closer.

As for the width, that completely depends on the layout manager used. I can't help you out with BoxLayout since I've never used that, but a BorderLayout should work:
 
Fernando Lopez Jr.
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i went with another layout manager... MiG Layout...
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fernando Lopez Jr. wrote:i went with another layout manager... MiG Layout...

Why the rolling eyes? MiG is also a good layout manager. Nobody said you have to stick to the layout managers provided in the JSE API. I myself use JGoodies Forms most of the time.
 
Fernando Lopez Jr.
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the rolling eyes were because i was learning the default layout system... and then i had to switch to something "better?"... well anyways can you point me the pros of JGoodies? or a JGoodies vs MiG Layout thread/url? and maybe your personal point of view?


thank you.
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm too biased, since I've never worked with MiG. I just never bothered since JGoodies always did what I needed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic