my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes Can I change the size of a Dialog? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Can I change the size of a Dialog?" Watch "Can I change the size of a Dialog?" New topic
Author

Can I change the size of a Dialog?

Biliang Zhou
Ranch Hand

Joined: Jun 28, 2006
Posts: 43
Can I change the size of a Dialog (a modal dialog, like the those created by JOptionPanes)?

What I actually want to do is to have two textfields and a checkbox in the dialog. When you uncheck the checkbox, one of the two textfields hide itself. Thus the size of the Dialog should adapt (i.e., become smaller).

Thank you!
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
maybe something like this

Biliang Zhou
Ranch Hand

Joined: Jun 28, 2006
Posts: 43
Thank you so much for your reply, Michael!

The problem was:

I'm updating an old version of java code (not authored by me), which uses a JOptionPane to bring up a JOptionPane.showConfirmDialog(//argument list//), with a fixed size and no show/hide component.
Now the new version has several show/hide components and thus needs a changeable size.

Now I understand your approach, and it works for me!



[ September 13, 2006: Message edited by: Biliang Zhou ]
[ September 13, 2006: Message edited by: Biliang Zhou ]
 
 
subject: Can I change the size of a Dialog?
 
Similar Threads
arrange the spacing between components
JDialog resize question
JOptionPane
JDialog : Custom Input
how to change the cursor size for dialog