Ignore:
Timestamp:
2016-06-19T18:28:26+02:00 (8 years ago)
Author:
stoecker
Message:

see #9995 - patch mainly by strump - improve HIDPI behaviour

File:
1 edited

Legend:

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

    r10395 r10428  
    66import java.awt.BorderLayout;
    77import java.awt.Component;
    8 import java.awt.Image;
    98import java.awt.event.ActionEvent;
    109import java.awt.event.MouseAdapter;
     
    5655 */
    5756public class NotesDialog extends ToggleDialog implements LayerChangeListener {
    58 
    59     /** Small icon size for use in graphics calculations */
    60     public static final int ICON_SMALL_SIZE = 16;
    61     /** 24x24 icon for unresolved notes */
    62     public static final ImageIcon ICON_OPEN = ImageProvider.get("dialogs/notes", "note_open");
    63     /** 16x16 icon for unresolved notes */
    64     public static final ImageIcon ICON_OPEN_SMALL =
    65             new ImageIcon(ICON_OPEN.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));
    66     /** 24x24 icon for resolved notes */
    67     public static final ImageIcon ICON_CLOSED = ImageProvider.get("dialogs/notes", "note_closed");
    68     /** 16x16 icon for resolved notes */
    69     public static final ImageIcon ICON_CLOSED_SMALL =
    70             new ImageIcon(ICON_CLOSED.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));
    71     /** 24x24 icon for new notes */
    72     public static final ImageIcon ICON_NEW = ImageProvider.get("dialogs/notes", "note_new");
    73     /** 16x16 icon for new notes */
    74     public static final ImageIcon ICON_NEW_SMALL =
    75             new ImageIcon(ICON_NEW.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));
    76     /** Icon for note comments */
    77     public static final ImageIcon ICON_COMMENT = ImageProvider.get("dialogs/notes", "note_comment");
    7857
    7958    private NoteTableModel model;
     
    257236                ImageIcon icon;
    258237                if (note.getId() < 0) {
    259                     icon = ICON_NEW_SMALL;
     238                    icon = ImageProvider.get("dialogs/notes", "note_new", ImageProvider.ImageSizes.SMALLICON);
    260239                } else if (note.getState() == State.CLOSED) {
    261                     icon = ICON_CLOSED_SMALL;
     240                    icon = ImageProvider.get("dialogs/notes", "note_closed", ImageProvider.ImageSizes.SMALLICON);
    262241                } else {
    263                     icon = ICON_OPEN_SMALL;
     242                    icon = ImageProvider.get("dialogs/notes", "note_open", ImageProvider.ImageSizes.SMALLICON);
    264243                }
    265244                jlabel.setIcon(icon);
     
    313292            putValue(SHORT_DESCRIPTION, tr("Add comment"));
    314293            putValue(NAME, tr("Comment"));
    315             putValue(SMALL_ICON, ICON_COMMENT);
     294            new ImageProvider("dialogs/notes", "note_comment").getResource().attachImageIcon(this, true);
    316295        }
    317296
     
    327306            }
    328307            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Comment on note"), tr("Add comment"));
    329             dialog.showNoteDialog(tr("Add comment to note:"), NotesDialog.ICON_COMMENT);
     308            dialog.showNoteDialog(tr("Add comment to note:"), ImageProvider.get("dialogs/notes", "note_comment"));
    330309            if (dialog.getValue() != 1) {
    331310                return;
     
    345324            putValue(SHORT_DESCRIPTION, tr("Close note"));
    346325            putValue(NAME, tr("Close"));
    347             putValue(SMALL_ICON, ICON_CLOSED);
     326            new ImageProvider("dialogs/notes", "note_closed").getResource().attachImageIcon(this, true);
    348327        }
    349328
     
    351330        public void actionPerformed(ActionEvent e) {
    352331            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Close note"), tr("Close note"));
    353             dialog.showNoteDialog(tr("Close note with message:"), NotesDialog.ICON_CLOSED);
     332            dialog.showNoteDialog(tr("Close note with message:"), ImageProvider.get("dialogs/notes", "note_closed"));
    354333            if (dialog.getValue() != 1) {
    355334                return;
     
    370349            putValue(SHORT_DESCRIPTION, tr("Create a new note"));
    371350            putValue(NAME, tr("Create"));
    372             putValue(SMALL_ICON, ICON_NEW);
     351            new ImageProvider("dialogs/notes", "note_new").getResource().attachImageIcon(this, true);
    373352        }
    374353
     
    390369            putValue(SHORT_DESCRIPTION, tr("Reopen note"));
    391370            putValue(NAME, tr("Reopen"));
    392             putValue(SMALL_ICON, ICON_OPEN);
     371            new ImageProvider("dialogs/notes", "note_open").getResource().attachImageIcon(this, true);
    393372        }
    394373
     
    396375        public void actionPerformed(ActionEvent e) {
    397376            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Reopen note"), tr("Reopen note"));
    398             dialog.showNoteDialog(tr("Reopen note with message:"), NotesDialog.ICON_OPEN);
     377            dialog.showNoteDialog(tr("Reopen note with message:"), ImageProvider.get("dialogs/notes", "note_open"));
    399378            if (dialog.getValue() != 1) {
    400379                return;
     
    416395            putValue(SHORT_DESCRIPTION, tr("Sort notes"));
    417396            putValue(NAME, tr("Sort"));
    418             putValue(SMALL_ICON, ImageProvider.get("dialogs", "sort"));
     397            new ImageProvider("dialogs", "sort").getResource().attachImageIcon(this, true);
    419398        }
    420399
Note: See TracChangeset for help on using the changeset viewer.