20/04/2011, 11:02
|
| | Fecha de Ingreso: noviembre-2010
Mensajes: 29
Antigüedad: 14 años, 1 mes Puntos: 0 | |
Respuesta: setDefaultCloseOperation para si quieres usarlo como un dialogo puedes hacerlo:
Direct Use:
To create and use an JOptionPane directly, the standard pattern is roughly as follows:
JOptionPane pane = new JOptionPane(arguments);
pane.set.Xxxx(...); // Configure
JDialog dialog = pane.createDialog(parentComponent, title);
dialog.show();
Object selectedValue = pane.getValue();
if(selectedValue == null)
return CLOSED_OPTION;
//If there is not an array of option buttons:
if(options == null) {
if(selectedValue instanceof Integer)
return ((Integer)selectedValue).intValue();
return CLOSED_OPTION;
}
//If there is an array of option buttons:
for(int counter = 0, maxCounter = options.length;
counter < maxCounter; counter++) {
if(options[counter].equals(selectedValue))
return counter;
}
return CLOSED_OPTION;
http://download.oracle.com/javase/6/docs/api/javax/swing/JOptionPane.html |