56 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
57 |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeEvent; |
58 |
import java.beans.PropertyChangeListener; |
import java.beans.PropertyChangeListener; |
59 |
|
import java.beans.PropertyVetoException; |
60 |
import javax.swing.Box; |
import javax.swing.Box; |
61 |
import javax.swing.BoxLayout; |
import javax.swing.BoxLayout; |
62 |
import javax.swing.Icon; |
import javax.swing.Icon; |
64 |
import javax.swing.JComboBox; |
import javax.swing.JComboBox; |
65 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
66 |
import javax.swing.JDialog; |
import javax.swing.JDialog; |
67 |
|
import javax.swing.JInternalFrame; |
68 |
import javax.swing.JLabel; |
import javax.swing.JLabel; |
69 |
import javax.swing.JList; |
import javax.swing.JList; |
70 |
import javax.swing.JOptionPane; |
import javax.swing.JOptionPane; |
113 |
Object value = new Integer(JOptionPane.CLOSED_OPTION); |
Object value = new Integer(JOptionPane.CLOSED_OPTION); |
114 |
Object[] options = optionPane.getOptions(); |
Object[] options = optionPane.getOptions(); |
115 |
if (options != null) |
if (options != null) |
116 |
value = options[buttonIndex]; |
value = new Integer(buttonIndex); |
117 |
else |
else |
118 |
{ |
{ |
119 |
String text = ((JButton) e.getSource()).getText(); |
String text = ((JButton) e.getSource()).getText(); |
133 |
|
|
134 |
if (owner instanceof JDialog) |
if (owner instanceof JDialog) |
135 |
((JDialog) owner).dispose(); |
((JDialog) owner).dispose(); |
136 |
|
|
137 |
|
//else we probably have some kind of internal frame. |
138 |
|
JInternalFrame inf = (JInternalFrame) SwingUtilities.getAncestorOfClass(JInternalFrame.class, |
139 |
|
optionPane); |
140 |
|
if (inf != null) |
141 |
|
{ |
142 |
|
try |
143 |
|
{ |
144 |
|
inf.setClosed(true); |
145 |
|
} |
146 |
|
catch (PropertyVetoException pve) |
147 |
|
{ |
148 |
|
} |
149 |
|
} |
150 |
} |
} |
151 |
} |
} |
152 |
|
|
658 |
toAdd = new JButton((Icon) buttons[i]); |
toAdd = new JButton((Icon) buttons[i]); |
659 |
else |
else |
660 |
toAdd = new JButton(buttons[i].toString()); |
toAdd = new JButton(buttons[i].toString()); |
|
((JButton) toAdd).addActionListener(createButtonActionListener(i)); |
|
661 |
hasCustomComponents = true; |
hasCustomComponents = true; |
662 |
} |
} |
663 |
|
if (toAdd instanceof JButton) |
664 |
|
((JButton) toAdd).addActionListener(createButtonActionListener(i)); |
665 |
if (i == initialIndex) |
if (i == initialIndex) |
666 |
initialFocusComponent = toAdd; |
initialFocusComponent = toAdd; |
667 |
container.add(toAdd); |
container.add(toAdd); |
853 |
{ |
{ |
854 |
public Dimension getPreferredSize() |
public Dimension getPreferredSize() |
855 |
{ |
{ |
856 |
int w = Math.max(optionPane.getSize().width, |
int w = Math.max(optionPane.getSize().width, minimumWidth); |
|
minimumWidth); |
|
857 |
Insets i = optionPane.getInsets(); |
Insets i = optionPane.getInsets(); |
858 |
Dimension orig = super.getPreferredSize(); |
Dimension orig = super.getPreferredSize(); |
859 |
Dimension value = new Dimension(w - i.left - i.right - iconSize, |
Dimension value = new Dimension(w - i.left - i.right - iconSize, |
871 |
{ |
{ |
872 |
Object[] selection = optionPane.getSelectionValues(); |
Object[] selection = optionPane.getSelectionValues(); |
873 |
|
|
874 |
|
// if (selection == null) |
875 |
|
// inputComponent = new JTextField(); |
876 |
|
// else if (selection.length < 20) |
877 |
|
// inputComponent = new JComboBox(selection); |
878 |
|
// FIXME: Uncomment when the widgets are done. |
879 |
if (selection == null) |
if (selection == null) |
880 |
inputComponent = new JTextField(); |
inputComponent = null; |
|
else if (selection.length < 20) |
|
|
inputComponent = new JComboBox(selection); |
|
881 |
else |
else |
882 |
inputComponent = new JList(selection); |
inputComponent = new JList(selection); |
883 |
if (inputComponent != null) |
if (inputComponent != null) |
990 |
tmp = questionIcon; |
tmp = questionIcon; |
991 |
break; |
break; |
992 |
} |
} |
993 |
return new IconUIResource(tmp); |
return tmp; |
994 |
|
// FIXME: Don't cast till the default icons are in. |
995 |
|
// return new IconUIResource(tmp); |
996 |
} |
} |
997 |
|
|
998 |
/** |
/** |