Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 769
  • Last Modified:

Jdialog Max min size

JPanel has prefered/Max/Min sizes, but Dialog has just setSize method..
I want the dialog to be resizable but it should not become less than a specified size.. and Scrollbars should appear if one tries to reduce its size further..
How can such functionality be achieved?
0
armoghan
Asked:
armoghan
  • 4
  • 3
3 Solutions
 
zzynxSoftware engineerCommented:
>> and Scrollbars should appear if one tries to reduce its size further.
Can you explain that further?
If you avoid it can be made smaller, why should you have scrollbars then?
0
 
zzynxSoftware engineerCommented:
>> I want the dialog to be resizable but it should not become less than a specified size.
Use your own MyDialog extends JDialog and override getMinimumSize()
0
 
zzynxSoftware engineerCommented:
>> If you avoid it can be made smaller, why should you have scrollbars then?
Oh I see: in case the minimum size of the JPanel is greater than the minimum size of the JDialog. Right?

Well, then you have to place the JPanel in a ScrollPane.
And the scrollpane in the JDialog's contentpane
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
objectsCommented:
you need to set the minimum size on you component contained in the JDialog and *not* the minimum size of the dialog.
0
 
objectsCommented:
if you want to stop the dialog being resized smaller than a specified size then try using a WindowListener that adjusts the size if it is resized less than minimum.
0
 
objectsCommented:
actually its the preferred size of the panel that you want to set.
0
 
adeelaslamCommented:
You must have Window Listener inorder to achieve the minimum size lock. Such that the screen cannot go under a specific minimum size. The solution is that as soon as one does reduce the size the listener undoes the change if it is wrong.

There is no need of ScrollBars as the screen cannot go under a specific size.
0
 
zzynxSoftware engineerCommented:
Thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now