jdk/src/java.desktop/share/classes/javax/swing/Action.java
author aghaisas
Mon, 10 Jul 2017 14:55:29 +0530
changeset 47151 362dcbee0613
parent 45648 87c997b74bb8
permissions -rw-r--r--
6919529: NPE from MultiUIDefaults.getUIError Reviewed-by: aghaisas, psadhukhan, serb Contributed-by: shashidhara.veerabhadraiah@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
44655
06871a50a4b5 8177461: Wrong references are used in the javadoc in the java.desktop module
serb
parents: 35650
diff changeset
     2
 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2473
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2473
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2473
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2473
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2473
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package javax.swing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.beans.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * The <code>Action</code> interface provides a useful extension to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * <code>ActionListener</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * interface in cases where the same functionality may be accessed by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * several controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * In addition to the <code>actionPerformed</code> method defined by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <code>ActionListener</code> interface, this interface allows the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * application to define, in a single place:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <li>One or more text strings that describe the function. These strings
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *     can be used, for example, to display the flyover text for a button
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *     or to set the text in a menu item.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <li>One or more icons that depict the function. These icons can be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *     for the images in a menu control, or for composite entries in a more
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *     sophisticated user interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <li>The enabled/disabled state of the functionality. Instead of having
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *     to separately disable the menu item and the toolbar button, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *     application can disable the function that implements this interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *     All components which are registered as listeners for the state change
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *     then know to disable event generation for that item and to modify the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *     display accordingly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * This interface can be added to an existing class or used to create an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * adapter (typically, by subclassing <code>AbstractAction</code>).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * The <code>Action</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * can then be added to multiple <code>Action</code>-aware containers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * and connected to <code>Action</code>-capable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * components. The GUI controls can then be activated or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * deactivated all at once by invoking the <code>Action</code> object's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * <code>setEnabled</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * Note that <code>Action</code> implementations tend to be more expensive
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * in terms of storage than a typical <code>ActionListener</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * which does not offer the benefits of centralized control of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * functionality and broadcast of property changes.  For this reason,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * you should take care to only use <code>Action</code>s where their benefits
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * are desired, and use simple <code>ActionListener</code>s elsewhere.
21982
fd6e5fe509df 8029264: [doclint] more doclint and tidy cleanup
yan
parents: 21592
diff changeset
    70
 * <br>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *
45025
9ad3afa82b5e 8179596: Update java.desktop to be HTML-5 friendly
serb
parents: 44655
diff changeset
    72
 * <h3><a id="buttonActions"></a>Swing Components Supporting <code>Action</code></h3>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * Many of Swing's components have an <code>Action</code> property.  When
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * an <code>Action</code> is set on a component, the following things
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * happen:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * <li>The <code>Action</code> is added as an <code>ActionListener</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *     the component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * <li>The component configures some of its properties to match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *      <code>Action</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * <li>The component installs a <code>PropertyChangeListener</code> on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *     <code>Action</code> so that the component can change its properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 *     to reflect changes in the <code>Action</code>'s properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * The following table describes the properties used by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * <code>Swing</code> components that support <code>Actions</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * In the table, <em>button</em> refers to any
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * <code>AbstractButton</code> subclass, which includes not only
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * <code>JButton</code> but also classes such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * <code>JMenuItem</code>. Unless otherwise stated, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * <code>null</code> property value in an <code>Action</code> (or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * <code>Action</code> that is <code>null</code>) results in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * button's corresponding property being set to <code>null</code>.
21982
fd6e5fe509df 8029264: [doclint] more doclint and tidy cleanup
yan
parents: 21592
diff changeset
    96
 *
45648
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
    97
 * <table class="striped">
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
    98
 * <caption>Supported Action properties</caption>
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
    99
 * <thead>
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
   100
 *  <tr>
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
   101
 *    <th>Component Property
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
   102
 *    <th>Components
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
   103
 *    <th>Action Key
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
   104
 *    <th>Notes
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
   105
 * </thead>
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
   106
 * <tbody>
