no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@72 bb69d46d-e84e-40c8-a05a-06db0d633741
lxbfYeaa
Luis Flores 22 years ago
parent 7db602ddf2
commit 3544e7a0ef

@ -21,16 +21,23 @@ public class DataChooserWindow extends CustomJDialog
private final String labels[]; private final String labels[];
private final String items[]; private final String items[];
private final JComboBox combos[]; private final JComboBox combos[];
private final int preselected[];
private boolean canceled = false; private boolean canceled = false;
/** Creates a new instance of DataChooserWindow */ /** Creates a new instance of DataChooserWindow */
public DataChooserWindow( JFrame modalFrame, String names[], String data[] ) public DataChooserWindow( JFrame modalFrame, String names[], String data[] )
{
this( modalFrame, names, data, null );
}
public DataChooserWindow( JFrame modalFrame, String names[], String data[], int selected[] )
{ {
super( modalFrame, true ); super( modalFrame, true );
labels = names; labels = names;
items = data; items = data;
combos = new JComboBox[ labels.length ]; combos = new JComboBox[ labels.length ];
preselected = selected;
setupComponents(); setupComponents();
if( modalFrame == null ) if( modalFrame == null )
{ {
@ -67,6 +74,16 @@ public class DataChooserWindow extends CustomJDialog
*/ gbc.weightx = 1; */ gbc.weightx = 1;
gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.gridwidth = GridBagConstraints.REMAINDER;
JComboBox combo = new JComboBox( items ); JComboBox combo = new JComboBox( items );
int index;
if( preselected == null )
{
index = Math.min( i, items.length );
}
else
{
index = Math.min( preselected[ i ], items.length );
}
combo.setSelectedIndex( index );
combos[ i ] = combo; combos[ i ] = combo;
gbl.setConstraints( combo, gbc ); gbl.setConstraints( combo, gbc );
cont.add( combo ); cont.add( combo );
@ -117,11 +134,11 @@ public class DataChooserWindow extends CustomJDialog
} }
return hash; return hash;
} }
/*
public static void main( String arg[] ) /* public static void main( String arg[] )
{ {
String names[] = new String[] { "Nome:", "Morada:", "Telefone:" }; String names[] = new String[] { "Nome:", "Morada:", "Telefone:" };
String data[] = new String[] { "Joao Catita", "Damaiasdg sdfg sdf gsdfs hgf h", "nao tem", "so a noite", "" }; String data[] = new String[] { "Joao Catita", "Damaiasdg sdfg sdf gsdfs hgf h", "nao tem", "so a noite", "" };
DataChooserWindow dcw = new DataChooserWindow( null, names, data ); DataChooserWindow dcw = new DataChooserWindow( null, names, data, new int[] { 3, 2 ,1 } );
}*/ }*/
} }

Loading…
Cancel
Save