Ticket #9995: hidpi_patch_2_images_leftovers.patch
File hidpi_patch_2_images_leftovers.patch, 38.4 KB (added by , 8 years ago) |
---|
-
src/org/openstreetmap/josm/actions/AboutAction.java
104 104 // Intermediate panel to allow proper optionPane resizing 105 105 JPanel panel = new JPanel(new GridBagLayout()); 106 106 panel.setPreferredSize(new Dimension(890, 300)); 107 panel.add(new JLabel("", new Image Icon(ImageProvider.get("logo.svg").getImage().getScaledInstance(256, 258, Image.SCALE_SMOOTH)),107 panel.add(new JLabel("", new ImageProvider("logo.svg").setSize(ImageProvider.ImageSizes.ABOUT_LOGO).get(), 108 108 JLabel.CENTER), GBC.std().insets(0, 5, 0, 0)); 109 109 panel.add(about, GBC.std().fill()); 110 110 -
src/org/openstreetmap/josm/actions/AbstractSelectAction.java
19 19 public AbstractSelectAction() { 20 20 putValue(NAME, tr("Select")); 21 21 putValue(SHORT_DESCRIPTION, tr("Set the selected elements on the map to the selected items in the list above.")); 22 new ImageProvider("dialogs", "select").getResource(). getImageIcon(this, true);22 new ImageProvider("dialogs", "select").getResource().attachImageIcon(this, true); 23 23 } 24 24 } -
src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
62 62 GuiHelper.runInEDT(new Runnable() { 63 63 @Override 64 64 public void run() { 65 result. getImageIcon(AddImageryLayerAction.this);65 result.attachImageIcon(AddImageryLayerAction.this); 66 66 } 67 67 }); 68 68 } -
src/org/openstreetmap/josm/actions/JosmAction.java
72 72 String toolbarId, boolean installAdapters) { 73 73 super(name); 74 74 if (icon != null) 75 icon.getResource(). getImageIcon(this);75 icon.getResource().attachImageIcon(this); 76 76 setHelpId(); 77 77 sc = shortcut; 78 78 if (sc != null) { -
src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java
366 366 CancelAction() { 367 367 putValue(Action.SHORT_DESCRIPTION, tr("Cancel conflict resolution")); 368 368 putValue(Action.NAME, tr("Cancel")); 369 new ImageProvider("cancel").getResource(). getImageIcon(this);369 new ImageProvider("cancel").getResource().attachImageIcon(this); 370 370 setEnabled(true); 371 371 } 372 372 … … 381 381 public ApplyAction() { 382 382 putValue(Action.SHORT_DESCRIPTION, tr("Apply resolved conflicts")); 383 383 putValue(Action.NAME, tr("Apply")); 384 new ImageProvider("ok").getResource(). getImageIcon(this);384 new ImageProvider("ok").getResource().attachImageIcon(this); 385 385 updateEnabledState(); 386 386 } 387 387 -
src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
264 264 private CancelAction() { 265 265 putValue(Action.SHORT_DESCRIPTION, tr("Cancel conflict resolution")); 266 266 putValue(Action.NAME, tr("Cancel")); 267 new ImageProvider("cancel").getResource(). getImageIcon(this);267 new ImageProvider("cancel").getResource().attachImageIcon(this); 268 268 setEnabled(true); 269 269 } 270 270 … … 280 280 private ApplyAction() { 281 281 putValue(Action.SHORT_DESCRIPTION, tr("Apply resolved conflicts")); 282 282 putValue(Action.NAME, tr("Apply")); 283 new ImageProvider("ok").getResource(). getImageIcon(this);283 new ImageProvider("ok").getResource().attachImageIcon(this); 284 284 updateEnabledState(); 285 285 } 286 286 -
src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolver.java
154 154 class ApplyRoleAction extends AbstractAction { 155 155 ApplyRoleAction() { 156 156 putValue(NAME, tr("Apply")); 157 new ImageProvider("ok").getResource(). getImageIcon(this);157 new ImageProvider("ok").getResource().attachImageIcon(this); 158 158 putValue(SHORT_DESCRIPTION, tr("Apply this role to all members")); 159 159 } 160 160 -
src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
375 375 public SelectAction() { 376 376 putValue(NAME, tr("Select")); 377 377 putValue(SHORT_DESCRIPTION, tr("Selects the objects that take part in this command (unless currently deleted)")); 378 new ImageProvider("dialogs", "select").getResource(). getImageIcon(this, true);378 new ImageProvider("dialogs", "select").getResource().attachImageIcon(this, true); 379 379 } 380 380 381 381 @Override … … 410 410 putValue(NAME, tr("Select and zoom")); 411 411 putValue(SHORT_DESCRIPTION, 412 412 tr("Selects the objects that take part in this command (unless currently deleted), then and zooms to it")); 413 new ImageProvider("dialogs/autoscale", "selection").getResource(). getImageIcon(this, true);413 new ImageProvider("dialogs/autoscale", "selection").getResource().attachImageIcon(this, true); 414 414 } 415 415 416 416 @Override … … 446 446 tree = undoTree; 447 447 putValue(NAME, tr("Undo")); 448 448 putValue(SHORT_DESCRIPTION, tr("Undo the selected and all later commands")); 449 new ImageProvider("undo").getResource(). getImageIcon(this, true);449 new ImageProvider("undo").getResource().attachImageIcon(this, true); 450 450 } else { 451 451 tree = redoTree; 452 452 putValue(NAME, tr("Redo")); 453 453 putValue(SHORT_DESCRIPTION, tr("Redo the selected and all earlier commands")); 454 new ImageProvider("redo").getResource(). getImageIcon(this, true);454 new ImageProvider("redo").getResource().attachImageIcon(this, true); 455 455 } 456 456 } 457 457 -
src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
433 433 ResolveAction() { 434 434 putValue(NAME, tr("Resolve")); 435 435 putValue(SHORT_DESCRIPTION, tr("Open a merge dialog of all selected items in the list above.")); 436 new ImageProvider("dialogs", "conflict").getResource(). getImageIcon(this, true);436 new ImageProvider("dialogs", "conflict").getResource().attachImageIcon(this, true); 437 437 putValue("help", ht("/Dialog/ConflictList#ResolveAction")); 438 438 } 439 439 -
src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java
157 157 CancelAction() { 158 158 putValue(Action.SHORT_DESCRIPTION, tr("Cancel conflict resolution and close the dialog")); 159 159 putValue(Action.NAME, tr("Cancel")); 160 new ImageProvider("cancel").getResource(). getImageIcon(this);160 new ImageProvider("cancel").getResource().attachImageIcon(this); 161 161 setEnabled(true); 162 162 } 163 163 … … 174 174 HelpAction() { 175 175 putValue(Action.SHORT_DESCRIPTION, tr("Show help information")); 176 176 putValue(Action.NAME, tr("Help")); 177 new ImageProvider("help").getResource(). getImageIcon(this);177 new ImageProvider("help").getResource().attachImageIcon(this); 178 178 setEnabled(true); 179 179 } 180 180 … … 192 192 ApplyResolutionAction() { 193 193 putValue(Action.SHORT_DESCRIPTION, tr("Apply resolved conflicts and close the dialog")); 194 194 putValue(Action.NAME, tr("Apply Resolution")); 195 new ImageProvider("dialogs", "conflict").getResource(). getImageIcon(this);195 new ImageProvider("dialogs", "conflict").getResource().attachImageIcon(this); 196 196 updateEnabledState(); 197 197 } 198 198 -
src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
140 140 { 141 141 putValue(NAME, tr("Add")); 142 142 putValue(SHORT_DESCRIPTION, tr("Add filter.")); 143 new ImageProvider("dialogs", "add").getResource(). getImageIcon(this, true);143 new ImageProvider("dialogs", "add").getResource().attachImageIcon(this, true); 144 144 } 145 145 146 146 @Override … … 155 155 { 156 156 putValue(NAME, tr("Edit")); 157 157 putValue(SHORT_DESCRIPTION, tr("Edit filter.")); 158 new ImageProvider("dialogs", "edit").getResource(). getImageIcon(this, true);158 new ImageProvider("dialogs", "edit").getResource().attachImageIcon(this, true); 159 159 } 160 160 161 161 @Override … … 173 173 { 174 174 putValue(NAME, tr("Delete")); 175 175 putValue(SHORT_DESCRIPTION, tr("Delete filter.")); 176 new ImageProvider("dialogs", "delete").getResource(). getImageIcon(this, true);176 new ImageProvider("dialogs", "delete").getResource().attachImageIcon(this, true); 177 177 } 178 178 179 179 @Override … … 188 188 { 189 189 putValue(NAME, tr("Up")); 190 190 putValue(SHORT_DESCRIPTION, tr("Move filter up.")); 191 new ImageProvider("dialogs", "up").getResource(). getImageIcon(this, true);191 new ImageProvider("dialogs", "up").getResource().attachImageIcon(this, true); 192 192 } 193 193 194 194 @Override … … 204 204 { 205 205 putValue(NAME, tr("Down")); 206 206 putValue(SHORT_DESCRIPTION, tr("Move filter down.")); 207 new ImageProvider("dialogs", "down").getResource(). getImageIcon(this, true);207 new ImageProvider("dialogs", "down").getResource().attachImageIcon(this, true); 208 208 } 209 209 210 210 @Override -
src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
56 56 */ 57 57 public class NotesDialog extends ToggleDialog implements LayerChangeListener { 58 58 59 private static ImageProvider iconOpenImageProvider = new ImageProvider("dialogs/notes", "note_open"); 60 private static ImageProvider iconCloseImageProvider = new ImageProvider("dialogs/notes", "note_closed"); 61 private static ImageProvider iconNewImageProvider = new ImageProvider("dialogs/notes", "note_closed"); 62 59 63 /** Small icon size for use in graphics calculations */ 60 64 public static final int ICON_SMALL_SIZE = 16; 61 65 /** 24x24 icon for unresolved notes */ 62 public static final ImageIcon ICON_OPEN = ImageProvider.get("dialogs/notes", "note_open");66 public static final ImageIcon ICON_OPEN = iconOpenImageProvider.get(); 63 67 /** 16x16 icon for unresolved notes */ 64 68 public static final ImageIcon ICON_OPEN_SMALL = 65 new ImageIcon(ICON_OPEN.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));69 iconOpenImageProvider.setSize(ImageProvider.ImageSizes.SMALLICON).get(); 66 70 /** 24x24 icon for resolved notes */ 67 public static final ImageIcon ICON_CLOSED = ImageProvider.get("dialogs/notes", "note_closed");71 public static final ImageIcon ICON_CLOSED = iconCloseImageProvider.get(); 68 72 /** 16x16 icon for resolved notes */ 69 73 public static final ImageIcon ICON_CLOSED_SMALL = 70 new ImageIcon(ICON_CLOSED.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));74 iconCloseImageProvider.setSize(ImageProvider.ImageSizes.SMALLICON).get(); 71 75 /** 24x24 icon for new notes */ 72 public static final ImageIcon ICON_NEW = ImageProvider.get("dialogs/notes", "note_new");76 public static final ImageIcon ICON_NEW = iconNewImageProvider.get(); 73 77 /** 16x16 icon for new notes */ 74 78 public static final ImageIcon ICON_NEW_SMALL = 75 new ImageIcon(ICON_NEW.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));79 iconNewImageProvider.setSize(ImageProvider.ImageSizes.SMALLICON).get(); 76 80 /** Icon for note comments */ 77 81 public static final ImageIcon ICON_COMMENT = ImageProvider.get("dialogs/notes", "note_comment"); 78 82 … … 88 92 89 93 private transient NoteData noteData; 90 94 95 static { 96 //Free unused fields 97 iconOpenImageProvider = null; 98 iconCloseImageProvider = null; 99 iconNewImageProvider = null; 100 } 101 91 102 /** Creates a new toggle dialog for notes */ 92 103 public NotesDialog() { 93 104 super(tr("Notes"), "notes/note_open", tr("List of notes"), null, 150); -
src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
298 298 SearchAction() { 299 299 putValue(NAME, tr("Search")); 300 300 putValue(SHORT_DESCRIPTION, tr("Search for objects")); 301 new ImageProvider("dialogs", "search").getResource(). getImageIcon(this, true);301 new ImageProvider("dialogs", "search").getResource().attachImageIcon(this, true); 302 302 updateEnabledState(); 303 303 } 304 304 … … 360 360 ShowHistoryAction() { 361 361 putValue(NAME, tr("History")); 362 362 putValue(SHORT_DESCRIPTION, tr("Display the history of the selected objects.")); 363 new ImageProvider("dialogs", "history").getResource(). getImageIcon(this, true);363 new ImageProvider("dialogs", "history").getResource().attachImageIcon(this, true); 364 364 updateEnabledState(model.getSize()); 365 365 } 366 366 … … 400 400 ZoomToJOSMSelectionAction() { 401 401 putValue(NAME, tr("Zoom to selection")); 402 402 putValue(SHORT_DESCRIPTION, tr("Zoom to selection")); 403 new ImageProvider("dialogs/autoscale", "selection").getResource(). getImageIcon(this, true);403 new ImageProvider("dialogs/autoscale", "selection").getResource().attachImageIcon(this, true); 404 404 updateEnabledState(); 405 405 } 406 406 … … 441 441 ZoomToListSelection() { 442 442 putValue(NAME, tr("Zoom to selected element(s)")); 443 443 putValue(SHORT_DESCRIPTION, tr("Zoom to selected element(s)")); 444 new ImageProvider("dialogs/autoscale", "selection").getResource(). getImageIcon(this, true);444 new ImageProvider("dialogs/autoscale", "selection").getResource().attachImageIcon(this, true); 445 445 updateEnabledState(); 446 446 } 447 447 -
src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
157 157 SelectUsersPrimitivesAction() { 158 158 putValue(NAME, tr("Select")); 159 159 putValue(SHORT_DESCRIPTION, tr("Select objects submitted by this user")); 160 new ImageProvider("dialogs", "select").getResource(). getImageIcon(this, true);160 new ImageProvider("dialogs", "select").getResource().attachImageIcon(this, true); 161 161 updateEnabledState(); 162 162 } 163 163 … … 192 192 super(false); 193 193 putValue(NAME, tr("Show info")); 194 194 putValue(SHORT_DESCRIPTION, tr("Launches a browser with information about the user")); 195 new ImageProvider("help/internet").getResource(). getImageIcon(this, true);195 new ImageProvider("help/internet").getResource().attachImageIcon(this, true); 196 196 updateEnabledState(); 197 197 } 198 198 -
src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
119 119 { 120 120 putValue(NAME, tr("Lookup")); 121 121 putValue(SHORT_DESCRIPTION, tr("Looks up the selected primitives in the error list.")); 122 new ImageProvider("dialogs", "search").getResource(). getImageIcon(this, true);122 new ImageProvider("dialogs", "search").getResource().attachImageIcon(this, true); 123 123 } 124 124 125 125 @Override … … 140 140 { 141 141 putValue(NAME, tr("Fix")); 142 142 putValue(SHORT_DESCRIPTION, tr("Fix the selected issue.")); 143 new ImageProvider("dialogs", "fix").getResource(). getImageIcon(this, true);143 new ImageProvider("dialogs", "fix").getResource().attachImageIcon(this, true); 144 144 } 145 145 @Override 146 146 public void actionPerformed(ActionEvent e) { … … 155 155 { 156 156 putValue(NAME, tr("Ignore")); 157 157 putValue(SHORT_DESCRIPTION, tr("Ignore the selected issue next time.")); 158 new ImageProvider("dialogs", "fix").getResource(). getImageIcon(this, true);158 new ImageProvider("dialogs", "fix").getResource().attachImageIcon(this, true); 159 159 } 160 160 @Override 161 161 public void actionPerformed(ActionEvent e) { -
src/org/openstreetmap/josm/gui/help/ContextSensitiveHelpAction.java
46 46 public ContextSensitiveHelpAction(String helpTopic) { 47 47 putValue(SHORT_DESCRIPTION, tr("Show help information")); 48 48 putValue(NAME, tr("Help")); 49 new ImageProvider("help").getResource(). getImageIcon(this);49 new ImageProvider("help").getResource().attachImageIcon(this); 50 50 this.helpTopic = helpTopic; 51 51 setEnabled(!Main.isOffline(OnlineResource.JOSM_WEBSITE)); 52 52 } -
src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
381 381 } 382 382 383 383 final class SaveAndProceedAction extends AbstractAction implements PropertyChangeListener { 384 private static final int ICON_SIZE = 24;385 384 private static final String BASE_ICON = "BASE_ICON"; 386 385 private final transient Image save = ImageProvider.get("save").getImage(); 387 386 private final transient Image upld = ImageProvider.get("upload").getImage(); 388 private final transient Image saveDis = new BufferedImage(ICON_SIZE, ICON_SIZE, BufferedImage.TYPE_4BYTE_ABGR);389 private final transient Image upldDis = new BufferedImage(ICON_SIZE, ICON_SIZE, BufferedImage.TYPE_4BYTE_ABGR);387 private final transient Image saveDis = new ImageProvider("save").getDisabledImage(); 388 private final transient Image upldDis = new ImageProvider("upload").getDisabledImage(); 390 389 391 390 SaveAndProceedAction() { 392 // get disabled versions of icons393 new JLabel(ImageProvider.get("save")).getDisabledIcon().paintIcon(new JPanel(), saveDis.getGraphics(), 0, 0);394 new JLabel(ImageProvider.get("upload")).getDisabledIcon().paintIcon(new JPanel(), upldDis.getGraphics(), 0, 0);395 391 initForSaveAndExit(); 396 392 } 397 393 … … 411 407 412 408 public void redrawIcon() { 413 409 Image base = ((ImageIcon) getValue(BASE_ICON)).getImage(); 414 BufferedImage newIco = new BufferedImage(ICON_SIZE*3, ICON_SIZE, BufferedImage.TYPE_4BYTE_ABGR); 415 Graphics2D g = newIco.createGraphics(); 416 g.drawImage(model.getLayersToUpload().isEmpty() ? upldDis : upld, ICON_SIZE*0, 0, ICON_SIZE, ICON_SIZE, null); 417 g.drawImage(model.getLayersToSave().isEmpty() ? saveDis : save, ICON_SIZE*1, 0, ICON_SIZE, ICON_SIZE, null); 418 g.drawImage(base, ICON_SIZE*2, 0, ICON_SIZE, ICON_SIZE, null); 419 putValue(SMALL_ICON, new ImageIcon(newIco)); 410 //Prepare images 411 Image iconsInRow[] = { 412 model.getLayersToUpload().isEmpty() ? upldDis : upld, 413 model.getLayersToSave().isEmpty() ? saveDis : save, 414 base}; 415 416 //Join them in one image 417 Image newIcon = ImageProvider.joinImages(iconsInRow); 418 putValue(SMALL_ICON, new ImageIcon(newIcon)); 420 419 } 421 420 422 421 @Override -
src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java
258 258 CancelAction() { 259 259 putValue(Action.SHORT_DESCRIPTION, tr("Cancel uploading")); 260 260 putValue(Action.NAME, tr("Cancel")); 261 new ImageProvider("cancel").getResource(). getImageIcon(this);261 new ImageProvider("cancel").getResource().attachImageIcon(this); 262 262 getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) 263 263 .put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); 264 264 getRootPane().getActionMap().put("ESCAPE", this); … … 276 276 ContinueAction() { 277 277 putValue(Action.SHORT_DESCRIPTION, tr("Continue uploading")); 278 278 putValue(Action.NAME, tr("Continue")); 279 new ImageProvider("upload").getResource(). getImageIcon(this);279 new ImageProvider("upload").getResource().attachImageIcon(this); 280 280 updateEnabledState(); 281 281 } 282 282 -
src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java
324 324 class RunAuthorisationAction extends AbstractAction implements DocumentListener { 325 325 RunAuthorisationAction() { 326 326 putValue(NAME, tr("Authorize now")); 327 new ImageProvider("oauth", "oauth-small").getResource(). getImageIcon(this);327 new ImageProvider("oauth", "oauth-small").getResource().attachImageIcon(this); 328 328 putValue(SHORT_DESCRIPTION, tr("Click to redirect you to the authorization form on the JOSM web site")); 329 329 updateEnabledState(); 330 330 } … … 361 361 BackAction() { 362 362 putValue(NAME, tr("Back")); 363 363 putValue(SHORT_DESCRIPTION, tr("Run the automatic authorization steps again")); 364 new ImageProvider("dialogs", "previous").getResource(). getImageIcon(this);364 new ImageProvider("dialogs", "previous").getResource().attachImageIcon(this); 365 365 } 366 366 367 367 @Override … … 376 376 class TestAccessTokenAction extends AbstractAction { 377 377 TestAccessTokenAction() { 378 378 putValue(NAME, tr("Test Access Token")); 379 new ImageProvider("logo").getResource(). getImageIcon(this);379 new ImageProvider("logo").getResource().attachImageIcon(this); 380 380 } 381 381 382 382 @Override -
src/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java
222 222 class TestAccessTokenAction extends AbstractAction implements PropertyChangeListener { 223 223 TestAccessTokenAction() { 224 224 putValue(NAME, tr("Test Access Token")); 225 new ImageProvider("oauth", "oauth-small").getResource(). getImageIcon(this);225 new ImageProvider("oauth", "oauth-small").getResource().attachImageIcon(this); 226 226 putValue(SHORT_DESCRIPTION, tr("Click to test the Access Token")); 227 227 updateEnabledState(); 228 228 } -
src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java
350 350 */ 351 351 CancelAction() { 352 352 putValue(NAME, tr("Cancel")); 353 new ImageProvider("cancel").getResource(). getImageIcon(this);353 new ImageProvider("cancel").getResource().attachImageIcon(this); 354 354 putValue(SHORT_DESCRIPTION, tr("Close the dialog and cancel authorization")); 355 355 } 356 356 … … 372 372 */ 373 373 AcceptAccessTokenAction() { 374 374 putValue(NAME, tr("Accept Access Token")); 375 new ImageProvider("ok").getResource(). getImageIcon(this);375 new ImageProvider("ok").getResource().attachImageIcon(this); 376 376 putValue(SHORT_DESCRIPTION, tr("Close the dialog and accept the Access Token")); 377 377 updateEnabledState(null); 378 378 } -
src/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUI.java
291 291 BackAction() { 292 292 putValue(NAME, tr("Back")); 293 293 putValue(SHORT_DESCRIPTION, tr("Go back to step 1/3")); 294 new ImageProvider("dialogs", "previous").getResource(). getImageIcon(this);294 new ImageProvider("dialogs", "previous").getResource().attachImageIcon(this); 295 295 } 296 296 297 297 @Override … … 367 367 RestartAction() { 368 368 putValue(NAME, tr("Restart")); 369 369 putValue(SHORT_DESCRIPTION, tr("Go back to step 1/3")); 370 new ImageProvider("dialogs", "previous").getResource(). getImageIcon(this);370 new ImageProvider("dialogs", "previous").getResource().attachImageIcon(this); 371 371 } 372 372 373 373 @Override … … 388 388 389 389 RetrieveRequestTokenAction() { 390 390 putValue(NAME, tr("Retrieve Request Token")); 391 new ImageProvider("oauth", "oauth-small").getResource(). getImageIcon(this);391 new ImageProvider("oauth", "oauth-small").getResource().attachImageIcon(this); 392 392 putValue(SHORT_DESCRIPTION, tr("Click to retrieve a Request Token")); 393 393 } 394 394 … … 424 424 425 425 RetrieveAccessTokenAction() { 426 426 putValue(NAME, tr("Retrieve Access Token")); 427 new ImageProvider("oauth", "oauth-small").getResource(). getImageIcon(this);427 new ImageProvider("oauth", "oauth-small").getResource().attachImageIcon(this); 428 428 putValue(SHORT_DESCRIPTION, tr("Click to retrieve an Access Token")); 429 429 } 430 430 … … 461 461 462 462 TestAccessTokenAction() { 463 463 putValue(NAME, tr("Test Access Token")); 464 new ImageProvider("oauth", "oauth-small").getResource(). getImageIcon(this);464 new ImageProvider("oauth", "oauth-small").getResource().attachImageIcon(this); 465 465 putValue(SHORT_DESCRIPTION, tr("Click to test the Access Token")); 466 466 } 467 467 -
src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
156 156 class CancelAction extends AbstractAction { 157 157 CancelAction() { 158 158 putValue(NAME, tr("Cancel")); 159 new ImageProvider("cancel").getResource(). getImageIcon(this);159 new ImageProvider("cancel").getResource().attachImageIcon(this); 160 160 putValue(SHORT_DESCRIPTION, tr("Close the preferences dialog and discard preference updates")); 161 161 } 162 162 … … 175 175 class OKAction extends AbstractAction { 176 176 OKAction() { 177 177 putValue(NAME, tr("OK")); 178 new ImageProvider("ok").getResource(). getImageIcon(this);178 new ImageProvider("ok").getResource().attachImageIcon(this); 179 179 putValue(SHORT_DESCRIPTION, tr("Save the preferences and close the dialog")); 180 180 } 181 181 -
src/org/openstreetmap/josm/gui/tagging/TagTable.java
163 163 class DeleteAction extends AbstractAction implements ListSelectionListener { 164 164 165 165 DeleteAction() { 166 new ImageProvider("dialogs", "delete").getResource(). getImageIcon(this);166 new ImageProvider("dialogs", "delete").getResource().attachImageIcon(this); 167 167 putValue(SHORT_DESCRIPTION, tr("Delete the selection in the tag table")); 168 168 getSelectionModel().addListSelectionListener(this); 169 169 getColumnModel().getSelectionModel().addListSelectionListener(this); … … 252 252 */ 253 253 class AddAction extends AbstractAction implements PropertyChangeListener { 254 254 AddAction() { 255 new ImageProvider("dialogs", "add").getResource(). getImageIcon(this);255 new ImageProvider("dialogs", "add").getResource().attachImageIcon(this); 256 256 putValue(SHORT_DESCRIPTION, tr("Add a new tag")); 257 257 TagTable.this.addPropertyChangeListener(this); 258 258 updateEnabledState(); … … 286 286 */ 287 287 class PasteAction extends AbstractAction implements PropertyChangeListener { 288 288 PasteAction() { 289 new ImageProvider("pastetags").getResource(). getImageIcon(this);289 new ImageProvider("pastetags").getResource().attachImageIcon(this); 290 290 putValue(SHORT_DESCRIPTION, tr("Paste tags from buffer")); 291 291 TagTable.this.addPropertyChangeListener(this); 292 292 updateEnabledState(); -
src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
191 191 GuiHelper.runInEDT(new Runnable() { 192 192 @Override 193 193 public void run() { 194 result. getImageIcon(TaggingPreset.this);194 result.attachImageIcon(TaggingPreset.this); 195 195 } 196 196 }); 197 197 } else { -
src/org/openstreetmap/josm/io/session/GenericSessionExporter.java
73 73 * Constructs a new {@code LayerSaveAction}. 74 74 */ 75 75 LayerSaveAction() { 76 putValue(SMALL_ICON, new ImageProvider("save").set Width(16).get());76 putValue(SMALL_ICON, new ImageProvider("save").setSize(ImageProvider.ImageSizes.SMALLICON).get()); 77 77 putValue(SHORT_DESCRIPTION, ((AbstractModifiableLayer) layer).requiresSaveToFile() ? 78 78 tr("Layer contains unsaved data - save to file.") : 79 79 tr("Layer does not contain unsaved data.")); -
src/org/openstreetmap/josm/tools/ImageProvider.java
53 53 import javax.imageio.ImageReader; 54 54 import javax.imageio.metadata.IIOMetadata; 55 55 import javax.imageio.stream.ImageInputStream; 56 import javax.swing.Icon; 56 57 import javax.swing.ImageIcon; 58 import javax.swing.JPanel; 59 import javax.swing.UIManager; 57 60 import javax.xml.bind.DatatypeConverter; 58 61 59 62 import org.openstreetmap.josm.Main; … … 692 695 } 693 696 694 697 /** 698 * Get disabled (grayed out) icon. 699 * 700 * This method gets standard icon and uses default Swing functionality 701 * to make it look disabled by applying grayscaling filter. 702 * 703 * @return Icon in disabled state 704 * @since ??? 705 */ 706 public Icon getDisabledIcon() { 707 return UIManager.getLookAndFeel().getDisabledIcon(null, get()); 708 } 709 710 /** 711 * Get disabled (grayed out) image. 712 * 713 * This method does the same as #getDisabledIcon() 714 * but returns instance of Image instead of Icon. 715 * 716 * @return Image in disabled state 717 * @since ??? 718 */ 719 public Image getDisabledImage() { 720 Icon disabledIcon = getDisabledIcon(); 721 //Convert Icon to Image 722 if (disabledIcon instanceof ImageIcon) { 723 return ((ImageIcon) disabledIcon).getImage(); 724 } else { 725 Image disabledImage = new BufferedImage(disabledIcon.getIconWidth(), disabledIcon.getIconHeight(), BufferedImage.TYPE_4BYTE_ABGR); 726 disabledIcon.paintIcon(new JPanel(), disabledImage.getGraphics(), 0, 0); 727 return disabledImage; 728 } 729 } 730 731 732 /** 695 733 * Load an image with a given file name. 696 734 * 697 735 * @param subdir subdirectory the image lies in … … 1873 1911 IMAGE_FETCHER.shutdown(); 1874 1912 } 1875 1913 } 1914 1915 /** 1916 * Join multiple images in one row. 1917 * 1918 * Generates new image where all "images" are layouted side by side. 1919 * 1920 * @param images array of images to be joined 1921 * @return new Image with all images in a row 1922 * @see SaveAndProceedAction.redrawIcon() 1923 */ 1924 public static Image joinImages(Image[] images) { 1925 int targetWidth = 0; 1926 int targetHeight = 0; 1927 1928 //Calculate cumulative width and max height 1929 for (Image img : images) { 1930 targetWidth += img.getWidth(null); 1931 targetHeight = Math.max(targetHeight, img.getHeight(null)); 1932 } 1933 1934 BufferedImage newIco = new BufferedImage(targetWidth, targetHeight, BufferedImage.TYPE_4BYTE_ABGR); 1935 Graphics2D g = newIco.createGraphics(); 1936 1937 //Draw all images in row 1938 int x = 0; 1939 for (Image img : images) { 1940 int curWidth = img.getWidth(null); 1941 int curHeight = img.getHeight(null); 1942 g.drawImage(img, x, 0, curWidth, curHeight, null); 1943 x += curWidth; 1944 } 1945 1946 return newIco; 1947 } 1876 1948 } -
src/org/openstreetmap/josm/tools/ImageResource.java
109 109 * @param a The action for the icons 110 110 * @since 7693 111 111 */ 112 public void getImageIcon(AbstractAction a) {112 public void attachImageIcon(AbstractAction a) { 113 113 Dimension iconDimension = ImageProvider.ImageSizes.SMALLICON.getImageDimension(); 114 114 ImageIcon icon = getImageIconBounded(iconDimension); 115 115 a.putValue(Action.SMALL_ICON, icon); … … 126 126 * @param addresource Adds an resource named "ImageResource" if <code>true</code> 127 127 * @since 10356 128 128 */ 129 public void getImageIcon(AbstractAction a, boolean addresource) {130 getImageIcon(a);129 public void attachImageIcon(AbstractAction a, boolean addresource) { 130 attachImageIcon(a); 131 131 if (addresource) { 132 132 a.putValue("ImageResource", this); 133 133 }