45025
9ad3afa82b5e 8179596: Update java.desktop to be HTML-5 friendly
serb
parents: 44655
diff changeset
   107
 *  <tr valign="top" style="text-align:left">
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 *      <td><b><code>enabled</code></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 *      <td>All
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 *      <td>The <code>isEnabled</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 *      <td>&nbsp;
45025
9ad3afa82b5e 8179596: Update java.desktop to be HTML-5 friendly
serb
parents: 44655
diff changeset
   112
 *  <tr valign="top" style="text-align:left">
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 *      <td><b><code>toolTipText</code></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 *      <td>All
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 *      <td><code>SHORT_DESCRIPTION</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 *      <td>&nbsp;
45025
9ad3afa82b5e 8179596: Update java.desktop to be HTML-5 friendly
serb
parents: 44655
diff changeset
   117
 *  <tr valign="top" style="text-align:left">
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 *      <td><b><code>actionCommand</code></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 *      <td>All
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 *      <td><code>ACTION_COMMAND_KEY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *      <td>&nbsp;
45025
9ad3afa82b5e 8179596: Update java.desktop to be HTML-5 friendly
serb
parents: 44655
diff changeset
   122
 *  <tr valign="top" style="text-align:left">
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 *      <td><b><code>mnemonic</code></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 *      <td>All buttons
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 *      <td><code>MNEMONIC_KEY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 *      <td>A <code>null</code> value or <code>Action</code> results in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 *          button's <code>mnemonic</code> property being set to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 *          <code>'\0'</code>.
45025
9ad3afa82b5e 8179596: Update java.desktop to be HTML-5 friendly
serb
parents: 44655
diff changeset
   129
 *  <tr valign="top" style="text-align:left">
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 *      <td><b><code>text</code></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 *      <td>All buttons
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 *      <td><code>NAME</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 *      <td>If you do not want the text of the button to mirror that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 *          of the <code>Action</code>, set the property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 *          <code>hideActionText</code> to <code>true</code>.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 *          <code>hideActionText</code> is <code>true</code>, setting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 *          <code>Action</code> changes the text of the button to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 *          <code>null</code> and any changes to <code>NAME</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 *          are ignored.  <code>hideActionText</code> is useful for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 *          tool bar buttons that typically only show an <code>Icon</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 *          <code>JToolBar.add(Action)</code> sets the property to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 *          <code>true</code> if the <code>Action</code> has a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 *          non-<code>null</code> value for <code>LARGE_ICON_KEY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 *          <code>SMALL_ICON</code>.
45025
9ad3afa82b5e 8179596: Update java.desktop to be HTML-5 friendly
serb
parents: 44655
diff changeset
   145
 *  <tr valign="top" style="text-align:left">
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 *      <td><b><code>displayedMnemonicIndex</code></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 *      <td>All buttons
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 *      <td><code>DISPLAYED_MNEMONIC_INDEX_KEY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 *      <td>If the value of <code>DISPLAYED_MNEMONIC_INDEX_KEY</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 *          beyond the bounds of the text, it is ignored.  When
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 *          <code>setAction</code> is called, if the value from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 *          <code>Action</code> is <code>null</code>, the displayed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 *          mnemonic index is not updated.  In any subsequent changes to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 *          <code>DISPLAYED_MNEMONIC_INDEX_KEY</code>, <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 *          is treated as -1.
45025
9ad3afa82b5e 8179596: Update java.desktop to be HTML-5 friendly
serb
parents: 44655
diff changeset
   156
 *  <tr valign="top" style="text-align:left">
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 *      <td><b><code>icon</code></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 *      <td>All buttons except of <code>JCheckBox</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 *      <code>JToggleButton</code> and <code>JRadioButton</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 *      <td>either <code>LARGE_ICON_KEY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 *          <code>SMALL_ICON</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 *     <td>The <code>JMenuItem</code> subclasses only use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 *         <code>SMALL_ICON</code>.  All other buttons will use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 *         <code>LARGE_ICON_KEY</code>; if the value is <code>null</code> they
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 *         use <code>SMALL_ICON</code>.
45025
9ad3afa82b5e 8179596: Update java.desktop to be HTML-5 friendly
serb
parents: 44655
diff changeset
   166
 *  <tr valign="top" style="text-align:left">
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 *      <td><b><code>accelerator</code></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 *      <td>All <code>JMenuItem</code> subclasses, with the exception of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 *          <code>JMenu</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 *      <td><code>ACCELERATOR_KEY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 *      <td>&nbsp;
45025
9ad3afa82b5e 8179596: Update java.desktop to be HTML-5 friendly
serb
parents: 44655
diff changeset
   172
 *  <tr valign="top" style="text-align:left">
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 *      <td><b><code>selected</code></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 *      <td><code>JToggleButton</code>, <code>JCheckBox</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 *          <code>JRadioButton</code>, <code>JCheckBoxMenuItem</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 *          <code>JRadioButtonMenuItem</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 *      <td><code>SELECTED_KEY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 *      <td>Components that honor this property only use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 *          the value if it is {@code non-null}. For example, if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 *          you set an {@code Action} that has a {@code null}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 *          value for {@code SELECTED_KEY} on a {@code JToggleButton}, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 *          {@code JToggleButton} will not update it's selected state in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 *          any way. Similarly, any time the {@code JToggleButton}'s
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 *          selected state changes it will only set the value back on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 *          the {@code Action} if the {@code Action} has a {@code non-null}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 *          value for {@code SELECTED_KEY}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 *          <br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 *          Components that honor this property keep their selected state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 *          in sync with this property. When the same {@code Action} is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 *          with multiple components, all the components keep their selected
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 *          state in sync with this property. Mutually exclusive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 *          buttons, such as {@code JToggleButton}s in a {@code ButtonGroup},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 *          force only one of the buttons to be selected. As such, do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 *          use the same {@code Action} that defines a value for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
 *          {@code SELECTED_KEY} property with multiple mutually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
 *          exclusive buttons.
