java - resizing JDialog box -



java - resizing JDialog box -

i'm having problem dialog created. packs in cutting off border titles , input boxes. i've tried setting size of panel , of components, no avail; size never changes. help appreciated in beingness able modify dimensions of dialog.

jtextfield business relationship = new jtextfield(6); account.setdocument(new jtextfieldlimit(6)); account.setborder(new titledborder("account")); string[] firstdigitlist = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}; jcombobox firstdigitcombo = new jcombobox(firstdigitlist); firstdigitcombo.setselectedindex(0); firstdigitcombo.setborder(new titledborder("leading digit change")); jpanel panel = new jpanel(); panel.add(account); panel.add(firstdigitcombo); int result = joptionpane.showconfirmdialog(null, panel, "please come in values", joptionpane.ok_cancel_option);

the basic problem titledborder not expand component point big plenty display entire text. instead truncate text.

the solution ensure components big plenty text display. have shown here expanding size of text field, , adding 'full length' label in placed of 'shortened' title.

import java.awt.*; import javax.swing.*; import javax.swing.border.*; class testsizeofgui { public static void main(string[] args) { swingutilities.invokelater(new runnable() { public void run() { jtextfield business relationship = new jtextfield(10); jpanel accountpanel = new jpanel(new gridlayout()); accountpanel.add(account); accountpanel.setborder(new titledborder("account")); string[] firstdigitlist = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}; jlabel firstdigitlistlabel = new jlabel("leading digit change"); jpanel firstdigitlistpanel = new jpanel(new borderlayout(4,2)); firstdigitlistpanel.add(firstdigitlistlabel, borderlayout.west); jcombobox firstdigitcombo = new jcombobox(firstdigitlist); firstdigitlistpanel.add(firstdigitcombo); firstdigitcombo.setselectedindex(0); firstdigitlistpanel.setborder(new titledborder("ldc")); jpanel panel = new jpanel(); panel.add(accountpanel); panel.add(firstdigitlistpanel); int result = joptionpane.showconfirmdialog( null, panel, "please come in values", joptionpane.ok_cancel_option); } }); } }

java swing jdialog

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -