< prev index next >
src/share/classes/javax/swing/AbstractButton.java
Print this page
rev 1527 : 6727662: Code improvement and warnings removing from swing packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: malenkov
*** 1310,1321 ****
// 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 = (ButtonGroup)
! ((DefaultButtonModel)getModel()).getGroup();
if (group != null) {
group.clearSelection();
}
}
}
--- 1310,1320 ----
// 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();
}
}
}
*** 1881,1892 ****
* @return all of the <code>ChangeListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
! return (ChangeListener[])(listenerList.getListeners(
! ChangeListener.class));
}
/**
* Notifies all listeners that have registered interest for
* notification on this event type. The event instance
--- 1880,1890 ----
* @return all of the <code>ChangeListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public ChangeListener[] getChangeListeners() {
! return listenerList.getListeners(ChangeListener.class);
}
/**
* Notifies all listeners that have registered interest for
* notification on this event type. The event instance
*** 1939,1950 ****
* @return all of the <code>ActionListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public ActionListener[] getActionListeners() {
! return (ActionListener[])(listenerList.getListeners(
! ActionListener.class));
}
/**
* Subclasses that want to handle <code>ChangeEvents</code> differently
* can override this to return another <code>ChangeListener</code>
--- 1937,1947 ----
* @return all of the <code>ActionListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public ActionListener[] getActionListeners() {
! return listenerList.getListeners(ActionListener.class);
}
/**
* Subclasses that want to handle <code>ChangeEvents</code> differently
* can override this to return another <code>ChangeListener</code>
*** 2132,2142 ****
* @return all of the <code>ItemListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public ItemListener[] getItemListeners() {
! return (ItemListener[])listenerList.getListeners(ItemListener.class);
}
/**
* Returns an array (length 1) containing the label or
* <code>null</code> if the button is not selected.
--- 2129,2139 ----
* @return all of the <code>ItemListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public ItemListener[] getItemListeners() {
! return listenerList.getListeners(ItemListener.class);
}
/**
* Returns an array (length 1) containing the label or
* <code>null</code> if the button is not selected.
*** 2976,2986 ****
paintViewR.y = paintViewInsets.top;
paintViewR.width = AbstractButton.this.getWidth() - (paintViewInsets.left + paintViewInsets.right);
paintViewR.height = AbstractButton.this.getHeight() - (paintViewInsets.top + paintViewInsets.bottom);
String clippedText = SwingUtilities.layoutCompoundLabel(
! (JComponent)AbstractButton.this,
getFontMetrics(getFont()),
text,
icon,
AbstractButton.this.getVerticalAlignment(),
AbstractButton.this.getHorizontalAlignment(),
--- 2973,2983 ----
paintViewR.y = paintViewInsets.top;
paintViewR.width = AbstractButton.this.getWidth() - (paintViewInsets.left + paintViewInsets.right);
paintViewR.height = AbstractButton.this.getHeight() - (paintViewInsets.top + paintViewInsets.bottom);
String clippedText = SwingUtilities.layoutCompoundLabel(
! AbstractButton.this,
getFontMetrics(getFont()),
text,
icon,
AbstractButton.this.getVerticalAlignment(),
AbstractButton.this.getHorizontalAlignment(),
< prev index next >