45648
87c997b74bb8 8180326: Update the tables in java.desktop to be HTML-5 friendly
serb
parents: 45025
diff changeset
   197
 * </tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 * <code>JPopupMenu</code>, <code>JToolBar</code> and <code>JMenu</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * all provide convenience methods for creating a component and setting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 * <code>Action</code> on the corresponding component.  Refer to each of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
 * these classes for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 * <code>Action</code> uses <code>PropertyChangeListener</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 * inform listeners the <code>Action</code> has changed.  The beans
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 * specification indicates that a <code>null</code> property name can
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 * be used to indicate multiple values have changed.  By default Swing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 * components that take an <code>Action</code> do not handle such a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 * change.  To indicate that Swing should treat <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 * according to the beans specification set the system property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 * <code>swing.actions.reconfigureOnNull</code> to the <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 * value <code>true</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 * @author Georges Saab
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 * @see AbstractAction
25201
4adc75e0c4e5 8046485: Add missing @since tag under javax.swing.*
henryjen
parents: 24982
diff changeset
   217
 * @since 1.2
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
public interface Action extends ActionListener {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * Useful constants that can be used as the storage-retrieval key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * when setting or getting one of this object's properties (text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * or icon).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * Not currently used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    public static final String DEFAULT = "Default";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * The key used for storing the <code>String</code> name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * for the action, used for a menu or button.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    public static final String NAME = "Name";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * The key used for storing a short <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * description for the action, used for tooltip text.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    public static final String SHORT_DESCRIPTION = "ShortDescription";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * The key used for storing a longer <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * description for the action, could be used for context-sensitive help.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    public static final String LONG_DESCRIPTION = "LongDescription";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * The key used for storing a small <code>Icon</code>, such
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * as <code>ImageIcon</code>.  This is typically used with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * menus such as <code>JMenuItem</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * If the same <code>Action</code> is used with menus and buttons you'll
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * typically specify both a <code>SMALL_ICON</code> and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * <code>LARGE_ICON_KEY</code>.  The menu will use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * <code>SMALL_ICON</code> and the button will use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * <code>LARGE_ICON_KEY</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    public static final String SMALL_ICON = "SmallIcon";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * The key used to determine the command <code>String</code> for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * <code>ActionEvent</code> that will be created when an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * <code>Action</code> is going to be notified as the result of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * residing in a <code>Keymap</code> associated with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * <code>JComponent</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    public static final String ACTION_COMMAND_KEY = "ActionCommandKey";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * The key used for storing a <code>KeyStroke</code> to be used as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * accelerator for the action.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    public static final String ACCELERATOR_KEY="AcceleratorKey";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * The key used for storing an <code>Integer</code> that corresponds to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * one of the <code>KeyEvent</code> key codes.  The value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * commonly used to specify a mnemonic.  For example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * <code>myAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_A)</code>
2473
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2
diff changeset
   279
     * sets the mnemonic of <code>myAction</code> to 'a', while
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2
diff changeset
   280
     * <code>myAction.putValue(Action.MNEMONIC_KEY, KeyEvent.getExtendedKeyCodeForChar('\u0444'))</code>
