コード例 #1
0
ファイル: PrefJPanel.java プロジェクト: harrymahar/josm
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   int row1 = shortcutTable.convertRowIndexToModel(row);
   Shortcut sc = (Shortcut) model.getValueAt(row1, -1);
   if (sc == null) return null;
   JLabel label =
       (JLabel)
           super.getTableCellRendererComponent(
               table,
               name ? sc.getLongText() : sc.getKeyText(),
               isSelected,
               hasFocus,
               row,
               column);
   label.setBackground(Main.pref.getUIColor("Table.background"));
   if (isSelected) {
     label.setForeground(Main.pref.getUIColor("Table.foreground"));
   }
   if (sc.getAssignedUser()) {
     label.setBackground(
         Main.pref.getColor(marktr("Shortcut Background: User"), new Color(200, 255, 200)));
   } else if (!sc.getAssignedDefault()) {
     label.setBackground(
         Main.pref.getColor(marktr("Shortcut Background: Modified"), new Color(255, 255, 200)));
   }
   return label;
 }
コード例 #2
0
ファイル: Shortcut.java プロジェクト: uazure/josm
 private static Shortcut reassignShortcut(
     String shortText,
     String longText,
     int requestedKey,
     Shortcut conflict,
     int m,
     int k,
     int newmodifier) {
   Shortcut newsc =
       new Shortcut(shortText, longText, requestedKey, m, k, newmodifier, false, false);
   Main.info(
       tr(
           "Silent shortcut conflict: ''{0}'' moved by ''{1}'' to ''{2}''.",
           shortText, conflict.getShortText(), newsc.getKeyText()));
   newsc.saveDefault();
   shortcuts.put(shortText, newsc);
   return newsc;
 }