< prev index next >

src/java.desktop/share/classes/javax/swing/DefaultButtonModel.java

Print this page

        

*** 30,48 **** import java.io.Serializable; import java.util.EventListener; import javax.swing.event.*; /** ! * The default implementation of a <code>Button</code> component's data model. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @author Jeff Dinkins * @since 1.2 */ --- 30,48 ---- import java.io.Serializable; import java.util.EventListener; import javax.swing.event.*; /** ! * The default implementation of a {@code Button} component's data model. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @author Jeff Dinkins * @since 1.2 */
*** 60,70 **** /** The button's mnemonic. */ protected int mnemonic = 0; /** ! * Only one <code>ChangeEvent</code> is needed per button model * instance since the event's only state is the source property. * The source of events generated is always "this". */ protected transient ChangeEvent changeEvent = null; --- 60,70 ---- /** The button's mnemonic. */ protected int mnemonic = 0; /** ! * Only one {@code ChangeEvent} is needed per button model * instance since the event's only state is the source property. * The source of events generated is always "this". */ protected transient ChangeEvent changeEvent = null;
*** 74,84 **** // controls the usage of the MenuItem.disabledAreNavigable UIDefaults // property in the setArmed() method private boolean menuItem = false; /** ! * Constructs a <code>DefaultButtonModel</code>. * */ public DefaultButtonModel() { stateMask = 0; setEnabled(true); --- 74,84 ---- // controls the usage of the MenuItem.disabledAreNavigable UIDefaults // property in the setArmed() method private boolean menuItem = false; /** ! * Constructs a {@code DefaultButtonModel}. * */ public DefaultButtonModel() { stateMask = 0; setEnabled(true);
*** 314,326 **** listenerList.remove(ChangeListener.class, l); } /** * Returns an array of all the change listeners ! * registered on this <code>DefaultButtonModel</code>. * ! * @return all of this model's <code>ChangeListener</code>s * or an empty * array if no change listeners are currently registered * * @see #addChangeListener * @see #removeChangeListener --- 314,326 ---- listenerList.remove(ChangeListener.class, l); } /** * Returns an array of all the change listeners ! * registered on this {@code DefaultButtonModel}. * ! * @return all of this model's {@code ChangeListener}s * or an empty * array if no change listeners are currently registered * * @see #addChangeListener * @see #removeChangeListener
*** 367,379 **** listenerList.remove(ActionListener.class, l); } /** * Returns an array of all the action listeners ! * registered on this <code>DefaultButtonModel</code>. * ! * @return all of this model's <code>ActionListener</code>s * or an empty * array if no action listeners are currently registered * * @see #addActionListener * @see #removeActionListener --- 367,379 ---- listenerList.remove(ActionListener.class, l); } /** * Returns an array of all the action listeners ! * registered on this {@code DefaultButtonModel}. * ! * @return all of this model's {@code ActionListener}s * or an empty * array if no action listeners are currently registered * * @see #addActionListener * @see #removeActionListener
*** 386,396 **** /** * Notifies all listeners that have registered interest for * notification on this event type. * ! * @param e the <code>ActionEvent</code> to deliver to listeners * @see EventListenerList */ protected void fireActionPerformed(ActionEvent e) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); --- 386,396 ---- /** * Notifies all listeners that have registered interest for * notification on this event type. * ! * @param e the {@code ActionEvent} to deliver to listeners * @see EventListenerList */ protected void fireActionPerformed(ActionEvent e) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList();
*** 420,432 **** listenerList.remove(ItemListener.class, l); } /** * Returns an array of all the item listeners ! * registered on this <code>DefaultButtonModel</code>. * ! * @return all of this model's <code>ItemListener</code>s * or an empty * array if no item listeners are currently registered * * @see #addItemListener * @see #removeItemListener --- 420,432 ---- listenerList.remove(ItemListener.class, l); } /** * Returns an array of all the item listeners ! * registered on this {@code DefaultButtonModel}. * ! * @return all of this model's {@code ItemListener}s * or an empty * array if no item listeners are currently registered * * @see #addItemListener * @see #removeItemListener
*** 439,449 **** /** * Notifies all listeners that have registered interest for * notification on this event type. * ! * @param e the <code>ItemEvent</code> to deliver to listeners * @see EventListenerList */ protected void fireItemStateChanged(ItemEvent e) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); --- 439,449 ---- /** * Notifies all listeners that have registered interest for * notification on this event type. * ! * @param e the {@code ItemEvent} to deliver to listeners * @see EventListenerList */ protected void fireItemStateChanged(ItemEvent e) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList();
*** 464,477 **** * <code><em>Foo</em>Listener</code>s * upon this model. * <code><em>Foo</em>Listener</code>s * are registered using the <code>add<em>Foo</em>Listener</code> method. * <p> ! * You can specify the <code>listenerType</code> argument * with a class literal, such as <code><em>Foo</em>Listener.class</code>. ! * For example, you can query a <code>DefaultButtonModel</code> ! * instance <code>m</code> * for its action listeners * with the following code: * * <pre>ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));</pre> * --- 464,477 ---- * <code><em>Foo</em>Listener</code>s * upon this model. * <code><em>Foo</em>Listener</code>s * are registered using the <code>add<em>Foo</em>Listener</code> method. * <p> ! * You can specify the {@code listenerType} argument * with a class literal, such as <code><em>Foo</em>Listener.class</code>. ! * For example, you can query a {@code DefaultButtonModel} ! * instance {@code m} * for its action listeners * with the following code: * * <pre>ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));</pre> *
*** 479,497 **** * this method returns an empty array. * * @param <T> the type of requested listeners * @param listenerType the type of listeners requested; * this parameter should specify an interface ! * that descends from <code>java.util.EventListener</code> * @return an array of all objects registered as * <code><em>Foo</em>Listener</code>s * on this model, * or an empty array if no such * listeners have been added ! * @exception ClassCastException if <code>listenerType</code> doesn't * specify a class or interface that implements ! * <code>java.util.EventListener</code> * * @see #getActionListeners * @see #getChangeListeners * @see #getItemListeners * --- 479,497 ---- * this method returns an empty array. * * @param <T> the type of requested listeners * @param listenerType the type of listeners requested; * this parameter should specify an interface ! * that descends from {@code java.util.EventListener} * @return an array of all objects registered as * <code><em>Foo</em>Listener</code>s * on this model, * or an empty array if no such * listeners have been added ! * @exception ClassCastException if {@code listenerType} doesn't * specify a class or interface that implements ! * {@code java.util.EventListener} * * @see #getActionListeners * @see #getChangeListeners * @see #getItemListeners *
*** 499,509 **** */ public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } ! /** Overridden to return <code>null</code>. */ public Object[] getSelectedObjects() { return null; } /** --- 499,509 ---- */ public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } ! /** Overridden to return {@code null}. */ public Object[] getSelectedObjects() { return null; } /**
*** 516,526 **** /** * Returns the group that the button belongs to. * Normally used with radio buttons, which are mutually * exclusive within their group. * ! * @return the <code>ButtonGroup</code> that the button belongs to * * @since 1.3 */ public ButtonGroup getGroup() { return group; --- 516,526 ---- /** * Returns the group that the button belongs to. * Normally used with radio buttons, which are mutually * exclusive within their group. * ! * @return the {@code ButtonGroup} that the button belongs to * * @since 1.3 */ public ButtonGroup getGroup() { return group;
< prev index next >