3f4bbd3be2f1 6680988: KeyEvent is still missing VK values for many keyboards
yan
parents: 2
diff changeset
   281
     * sets the mnemonic of <code>myAction</code> to Cyrillic letter "Ef".
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    public static final String MNEMONIC_KEY="MnemonicKey";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * The key used for storing a <code>Boolean</code> that corresponds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * to the selected state.  This is typically used only for components
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * that have a meaningful selection state.  For example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * <code>JRadioButton</code> and <code>JCheckBox</code> make use of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * this but instances of <code>JMenu</code> don't.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * This property differs from the others in that it is both read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * by the component and set by the component.  For example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * if an <code>Action</code> is attached to a <code>JCheckBox</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * the selected state of the <code>JCheckBox</code> will be set from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * that of the <code>Action</code>.  If the user clicks on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * <code>JCheckBox</code> the selected state of the <code>JCheckBox</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * <b>and</b> the <code>Action</code> will <b>both</b> be updated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * Note: the value of this field is prefixed with 'Swing' to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * avoid possible collisions with existing <code>Actions</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    public static final String SELECTED_KEY = "SwingSelectedKey";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * The key used for storing an <code>Integer</code> that corresponds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * to the index in the text (identified by the <code>NAME</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * property) that the decoration for a mnemonic should be rendered at.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * the value of this property is greater than or equal to the length of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * the text, it will treated as -1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * Note: the value of this field is prefixed with 'Swing' to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * avoid possible collisions with existing <code>Actions</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @see AbstractButton#setDisplayedMnemonicIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    public static final String DISPLAYED_MNEMONIC_INDEX_KEY =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                                 "SwingDisplayedMnemonicIndexKey";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * The key used for storing an <code>Icon</code>.  This is typically
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * used by buttons, such as <code>JButton</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * <code>JToggleButton</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * If the same <code>Action</code> is used with menus and buttons you'll
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * typically specify both a <code>SMALL_ICON</code> and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * <code>LARGE_ICON_KEY</code>.  The menu will use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * <code>SMALL_ICON</code> and the button the <code>LARGE_ICON_KEY</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * Note: the value of this field is prefixed with 'Swing' to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * avoid possible collisions with existing <code>Actions</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    public static final String LARGE_ICON_KEY = "SwingLargeIconKey";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * Gets one of this object's properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * using the associated key.
24982
37fe99dfd9e9 8046595: fix doclint issues in swing classes, part 2 of 4
yan
parents: 23010
diff changeset
   345
     *
37fe99dfd9e9 8046595: fix doclint issues in swing classes, part 2 of 4
yan
parents: 23010
diff changeset
   346
     * @param key a {@code String} containing the key
37fe99dfd9e9 8046595: fix doclint issues in swing classes, part 2 of 4
yan
parents: 23010
diff changeset
   347
     * @return the {@code Object} value
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * @see #putValue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    public Object getValue(String key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * Sets one of this object's properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * using the associated key. If the value has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * changed, a <code>PropertyChangeEvent</code> is sent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * to listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @param key    a <code>String</code> containing the key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * @param value  an <code>Object</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    public void putValue(String key, Object value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    /**
35650
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   363
     * Sets the enabled state of the {@code Action}.  When enabled,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * any component associated with this object is active and
35650
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   365
     * able to fire this object's {@code actionPerformed} method.
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   366
     * If the value has changed, a {@code PropertyChangeEvent} is sent
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * to listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     *
35650
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   369
     * @param  b true to enable this {@code Action}, false to disable it
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   370
     * @see #accept
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    public void setEnabled(boolean b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    /**
35650
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   374
     * Returns the enabled state of the {@code Action}. When enabled,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * any component associated with this object is active and
35650
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   376
     * able to fire this object's {@code actionPerformed} method.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     *
35650
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   378
     * @return true if this {@code Action} is enabled
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   379
     * @see #accept
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    public boolean isEnabled();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    /**
35650
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   384
     * Determines whether the action should be performed with the specified
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   385
     * sender object. The {@code sender} can be {@code null}.
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   386
     * The method must return false if the action is disabled.
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   387
     * <p>
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   388
     * @param sender the object to check, can be null
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   389
     * @return {@code true} if the action should be performed with the sender
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   390
     *         object, must be false if the action is disabled.
44655
06871a50a4b5 8177461: Wrong references are used in the javadoc in the java.desktop module
serb
parents: 35650
diff changeset
   391
     * @see #isEnabled
06871a50a4b5 8177461: Wrong references are used in the javadoc in the java.desktop module
serb
parents: 35650
diff changeset
   392
     * @see #setEnabled
35650
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   393
     */
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   394
    default boolean accept(Object sender) {
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   395
        return isEnabled();
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   396
    }
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   397
15f1f0ff7790 8133039: Provide public API to sun.swing.UIAction#isEnabled(Object)
alexsch
parents: 25859
diff changeset
   398
    /**
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * Adds a <code>PropertyChange</code> listener. Containers and attached
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * components use these methods to register interest in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * <code>Action</code> object. When its enabled state or other property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * changes, the registered listeners are informed of the change.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * @param listener  a <code>PropertyChangeListener</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    public void addPropertyChangeListener(PropertyChangeListener listener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * Removes a <code>PropertyChange</code> listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * @param listener  a <code>PropertyChangeListener</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * @see #addPropertyChangeListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    public void removePropertyChangeListener(PropertyChangeListener listener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
}