• Post Reply Bookmark Topic Watch Topic
  • New Topic

Minimum size of JDialog

 
Alan Brooks
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have been making JDialogs to display options and was wondering is there a way to set a minimum size for the window so that the user can change it so as to make it bigger and smaller but locks out at a smaller size so it cant go past a set size.
 
Campbell Ritchie
Marshal
Posts: 52587
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Dialog is a Window, if you look up its inheritance hierarchy, so methods like setResizable(boolean) and setMinimumSize(java.awt.Dimension) will be available. I don't know whether they will sort out your problem, but they are worth a try.
 
Alan Brooks
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried



but this does not set a minimum size as the window still resizes down past the limit
 
Campbell Ritchie
Marshal
Posts: 52587
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know, sorry. I looked at ContainerListener, WindowListener and WindowStateListener and they didn't seem to have any useful methods.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> but this does not set a minimum size as the window still resizes down past the limit

setMinimumSize works fine for me (using java 1.6 and default L&F)

if the dialog is modal, is your minimumSize code before or after setVisible(true)?
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which Java version are you using?
Windows (or at least JFrames) ignored their minimum size until either Java 5.0 or Java 6.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!