Changeset 5484 in josm for trunk/src/org
- Timestamp:
- 2012-08-30T22:38:56+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r5481 r5484 114 114 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem; 115 115 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 116 import org.openstreetmap.josm.gui.util.GuiHelper; 116 117 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 117 118 import org.openstreetmap.josm.tools.GBC; … … 529 530 if (itemToSelect != null) { 530 531 keys.setSelectedItem(itemToSelect); 531 /* don't add single chars, as they are no properly selected */ 532 if(lastAddValue != null && lastAddValue.length() > 1) { 532 if (lastAddValue != null) { 533 533 values.setSelectedItem(lastAddValue); 534 534 } … … 593 593 for (int i = tags.size()-1; i >= 0 && count <= tagsToShow; i--, count++) { 594 594 final Tag t = tags.get(i); 595 // Find and display icon596 ImageIcon icon = MapPaintStyles.getNodeIcon(t, false); // Filters deprecated icon597 if (icon == null) {598 icon = new ImageIcon(new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB));599 }600 GridBagConstraints gbc = new GridBagConstraints();601 gbc.ipadx = 5;602 p.add(new JLabel(icon), gbc);603 595 // Create action for reusing the tag, with keyboard shortcut Ctrl+(1-5) 604 596 String actionShortcutKey = "properties:recent:"+count; … … 622 614 } 623 615 } 616 // Find and display icon 617 ImageIcon icon = MapPaintStyles.getNodeIcon(t, false); // Filters deprecated icon 618 if (icon == null) { 619 icon = new ImageIcon(new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB)); 620 } 621 GridBagConstraints gbc = new GridBagConstraints(); 622 gbc.ipadx = 5; 623 p.add(new JLabel(action.isEnabled() ? icon : GuiHelper.getDisabledIcon(icon)), gbc); 624 624 // Create tag label 625 final String color = action.isEnabled() ? "" : "; color:gray"; 625 626 final JLabel tagLabel = new JLabel("<html>" 626 + "<style>td{border:1px solid gray; font-weight:normal ;}</style>"627 + "<style>td{border:1px solid gray; font-weight:normal"+color+"}</style>" 627 628 + "<table><tr><td>" + t.toString() + "</td></tr></table></html>"); 628 629 if (action.isEnabled()) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapImage.java
r5470 r5484 6 6 import java.awt.Image; 7 7 import java.awt.Rectangle; 8 import java.awt.Toolkit;9 8 import java.awt.image.BufferedImage; 10 import java.awt.image.FilteredImageSource;11 import java.awt.image.ImageProducer;12 9 13 import javax.swing.GrayFilter;14 10 import javax.swing.ImageIcon; 15 11 … … 17 13 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.BoxProvider; 18 14 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.BoxProviderResult; 15 import org.openstreetmap.josm.gui.util.GuiHelper; 19 16 import org.openstreetmap.josm.tools.ImageProvider; 20 17 import org.openstreetmap.josm.tools.ImageProvider.ImageCallback; … … 49 46 if (img == null) 50 47 getImage(); // fix #7498 ? 51 ImageProducer ip = new FilteredImageSource(img.getSource(), new GrayFilter(true, 20)); 52 disabledImg = Toolkit.getDefaultToolkit().createImage(ip); 48 disabledImg = GuiHelper.getDisabledImage(img); 53 49 return disabledImg; 54 50 } -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r5297 r5484 7 7 import java.awt.Container; 8 8 import java.awt.Image; 9 import java.awt.Toolkit; 10 import java.awt.image.FilteredImageSource; 9 11 import java.lang.reflect.InvocationTargetException; 10 12 13 import javax.swing.GrayFilter; 11 14 import javax.swing.Icon; 12 15 import javax.swing.ImageIcon; … … 80 83 return dlg.showDialog().getValue() != 2; 81 84 } 85 86 /** 87 * Replies the disabled (grayed) version of the specified image. 88 * @param image The image to disable 89 * @return The disabled (grayed) version of the specified image, brightened by 20%. 90 * @since 5484 91 */ 92 public static final Image getDisabledImage(Image image) { 93 return Toolkit.getDefaultToolkit().createImage( 94 new FilteredImageSource(image.getSource(), new GrayFilter(true, 20))); 95 } 82 96 97 /** 98 * Replies the disabled (grayed) version of the specified icon. 99 * @param icon The icon to disable 100 * @return The disabled (grayed) version of the specified icon, brightened by 20%. 101 * @since 5484 102 */ 103 public static final ImageIcon getDisabledIcon(ImageIcon icon) { 104 return new ImageIcon(getDisabledImage(icon.getImage())); 105 } 83 106 }
Note:
See TracChangeset
for help on using the changeset viewer.