Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

altering layout of JOptionPane

Status
Not open for further replies.

kmcculler

Programmer
Jul 5, 2000
81
0
0
US
Hi, Could anyone help me figure out how to change the way the static showInternalConfirmDialog method of JOptionPane lays out the textcomponents I pass to it? I'm using the confirm dialog as a sort of popup edit. I pass as my message an array of Objects (such as JLabel, JTextField,JLabel,JTextField,JLabel,JTextArea) as Label component pairs for whatever Im editing (in this case refrence, short desc, long desc).
This works for me and things are going fairly well exept that I have one component that has a maximim length (enforced through a custom document) of 3 characters and another with a max length of 100, and a 3rd with say 500. JOptionPane lays them all out to be the same width(I can control height) no matter what I do. I need to be able to make a textbox with a max of 3 characters shorter than a textbox with a max of 100 characters. I tried using setSize and setPrefferedSize on the component but apparently there's something that resets it afterwords. Thanks for any help you may be able to give.

Kris McCuller
Programmer Portiva Corp.
kmcculler@portiva.com
 
What if you placed your label and textbox in a JPanel that used a FlowLayout (so it will respect your preferred sizes) and then passed the panel to the JOptionPane?

The JOptionPane's layout manager may resize the panel to fit, but shouldn't resize the panels contents...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top