/** * Verify that the {@code key} argument is a legal value for the * vertical properties. Valid values are: * <ul> * <li>{@code SwingConstants.CENTER} * <li>{@code SwingConstants.TOP} * <li>{@code SwingConstants.BOTTOM} * </ul> * * @param key the property value to check * @param exception the message to use in the * {@code IllegalArgumentException} that is thrown for an invalid * value * @exception IllegalArgumentException if key is not one of the legal * values listed above */ protected int checkVerticalKey(int key, String exception) { if ((key == TOP) || (key == CENTER) || (key == BOTTOM)) { return key; } else { throw new IllegalArgumentException(exception); } } /** *{@inheritDoc} * * @since 1.6 */ public void removeNotify() { super.removeNotify(); if(isRolloverEnabled()) { getModel().setRollover(false); } } /** * Sets the action command for this button. * @param actionCommand the action command for this button */ public void setActionCommand(String actionCommand) { getModel().setActionCommand(actionCommand); } /** * Returns the action command for this button. * @return the action command for this button */ public String getActionCommand() { String ac = getModel().getActionCommand(); if(ac == null) { ac = getText(); } return ac; } private Action action; private PropertyChangeListener actionPropertyChangeListener; /** * Sets the <code>Action</code>. * The new <code>Action</code> replaces any previously set * <code>Action</code> but does not affect <code>ActionListeners</code> * independently added with <code>addActionListener</code>. * If the <code>Action</code> is already a registered * <code>ActionListener</code> for the button, it is not re-registered. * <p> * Setting the <code>Action</code> results in immediately changing * all the properties described in <a href="Action.html#buttonActions"> * Swing Components Supporting <code>Action</code></a>. * Subsequently, the button's properties are automatically updated * as the <code>Action</code>'s properties change. * <p> * This method uses three other methods to set * and help track the <code>Action</code>'s property values. * It uses the <code>configurePropertiesFromAction</code> method * to immediately change the button's properties. * To track changes in the <code>Action</code>'s property values, * this method registers the <code>PropertyChangeListener</code> * returned by <code>createActionPropertyChangeListener</code>. The * default {@code PropertyChangeListener} invokes the * {@code actionPropertyChanged} method when a property in the * {@code Action} changes. * * @param a the <code>Action</code> for the <code>AbstractButton</code>, * or <code>null</code> * @since 1.3 * @see Action * @see #getAction * @see #configurePropertiesFromAction * @see #createActionPropertyChangeListener * @see #actionPropertyChanged * @beaninfo * bound: true * attribute: visualUpdate true * description: the Action instance connected with this ActionEvent source */ public void setAction(Action a) { Action oldValue = getAction(); if (action==null || !action.equals(a)) { action = a; if (oldValue!=null) { removeActionListener(oldValue); oldValue.removePropertyChangeListener(actionPropertyChangeListener); actionPropertyChangeListener = null; } configurePropertiesFromAction(action); if (action!=null) { // Don't add if it is already a listener if (!isListener(ActionListener.class, action)) { addActionListener(action); } // Reverse linkage: actionPropertyChangeListener = createActionPropertyChangeListener(action); action.addPropertyChangeListener(actionPropertyChangeListener); } firePropertyChange("action", oldValue, action); } } private boolean isListener(Class c, ActionListener a) { boolean isListener = false; Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==c && listeners[i+1]==a) { isListener=true; } } return isListener; } /** * Returns the currently set <code>Action</code> for this * <code>ActionEvent</code> source, or <code>null</code> * if no <code>Action</code> is set. * * @return the <code>Action</code> for this <code>ActionEvent</code> * source, or <code>null</code> * @since 1.3 * @see Action * @see #setAction */ public Action getAction() { return action; } /** * Sets the properties on this button to match those in the specified * <code>Action</code>. Refer to <a href="Action.html#buttonActions"> * Swing Components Supporting <code>Action</code></a> for more * details as to which properties this sets. * * @param a the <code>Action</code> from which to get the properties, * or <code>null</code> * @since 1.3 * @see Action * @see #setAction */ protected void configurePropertiesFromAction(Action a) { setMnemonicFromAction(a); setTextFromAction(a, false); AbstractAction.setToolTipTextFromAction(this, a); setIconFromAction(a); setActionCommandFromAction(a); AbstractAction.setEnabledFromAction(this, a); if (AbstractAction.hasSelectedKey(a) && shouldUpdateSelectedStateFromAction()) { setSelectedFromAction(a); } setDisplayedMnemonicIndexFromAction(a, false); } void clientPropertyChanged(Object key, Object oldValue, Object newValue) { if (key == "hideActionText") { boolean current = (newValue instanceof Boolean) ? (Boolean)newValue : false; if (getHideActionText() != current) { setHideActionText(current); } } } /** * Button subclasses that support mirroring the selected state from * the action should override this to return true. AbstractButton's * implementation returns false. */ boolean shouldUpdateSelectedStateFromAction() { return false; } /** * Updates the button's state in response to property changes in the * associated action. This method is invoked from the * {@code PropertyChangeListener} returned from * {@code createActionPropertyChangeListener}. Subclasses do not normally * need to invoke this. Subclasses that support additional {@code Action} * properties should override this and * {@code configurePropertiesFromAction}. * <p> * Refer to the table at <a href="Action.html#buttonActions"> * Swing Components Supporting <code>Action</code></a> for a list of * the properties this method sets. * * @param action the <code>Action</code> associated with this button * @param propertyName the name of the property that changed * @since 1.6 * @see Action * @see #configurePropertiesFromAction */ protected void actionPropertyChanged(Action action, String propertyName) { if (propertyName == Action.NAME) { setTextFromAction(action, true); } else if (propertyName == "enabled") { AbstractAction.setEnabledFromAction(this, action); } else if (propertyName == Action.SHORT_DESCRIPTION) { AbstractAction.setToolTipTextFromAction(this, action); } else if (propertyName == Action.SMALL_ICON) { smallIconChanged(action); } else if (propertyName == Action.MNEMONIC_KEY) { setMnemonicFromAction(action); } else if (propertyName == Action.ACTION_COMMAND_KEY) { setActionCommandFromAction(action); } else if (propertyName == Action.SELECTED_KEY && AbstractAction.hasSelectedKey(action) && shouldUpdateSelectedStateFromAction()) { setSelectedFromAction(action); } else if (propertyName == Action.DISPLAYED_MNEMONIC_INDEX_KEY) { setDisplayedMnemonicIndexFromAction(action, true); } else if (propertyName == Action.LARGE_ICON_KEY) { largeIconChanged(action); } } private void setDisplayedMnemonicIndexFromAction( Action a, boolean fromPropertyChange) { Integer iValue = (a == null) ? null : (Integer)a.getValue(Action.DISPLAYED_MNEMONIC_INDEX_KEY); if (fromPropertyChange || iValue != null) { int value; if (iValue == null) { value = -1; } else { value = iValue; String text = getText(); if (text == null || value >= text.length()) { value = -1; } } setDisplayedMnemonicIndex(value); } } private void setMnemonicFromAction(Action a) { Integer n = (a == null) ? null : (Integer)a.getValue(Action.MNEMONIC_KEY); setMnemonic((n == null) ? '\0' : n); } private void setTextFromAction(Action a, boolean propertyChange) { boolean hideText = getHideActionText(); if (!propertyChange) { setText((a != null && !hideText) ? (String)a.getValue(Action.NAME) : null); } else if (!hideText) { setText((String)a.getValue(Action.NAME)); } } void setIconFromAction(Action a) { Icon icon = null; if (a != null) { icon = (Icon)a.getValue(Action.LARGE_ICON_KEY); if (icon == null) { icon = (Icon)a.getValue(Action.SMALL_ICON); } } setIcon(icon); } void smallIconChanged(Action a) { if (a.getValue(Action.LARGE_ICON_KEY) == null) { setIconFromAction(a); } } void largeIconChanged(Action a) { setIconFromAction(a); } private void setActionCommandFromAction(Action a) { setActionCommand((a != null) ? (String)a.getValue(Action.ACTION_COMMAND_KEY) : null); } /** * Sets the seleted state of the button from the action. This is defined * here, but not wired up. Subclasses like JToggleButton and * JCheckBoxMenuItem make use of it. * * @param a the Action */ private void setSelectedFromAction(Action a) { boolean selected = false; if (a != null) { selected = AbstractAction.isSelected(a); } if (selected != isSelected()) { // This won't notify ActionListeners, but that should be // ok as the change is coming from the Action. setSelected(selected); // Make sure the change actually took effect if (!selected && isSelected()) { if (getModel() instanceof DefaultButtonModel) { ButtonGroup group = ((DefaultButtonModel)getModel()).getGroup(); if (group != null) { group.clearSelection(); } } } } } /** * Creates and returns a <code>PropertyChangeListener</code> that is * responsible for listening for changes from the specified * <code>Action</code> and updating the appropriate properties. * <p> * <b>Warning:</b> If you subclass this do not create an anonymous * inner class. If you do the lifetime of the button will be tied to * that of the <code>Action</code>. * * @param a the button's action * @since 1.3 * @see Action * @see #setAction */ protected PropertyChangeListener createActionPropertyChangeListener(Action a) { return createActionPropertyChangeListener0(a); } PropertyChangeListener createActionPropertyChangeListener0(Action a) { return new ButtonActionPropertyChangeListener(this, a); } private static class ButtonActionPropertyChangeListener extends ActionPropertyChangeListener<AbstractButton> { ButtonActionPropertyChangeListener(AbstractButton b, Action a) { super(b, a); } protected void actionPropertyChanged(AbstractButton button, Action action, PropertyChangeEvent e) { if (AbstractAction.shouldReconfigure(e)) { button.configurePropertiesFromAction(action); } else { button.actionPropertyChanged(action, e.getPropertyName()); } } } /** * Gets the <code>borderPainted</code> property. * * @return the value of the <code>borderPainted</code> property * @see #setBorderPainted */ public boolean isBorderPainted() { return paintBorder; } /** * Sets the <code>borderPainted</code> property. * If <code>true</code> and the button has a border, * the border is painted. The default value for the * <code>borderPainted</code> property is <code>true</code>. * <p/> * Some look and feels might not support * the <code>borderPainted</code> property, * in which case they ignore this. * * @param b if true and border property is not <code>null</code>, * the border is painted * @see #isBorderPainted * @beaninfo * bound: true * attribute: visualUpdate true * description: Whether the border should be painted. */ public void setBorderPainted(boolean b) { boolean oldValue = paintBorder; paintBorder = b; borderPaintedSet = true; firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, oldValue, paintBorder); if (b != oldValue) { revalidate(); repaint(); } } /** * Paint the button's border if <code>BorderPainted</code> * property is true and the button has a border. * @param g the <code>Graphics</code> context in which to paint * * @see #paint * @see #setBorder */ protected void paintBorder(Graphics g) { if (isBorderPainted()) { super.paintBorder(g); } } /** * Gets the <code>paintFocus</code> property. * * @return the <code>paintFocus</code> property * @see #setFocusPainted */ public boolean isFocusPainted() { return paintFocus; } /** * Sets the <code>paintFocus</code> property, which must * be <code>true</code> for the focus state to be painted. * The default value for the <code>paintFocus</code> property * is <code>true</code>. * Some look and feels might not paint focus state; * they will ignore this property. * * @param b if <code>true</code>, the focus state should be painted * @see #isFocusPainted * @beaninfo * bound: true * attribute: visualUpdate true * description: Whether focus should be painted */ public void setFocusPainted(boolean b) { boolean oldValue = paintFocus; paintFocus = b; firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, oldValue, paintFocus); if (b != oldValue && isFocusOwner()) { revalidate(); repaint(); } } /** * Gets the <code>contentAreaFilled</code> property. * * @return the <code>contentAreaFilled</code> property * @see #setContentAreaFilled */ public boolean isContentAreaFilled() { return contentAreaFilled; } /** * Sets the <code>contentAreaFilled</code> property. * If <code>true</code> the button will paint the content * area. If you wish to have a transparent button, such as * an icon only button, for example, then you should set * this to <code>false</code>. Do not call <code>setOpaque(false)</code>. * The default value for the the <code>contentAreaFilled</code> * property is <code>true</code>. * <p> * This function may cause the component's opaque property to change. * <p> * The exact behavior of calling this function varies on a * component-by-component and L&F-by-L&F basis. * * @param b if true, the content should be filled; if false * the content area is not filled * @see #isContentAreaFilled * @see #setOpaque * @beaninfo * bound: true * attribute: visualUpdate true * description: Whether the button should paint the content area * or leave it transparent. */ public void setContentAreaFilled(boolean b) { boolean oldValue = contentAreaFilled; contentAreaFilled = b; contentAreaFilledSet = true; firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, oldValue, contentAreaFilled); if (b != oldValue) { repaint(); } } /** * Gets the <code>rolloverEnabled</code> property. *Lines 1001–1500 of 3101. Previous lines Load more
/** * Verify that the {@code key} argument is a legal value for the * vertical properties. Valid values are: * <ul> * <li>{@code SwingConstants.CENTER} * <li>{@code SwingConstants.TOP} * <li>{@code SwingConstants.BOTTOM} * </ul> * * @param key the property value to check * @param exception the message to use in the * {@code IllegalArgumentException} that is thrown for an invalid * value * @exception IllegalArgumentException if key is not one of the legal * values listed above */ protected int checkVerticalKey(int key, String exception) { if ((key == TOP) || (key == CENTER) || (key == BOTTOM)) { return key; } else { throw new IllegalArgumentException(exception); } } /** *{@inheritDoc} * * @since 1.6 */ public void removeNotify() { super.removeNotify(); if(isRolloverEnabled()) { getModel().setRollover(false); } } /** * Sets the action command for this button. * @param actionCommand the action command for this button */ public void setActionCommand(String actionCommand) { getModel().setActionCommand(actionCommand); } /** * Returns the action command for this button. * @return the action command for this button */ public String getActionCommand() { String ac = getModel().getActionCommand(); if(ac == null) { ac = getText(); } return ac; } private Action action; private PropertyChangeListener actionPropertyChangeListener; /** * Sets the <code>Action</code>. * The new <code>Action</code> replaces any previously set * <code>Action</code> but does not affect <code>ActionListeners</code> * independently added with <code>addActionListener</code>. * If the <code>Action</code> is already a registered * <code>ActionListener</code> for the button, it is not re-registered. * <p> * Setting the <code>Action</code> results in immediately changing * all the properties described in <a href="Action.html#buttonActions"> * Swing Components Supporting <code>Action</code></a>. * Subsequently, the button's properties are automatically updated * as the <code>Action</code>'s properties change. * <p> * This method uses three other methods to set * and help track the <code>Action</code>'s property values. * It uses the <code>configurePropertiesFromAction</code> method * to immediately change the button's properties. * To track changes in the <code>Action</code>'s property values, * this method registers the <code>PropertyChangeListener</code> * returned by <code>createActionPropertyChangeListener</code>. The * default {@code PropertyChangeListener} invokes the * {@code actionPropertyChanged} method when a property in the * {@code Action} changes. * * @param a the <code>Action</code> for the <code>AbstractButton</code>, * or <code>null</code> * @since 1.3 * @see Action * @see #getAction * @see #configurePropertiesFromAction * @see #createActionPropertyChangeListener * @see #actionPropertyChanged * @beaninfo * bound: true * attribute: visualUpdate true * description: the Action instance connected with this ActionEvent source */ public void setAction(Action a) { Action oldValue = getAction(); if (action==null || !action.equals(a)) { action = a; if (oldValue!=null) { removeActionListener(oldValue); oldValue.removePropertyChangeListener(actionPropertyChangeListener); actionPropertyChangeListener = null; } configurePropertiesFromAction(action); if (action!=null) { // Don't add if it is already a listener if (!isListener(ActionListener.class, action)) { addActionListener(action); } // Reverse linkage: actionPropertyChangeListener = createActionPropertyChangeListener(action); action.addPropertyChangeListener(actionPropertyChangeListener); } firePropertyChange("action", oldValue, action); } } private boolean isListener(Class c, ActionListener a) { boolean isListener = false; Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==c && listeners[i+1]==a) { isListener=true; } } return isListener; } /** * Returns the currently set <code>Action</code> for this * <code>ActionEvent</code> source, or <code>null</code> * if no <code>Action</code> is set. * * @return the <code>Action</code> for this <code>ActionEvent</code> * source, or <code>null</code> * @since 1.3 * @see Action * @see #setAction */ public Action getAction() { return action; } /** * Sets the properties on this button to match those in the specified * <code>Action</code>. Refer to <a href="Action.html#buttonActions"> * Swing Components Supporting <code>Action</code></a> for more * details as to which properties this sets. * * @param a the <code>Action</code> from which to get the properties, * or <code>null</code> * @since 1.3 * @see Action * @see #setAction */ protected void configurePropertiesFromAction(Action a) { setMnemonicFromAction(a); setTextFromAction(a, false); AbstractAction.setToolTipTextFromAction(this, a); setIconFromAction(a); setActionCommandFromAction(a); AbstractAction.setEnabledFromAction(this, a); if (AbstractAction.hasSelectedKey(a) && shouldUpdateSelectedStateFromAction()) { setSelectedFromAction(a); } setDisplayedMnemonicIndexFromAction(a, false); } void clientPropertyChanged(Object key, Object oldValue, Object newValue) { if (key == "hideActionText") { boolean current = (newValue instanceof Boolean) ? (Boolean)newValue : false; if (getHideActionText() != current) { setHideActionText(current); } } } /** * Button subclasses that support mirroring the selected state from * the action should override this to return true. AbstractButton's * implementation returns false. */ boolean shouldUpdateSelectedStateFromAction() { return false; } /** * Updates the button's state in response to property changes in the * associated action. This method is invoked from the * {@code PropertyChangeListener} returned from * {@code createActionPropertyChangeListener}. Subclasses do not normally * need to invoke this. Subclasses that support additional {@code Action} * properties should override this and * {@code configurePropertiesFromAction}. * <p> * Refer to the table at <a href="Action.html#buttonActions"> * Swing Components Supporting <code>Action</code></a> for a list of * the properties this method sets. * * @param action the <code>Action</code> associated with this button * @param propertyName the name of the property that changed * @since 1.6 * @see Action * @see #configurePropertiesFromAction */ protected void actionPropertyChanged(Action action, String propertyName) { if (propertyName == Action.NAME) { setTextFromAction(action, true); } else if (propertyName == "enabled") { AbstractAction.setEnabledFromAction(this, action); } else if (propertyName == Action.SHORT_DESCRIPTION) { AbstractAction.setToolTipTextFromAction(this, action); } else if (propertyName == Action.SMALL_ICON) { smallIconChanged(action); } else if (propertyName == Action.MNEMONIC_KEY) { setMnemonicFromAction(action); } else if (propertyName == Action.ACTION_COMMAND_KEY) { setActionCommandFromAction(action); } else if (propertyName == Action.SELECTED_KEY && AbstractAction.hasSelectedKey(action) && shouldUpdateSelectedStateFromAction()) { setSelectedFromAction(action); } else if (propertyName == Action.DISPLAYED_MNEMONIC_INDEX_KEY) { setDisplayedMnemonicIndexFromAction(action, true); } else if (propertyName == Action.LARGE_ICON_KEY) { largeIconChanged(action); } } private void setDisplayedMnemonicIndexFromAction( Action a, boolean fromPropertyChange) { Integer iValue = (a == null) ? null : (Integer)a.getValue(Action.DISPLAYED_MNEMONIC_INDEX_KEY); if (fromPropertyChange || iValue != null) { int value; if (iValue == null) { value = -1; } else { value = iValue; String text = getText(); if (text == null || value >= text.length()) { value = -1; } } setDisplayedMnemonicIndex(value); } } private void setMnemonicFromAction(Action a) { Integer n = (a == null) ? null : (Integer)a.getValue(Action.MNEMONIC_KEY); setMnemonic((n == null) ? '\0' : n); } private void setTextFromAction(Action a, boolean propertyChange) { boolean hideText = getHideActionText(); if (!propertyChange) { setText((a != null && !hideText) ? (String)a.getValue(Action.NAME) : null); } else if (!hideText) { setText((String)a.getValue(Action.NAME)); } } void setIconFromAction(Action a) { Icon icon = null; if (a != null) { icon = (Icon)a.getValue(Action.LARGE_ICON_KEY); if (icon == null) { icon = (Icon)a.getValue(Action.SMALL_ICON); } } setIcon(icon); } void smallIconChanged(Action a) { if (a.getValue(Action.LARGE_ICON_KEY) == null) { setIconFromAction(a); } } void largeIconChanged(Action a) { setIconFromAction(a); } private void setActionCommandFromAction(Action a) { setActionCommand((a != null) ? (String)a.getValue(Action.ACTION_COMMAND_KEY) : null); } /** * Sets the seleted state of the button from the action. This is defined * here, but not wired up. Subclasses like JToggleButton and * JCheckBoxMenuItem make use of it. * * @param a the Action */ private void setSelectedFromAction(Action a) { boolean selected = false; if (a != null) { selected = AbstractAction.isSelected(a); } if (selected != isSelected()) { // This won't notify ActionListeners, but that should be // ok as the change is coming from the Action. setSelected(selected); // Make sure the change actually took effect if (!selected && isSelected()) { if (getModel() instanceof DefaultButtonModel) { ButtonGroup group = ((DefaultButtonModel)getModel()).getGroup(); if (group != null) { group.clearSelection(); } } } } } /** * Creates and returns a <code>PropertyChangeListener</code> that is * responsible for listening for changes from the specified * <code>Action</code> and updating the appropriate properties. * <p> * <b>Warning:</b> If you subclass this do not create an anonymous * inner class. If you do the lifetime of the button will be tied to * that of the <code>Action</code>. * * @param a the button's action * @since 1.3 * @see Action * @see #setAction */ protected PropertyChangeListener createActionPropertyChangeListener(Action a) { return createActionPropertyChangeListener0(a); } PropertyChangeListener createActionPropertyChangeListener0(Action a) { return new ButtonActionPropertyChangeListener(this, a); } private static class ButtonActionPropertyChangeListener extends ActionPropertyChangeListener<AbstractButton> { ButtonActionPropertyChangeListener(AbstractButton b, Action a) { super(b, a); } protected void actionPropertyChanged(AbstractButton button, Action action, PropertyChangeEvent e) { if (AbstractAction.shouldReconfigure(e)) { button.configurePropertiesFromAction(action); } else { button.actionPropertyChanged(action, e.getPropertyName()); } } } /** * Gets the <code>borderPainted</code> property. * * @return the value of the <code>borderPainted</code> property * @see #setBorderPainted */ public boolean isBorderPainted() { return paintBorder; } /** * Sets the <code>borderPainted</code> property. * If <code>true</code> and the button has a border, * the border is painted. The default value for the * <code>borderPainted</code> property is <code>true</code>. * <p/> * Some look and feels might not support * the <code>borderPainted</code> property, * in which case they ignore this. * * @param b if true and border property is not <code>null</code>, * the border is painted * @see #isBorderPainted * @beaninfo * bound: true * attribute: visualUpdate true * description: Whether the border should be painted. */ public void setBorderPainted(boolean b) { boolean oldValue = paintBorder; paintBorder = b; borderPaintedSet = true; firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, oldValue, paintBorder); if (b != oldValue) { revalidate(); repaint(); } } /** * Paint the button's border if <code>BorderPainted</code> * property is true and the button has a border. * @param g the <code>Graphics</code> context in which to paint * * @see #paint * @see #setBorder */ protected void paintBorder(Graphics g) { if (isBorderPainted()) { super.paintBorder(g); } } /** * Gets the <code>paintFocus</code> property. * * @return the <code>paintFocus</code> property * @see #setFocusPainted */ public boolean isFocusPainted() { return paintFocus; } /** * Sets the <code>paintFocus</code> property, which must * be <code>true</code> for the focus state to be painted. * The default value for the <code>paintFocus</code> property * is <code>true</code>. * Some look and feels might not paint focus state; * they will ignore this property. * * @param b if <code>true</code>, the focus state should be painted * @see #isFocusPainted * @beaninfo * bound: true * attribute: visualUpdate true * description: Whether focus should be painted */ public void setFocusPainted(boolean b) { boolean oldValue = paintFocus; paintFocus = b; firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, oldValue, paintFocus); if (b != oldValue && isFocusOwner()) { revalidate(); repaint(); } } /** * Gets the <code>contentAreaFilled</code> property. * * @return the <code>contentAreaFilled</code> property * @see #setContentAreaFilled */ public boolean isContentAreaFilled() { return contentAreaFilled; } /** * Sets the <code>contentAreaFilled</code> property. * If <code>true</code> the button will paint the content * area. If you wish to have a transparent button, such as * an icon only button, for example, then you should set * this to <code>false</code>. Do not call <code>setOpaque(false)</code>. * The default value for the the <code>contentAreaFilled</code> * property is <code>true</code>. * <p> * This function may cause the component's opaque property to change. * <p> * The exact behavior of calling this function varies on a * component-by-component and L&F-by-L&F basis. * * @param b if true, the content should be filled; if false * the content area is not filled * @see #isContentAreaFilled * @see #setOpaque * @beaninfo * bound: true * attribute: visualUpdate true * description: Whether the button should paint the content area * or leave it transparent. */ public void setContentAreaFilled(boolean b) { boolean oldValue = contentAreaFilled; contentAreaFilled = b; contentAreaFilledSet = true; firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, oldValue, contentAreaFilled); if (b != oldValue) { repaint(); } } /** * Gets the <code>rolloverEnabled</code> property. *