/** * Requests that the initial value be selected, which will set * focus to the initial value. This method * should be invoked after the window containing the option pane * is made visible. */ public void selectInitialValue() { OptionPaneUI ui = getUI(); if (ui != null) { ui.selectInitialValue(this); } }
/** * Invokes the <code>containsCustomComponents</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public boolean containsCustomComponents(JOptionPane a) { boolean returnValue = ((OptionPaneUI) (uis.elementAt(0))).containsCustomComponents(a); for (int i = 1; i < uis.size(); i++) { ((OptionPaneUI) (uis.elementAt(i))).containsCustomComponents(a); } return returnValue; }
/** * Sets the UI object which implements the {@literal L&F} for this component. * * @param ui the <code>OptionPaneUI</code> {@literal L&F} object * @see UIDefaults#getUI */ @BeanProperty(hidden = true, description = "The UI object that implements the optionpane's LookAndFeel") public void setUI(OptionPaneUI ui) { if (this.ui != ui) { super.setUI(ui); invalidate(); } }
/** * Calls the {@link OptionPaneUI#selectInitialValue(JOptionPane)} method for * all the UI delegates managed by this <code>MultiOptionPaneUI</code>. * * @param pane the option pane. */ public void selectInitialValue(JOptionPane pane) { Iterator iterator = uis.iterator(); while (iterator.hasNext()) { OptionPaneUI ui = (OptionPaneUI) iterator.next(); ui.selectInitialValue(pane); } }
@Override public void selectInitialValue(JOptionPane op) { for (Object ui : uis) { ((OptionPaneUI) ui).selectInitialValue(op); } }
@Override public boolean containsCustomComponents(JOptionPane op) { for (int i = 1; i < numberOfUIs; i++) { ((OptionPaneUI) uis.get(i)).containsCustomComponents(op); } return ((OptionPaneUI) uis.firstElement()).containsCustomComponents(op); }
public void testContainsCustomComponents() { OptionPaneUI ui = null; JOptionPane optionPane = null; optionPane = new JOptionPane(); assertFalse(paneUI.containsCustomComponents(optionPane)); assertFalse(paneUI.containsCustomComponents(null)); paneUI.hasCustomComponents = true; assertTrue(paneUI.containsCustomComponents(optionPane)); assertTrue(paneUI.containsCustomComponents(null)); optionPane = new JOptionPane("Message", JOptionPane.ERROR_MESSAGE); ui = optionPane.getUI(); assertFalse(ui.containsCustomComponents(optionPane)); assertFalse(ui.containsCustomComponents(null)); optionPane = new JOptionPane(new JButton("Message"), JOptionPane.ERROR_MESSAGE); ui = optionPane.getUI(); assertTrue(ui.containsCustomComponents(optionPane)); assertTrue(ui.containsCustomComponents(null)); optionPane = new JOptionPane("Message", JOptionPane.ERROR_MESSAGE, JOptionPane.CLOSED_OPTION, null, new Object[] { "1", "2" }); ui = optionPane.getUI(); assertFalse(ui.containsCustomComponents(optionPane)); assertFalse(ui.containsCustomComponents(null)); optionPane = new JOptionPane("Message", JOptionPane.ERROR_MESSAGE, JOptionPane.CLOSED_OPTION, null, new Object[] { new Button("1"), "2" }); ui = optionPane.getUI(); assertTrue(ui.containsCustomComponents(optionPane)); assertTrue(ui.containsCustomComponents(null)); }