Exemple #1
0
 @SuppressWarnings({"HardCodedStringLiteral"})
 public static void installActions(final JTree tree) {
   tree.getActionMap()
       .put(
           "scrollUpChangeSelection",
           new AbstractAction() {
             public void actionPerformed(final ActionEvent e) {
               movePageUp(tree);
             }
           });
   tree.getActionMap()
       .put(
           "scrollDownChangeSelection",
           new AbstractAction() {
             public void actionPerformed(final ActionEvent e) {
               movePageDown(tree);
             }
           });
   tree.getActionMap()
       .put(
           "selectPrevious",
           new AbstractAction() {
             public void actionPerformed(final ActionEvent e) {
               moveUp(tree);
             }
           });
   tree.getActionMap()
       .put(
           "selectNext",
           new AbstractAction() {
             public void actionPerformed(final ActionEvent e) {
               moveDown(tree);
             }
           });
   copyAction(tree, "selectLast", "selectLastChangeLead");
   copyAction(tree, "selectFirst", "selectFirstChangeLead");
 }
Exemple #2
0
 private static void copyAction(final JTree tree, String original, String copyTo) {
   final Action action = tree.getActionMap().get(original);
   if (action != null) {
     tree.getActionMap().put(copyTo, action);
   }
 }