• Post Reply Bookmark Topic Watch Topic
  • New Topic

setPreferredSize()  RSS feed

 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I use this method on a JList and place the JList on the content pane of a frame using GridBagLayout, it looks great . . . . until I make my frame smaller. Once I get below a certain size, the JList completely disappears. All other components remain on the frame. I have set up the GridBagConstraints fields correctly I think. I've tried loads of combinations of fill, weightx, anchor etc.
Please help. This swing stuff is a pain in the arse when it comes to resizing.
Paul
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is due to the GridBagConstraints setting how the components behave on resizing (and GridBagLayout is fine to control resizing! ). It would help if you could post the code where you set the constraints.
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using setMinimunSize() as well.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!