Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I change the size of a Dialog?

 
Biliang Zhou
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe something like this

 
Biliang Zhou
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic