< prev index next >
src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java
Print this page
*** 43,55 ****
import sun.security.action.GetPropertyAction;
/**
! * Provides the basic look and feel for a <code>JOptionPane</code>.
! * <code>BasicMessagePaneUI</code> provides a means to place an icon,
! * message and buttons into a <code>Container</code>.
* Generally, the layout will look like:
* <pre>
* ------------------
* | i | message |
* | c | message |
--- 43,55 ----
import sun.security.action.GetPropertyAction;
/**
! * Provides the basic look and feel for a {@code JOptionPane}.
! * {@code BasicMessagePaneUI} provides a means to place an icon,
! * message and buttons into a {@code Container}.
* Generally, the layout will look like:
* <pre>
* ------------------
* | i | message |
* | c | message |
*** 57,78 ****
* | n | message |
* ------------------
* | buttons |
* |________________|
* </pre>
! * icon is an instance of <code>Icon</code> that is wrapped inside a
! * <code>JLabel</code>. The message is an opaque object and is tested
! * for the following: if the message is a <code>Component</code> it is
! * added to the <code>Container</code>, if it is an <code>Icon</code>
! * it is wrapped inside a <code>JLabel</code> and added to the
! * <code>Container</code> otherwise it is wrapped inside a <code>JLabel</code>.
* <p>
* The above layout is used when the option pane's
! * <code>ComponentOrientation</code> property is horizontal, left-to-right.
* The layout will be adjusted appropriately for other orientations.
* <p>
! * The <code>Container</code>, message, icon, and buttons are all
* determined from abstract methods.
*
* @author James Gosling
* @author Scott Violet
* @author Amy Fowler
--- 57,78 ----
* | n | message |
* ------------------
* | buttons |
* |________________|
* </pre>
! * icon is an instance of {@code Icon} that is wrapped inside a
! * {@code JLabel}. The message is an opaque object and is tested
! * for the following: if the message is a {@code Component} it is
! * added to the {@code Container}, if it is an {@code Icon}
! * it is wrapped inside a {@code JLabel} and added to the
! * {@code Container} otherwise it is wrapped inside a {@code JLabel}.
* <p>
* The above layout is used when the option pane's
! * {@code ComponentOrientation} property is horizontal, left-to-right.
* The layout will be adjusted appropriately for other orientations.
* <p>
! * The {@code Container}, message, icon, and buttons are all
* determined from abstract methods.
*
* @author James Gosling
* @author Scott Violet
* @author Amy Fowler
*** 143,153 ****
return new BasicOptionPaneUI();
}
/**
* Installs the receiver as the L&F for the passed in
! * <code>JOptionPane</code>.
*/
public void installUI(JComponent c) {
optionPane = (JOptionPane)c;
installDefaults();
optionPane.setLayout(createLayoutManager());
--- 143,153 ----
return new BasicOptionPaneUI();
}
/**
* Installs the receiver as the L&F for the passed in
! * {@code JOptionPane}.
*/
public void installUI(JComponent c) {
optionPane = (JOptionPane)c;
installDefaults();
optionPane.setLayout(createLayoutManager());
*** 302,316 ****
return new Dimension(minimumSize.width,
minimumSize.height);
}
/**
! * If <code>c</code> is the <code>JOptionPane</code> the receiver
* is contained in, the preferred
* size that is returned is the maximum of the preferred size of
! * the <code>LayoutManager</code> for the <code>JOptionPane</code>, and
! * <code>getMinimumOptionPaneSize</code>.
*/
public Dimension getPreferredSize(JComponent c) {
if (c == optionPane) {
Dimension ourMin = getMinimumOptionPaneSize();
LayoutManager lm = c.getLayout();
--- 302,316 ----
return new Dimension(minimumSize.width,
minimumSize.height);
}
/**
! * If {@code c} is the {@code JOptionPane} the receiver
* is contained in, the preferred
* size that is returned is the maximum of the preferred size of
! * the {@code LayoutManager} for the {@code JOptionPane}, and
! * {@code getMinimumOptionPaneSize}.
*/
public Dimension getPreferredSize(JComponent c) {
if (c == optionPane) {
Dimension ourMin = getMinimumOptionPaneSize();
LayoutManager lm = c.getLayout();
*** 831,841 ****
/**
* Returns the buttons to display from the {@code JOptionPane} the receiver is
* providing the look and feel for. If the {@code JOptionPane} has options
* set, they will be provided, otherwise if the optionType is
* {@code YES_NO_OPTION}, {@code yesNoOptions} is returned, if the type is
! * {@code YES_NO_CANCEL_OPTION} {@code yesNoCancelOptions} is returned, otherwise
* {@code defaultButtons} are returned.
*
* @return the buttons to display from the JOptionPane
*/
protected Object[] getButtons() {
--- 831,841 ----
/**
* Returns the buttons to display from the {@code JOptionPane} the receiver is
* providing the look and feel for. If the {@code JOptionPane} has options
* set, they will be provided, otherwise if the optionType is
* {@code YES_NO_OPTION}, {@code yesNoOptions} is returned, if the type is
! * {@code YES_NO_CANCEL_OPTION yesNoCancelOptions} is returned, otherwise
* {@code defaultButtons} are returned.
*
* @return the buttons to display from the JOptionPane
*/
protected Object[] getButtons() {
*** 1001,1013 ****
return hasCustomComponents;
}
/**
! * <code>ButtonAreaLayout</code> behaves in a similar manner to
! * <code>FlowLayout</code>. It lays out all components from left to
! * right. If <code>syncAllWidths</code> is true, the widths of each
* component will be set to the largest preferred size width.
*
* This class should be treated as a "protected" inner class.
* Instantiate it only within subclasses of {@code BasicOptionPaneUI}.
*/
--- 1001,1013 ----
return hasCustomComponents;
}
/**
! * {@code ButtonAreaLayout} behaves in a similar manner to
! * {@code FlowLayout}. It lays out all components from left to
! * right. If {@code syncAllWidths} is true, the widths of each
* component will be set to the largest preferred size width.
*
* This class should be treated as a "protected" inner class.
* Instantiate it only within subclasses of {@code BasicOptionPaneUI}.
*/
*** 1256,1266 ****
* This class should be treated as a "protected" inner class.
* Instantiate it only within subclasses of {@code BasicOptionPaneUI}.
*/
public class PropertyChangeHandler implements PropertyChangeListener {
/**
! * If the source of the PropertyChangeEvent <code>e</code> equals the
* optionPane and is one of the ICON_PROPERTY, MESSAGE_PROPERTY,
* OPTIONS_PROPERTY or INITIAL_VALUE_PROPERTY,
* validateComponent is invoked.
*/
public void propertyChange(PropertyChangeEvent e) {
--- 1256,1266 ----
* This class should be treated as a "protected" inner class.
* Instantiate it only within subclasses of {@code BasicOptionPaneUI}.
*/
public class PropertyChangeHandler implements PropertyChangeListener {
/**
! * If the source of the PropertyChangeEvent {@code e} equals the
* optionPane and is one of the ICON_PROPERTY, MESSAGE_PROPERTY,
* OPTIONS_PROPERTY or INITIAL_VALUE_PROPERTY,
* validateComponent is invoked.
*/
public void propertyChange(PropertyChangeEvent e) {
*** 1524,1534 ****
/**
* Registered in the ActionMap. Sets the value of the option pane
! * to <code>JOptionPane.CLOSED_OPTION</code>.
*/
private static class Actions extends UIAction {
private static final String CLOSE = "close";
Actions(String key) {
--- 1524,1534 ----
/**
* Registered in the ActionMap. Sets the value of the option pane
! * to {@code JOptionPane.CLOSED_OPTION}.
*/
private static class Actions extends UIAction {
private static final String CLOSE = "close";
Actions(String key) {
< prev index next >