Ignore:
Timestamp:
2016-05-11T02:44:10+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:AssignmentInSubExpressionCheck - Assignments should not be made from within sub-expressions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/SideButton.java

    r9705 r10179  
    2222
    2323/**
    24  * Button that is usually used in toggle dialogs
     24 * Button that is usually used in toggle dialogs.
     25 * @since 744
    2526 */
    2627public class SideButton extends JButton implements Destroyable {
     
    2930    private transient PropertyChangeListener propertyChangeListener;
    3031
     32    /**
     33     * Constructs a new {@code SideButton}.
     34     * @param action action used to specify the new button
     35     */
    3136    public SideButton(Action action) {
    3237        super(action);
     
    3540    }
    3641
     42    /**
     43     * Constructs a new {@code SideButton}.
     44     * @param action action used to specify the new button
     45     * @param usename use action name
     46     */
    3747    public SideButton(Action action, boolean usename) {
    3848        super(action);
     
    4454    }
    4555
     56    /**
     57     * Constructs a new {@code SideButton}.
     58     * @param action action used to specify the new button
     59     * @param imagename image name in "dialogs" directory
     60     */
    4661    public SideButton(Action action, String imagename) {
    4762        super(action);
    48         setIcon(makeIcon(imagename));
     63        setIcon(getScaledImage(ImageProvider.get("dialogs", imagename).getImage()));
    4964        doStyle();
    5065    }
     
    5469        // SideButton is constructed get the proper icon size
    5570        if (action != null) {
    56             action.addPropertyChangeListener(propertyChangeListener = new PropertyChangeListener() {
     71            propertyChangeListener = new PropertyChangeListener() {
    5772                @Override
    5873                public void propertyChange(PropertyChangeEvent evt) {
     
    6176                    }
    6277                }
    63             });
     78            };
     79            action.addPropertyChangeListener(propertyChangeListener);
    6480        }
    6581        Icon i = getIcon();
     
    7793        int newWidth = im.getWidth(null) *  iconHeight / im.getHeight(null);
    7894        return new ImageIcon(im.getScaledInstance(newWidth, iconHeight, Image.SCALE_SMOOTH));
    79     }
    80 
    81     public static ImageIcon makeIcon(String imagename) {
    82         Image im = ImageProvider.get("dialogs", imagename).getImage();
    83         return getScaledImage(im);
    8495    }
    8596
Note: See TracChangeset for help on using the changeset viewer.