Changeset 5070 in josm
- Timestamp:
- 2012-03-11T14:14:31+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/preferences/shortcut
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
r5049 r5070 17 17 import java.util.ArrayList; 18 18 import java.util.LinkedHashMap; 19 import java.util.HashMap;20 19 import java.util.Map; 21 20 … … 27 26 import javax.swing.JCheckBox; 28 27 import javax.swing.JComboBox; 29 import javax.swing.JEditorPane;30 28 import javax.swing.JLabel; 31 29 import javax.swing.JPanel; … … 149 147 } 150 148 151 private staticclass ShortcutTableCellRenderer extends DefaultTableCellRenderer {149 private class ShortcutTableCellRenderer extends DefaultTableCellRenderer { 152 150 153 151 private boolean name; … … 156 154 this.name = name; 157 155 } 158 156 159 157 @Override 160 158 public Component getTableCellRendererComponent(JTable table, Object value, boolean 161 159 isSelected, boolean hasFocus, int row, int column) { 162 if(value instanceof Shortcut) 163 { 164 Shortcut sc = (Shortcut) value; 165 JLabel label = (JLabel) super.getTableCellRendererComponent( 166 table, name ? sc.getLongText() : sc.getKeyText(), isSelected, hasFocus, row, column); 167 label.setBackground(Main.pref.getUIColor("Table.background")); 168 if (isSelected) { 169 label.setForeground(Main.pref.getUIColor("Table.foreground")); 170 } 171 if(sc.getAssignedUser()) { 172 label.setBackground(Main.pref.getColor( 173 marktr("Shortcut Background: User"), 174 new Color(200,255,200))); 175 } else if(!sc.getAssignedDefault()) { 176 label.setBackground(Main.pref.getColor( 177 marktr("Shortcut Background: Modified"), 178 new Color(255,255,200))); 179 } 180 return label; 181 } 182 return null; 183 } 184 } 185 160 int row1 = shortcutTable.convertRowIndexToModel(row); 161 Shortcut sc = (Shortcut)model.getValueAt(row1, -1); 162 if (sc==null) return null; 163 JLabel label = (JLabel) super.getTableCellRendererComponent( 164 table, name ? sc.getLongText() : sc.getKeyText(), isSelected, hasFocus, row, column); 165 label.setBackground(Main.pref.getUIColor("Table.background")); 166 if (isSelected) { 167 label.setForeground(Main.pref.getUIColor("Table.foreground")); 168 } 169 if(sc.getAssignedUser()) { 170 label.setBackground(Main.pref.getColor( 171 marktr("Shortcut Background: User"), 172 new Color(200,255,200))); 173 } else if(!sc.getAssignedDefault()) { 174 label.setBackground(Main.pref.getColor( 175 marktr("Shortcut Background: Modified"), 176 new Color(255,255,200))); 177 } 178 return label; 179 } 180 } 181 186 182 private void initComponents() { 187 183 JPanel listPane = new JPanel(); -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreference.java
r5006 r5070 65 65 } 66 66 public Object getValueAt(int row, int col) { 67 return data.get(row);67 return (col==0)? data.get(row).getLongText() : data.get(row); 68 68 } 69 69 @Override
Note:
See TracChangeset
for help on using the changeset viewer.