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?
LVL 18
armoghanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

objectsCommented:
you need to set the minimum size on you component contained in the JDialog and *not* the minimum size of the dialog.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.