Package javax.swing

Examples of javax.swing.ActionMap


        viewMenu = newJMenu("menu.view_menu", "View");
        setViewMenu();
        menuBar.add(viewMenu);

        final ActionMap map = mainFrame.getMainFrameTree().getTree().getActionMap();

        JMenu navMenu = newJMenu("menu.navigation", "Navigation");

        addNavItem(map, navMenu, "menu.expand", "Expand", "expand", KeyEvent.VK_RIGHT);
        addNavItem(map, navMenu, "menu.collapse", "Collapse", "collapse", KeyEvent.VK_LEFT);
View Full Code Here


    /**
     * Builds the ActionMap of this canvas with a set of predefined
     * <tt>Action</tt>s.
     */
    protected void installActions() {
        ActionMap actionMap = getActionMap();

        actionMap.put(SCROLL_RIGHT_ACTION, new ScrollRightAction(10));
        actionMap.put(SCROLL_LEFT_ACTION, new ScrollLeftAction(10));
        actionMap.put(SCROLL_UP_ACTION, new ScrollUpAction(10));
        actionMap.put(SCROLL_DOWN_ACTION, new ScrollDownAction(10));

        actionMap.put(FAST_SCROLL_RIGHT_ACTION, new ScrollRightAction(30));
        actionMap.put(FAST_SCROLL_LEFT_ACTION, new ScrollLeftAction(30));
        actionMap.put(FAST_SCROLL_UP_ACTION, new ScrollUpAction(30));
        actionMap.put(FAST_SCROLL_DOWN_ACTION, new ScrollDownAction(30));

        actionMap.put(ZOOM_IN_ACTION, new ZoomInAction());
        actionMap.put(ZOOM_OUT_ACTION, new ZoomOutAction());

        actionMap.put(RESET_TRANSFORM_ACTION, new ResetTransformAction());
    }
View Full Code Here

    /**
     * Builds the ActionMap of this canvas with a set of predefined
     * <tt>Action</tt>s.
     */
    protected void installActions() {
        ActionMap actionMap = getActionMap();

        actionMap.put(SCROLL_RIGHT_ACTION, new ScrollRightAction(10));
        actionMap.put(SCROLL_LEFT_ACTION, new ScrollLeftAction(10));
        actionMap.put(SCROLL_UP_ACTION, new ScrollUpAction(10));
        actionMap.put(SCROLL_DOWN_ACTION, new ScrollDownAction(10));

        actionMap.put(FAST_SCROLL_RIGHT_ACTION, new ScrollRightAction(30));
        actionMap.put(FAST_SCROLL_LEFT_ACTION, new ScrollLeftAction(30));
        actionMap.put(FAST_SCROLL_UP_ACTION, new ScrollUpAction(30));
        actionMap.put(FAST_SCROLL_DOWN_ACTION, new ScrollDownAction(30));

        actionMap.put(ZOOM_IN_ACTION, new ZoomInAction());
        actionMap.put(ZOOM_OUT_ACTION, new ZoomOutAction());

        actionMap.put(RESET_TRANSFORM_ACTION, new ResetTransformAction());
    }
View Full Code Here

* This tests whether keys() and allKeys() return null for new ActionMaps.
*/
public class newMapKeysNull implements Testlet {
 
  public void test(TestHarness harness) {
          ActionMap map = new ActionMap();
          if (map.keys() != null)
            harness.fail("New ActionMap should return null for keys()");
          if (map.allKeys() != null)
            harness.fail ("New ActionMap should return null for allKeys()");
  }
View Full Code Here

public class getActionMap implements Testlet
{
  public void test(TestHarness harness)
  {
    JSplitPane sp = new JSplitPane();
    ActionMap m = sp.getActionMap();
    harness.check(m.keys(), null);
    ActionMap mp = m.getParent();
    harness.check(mp.get("negativeIncrement") != null);
    harness.check(mp.get("positiveIncrement") != null);
    harness.check(mp.get("selectMin") != null);
    harness.check(mp.get("selectMax") != null);
    harness.check(mp.get("startResize") != null);
    harness.check(mp.get("toggleFocus") != null);
    harness.check(mp.get("focusOutForward") != null);
    harness.check(mp.get("focusOutBackward") != null);
  }
View Full Code Here

public class getActionMap implements Testlet
{
  public void test(TestHarness harness)
  {
    JScrollBar sb = new JScrollBar();
    ActionMap m = sb.getActionMap();
    harness.check(m.keys(), null);
    ActionMap mp = m.getParent();
    harness.check(mp.get("positiveUnitIncrement") instanceof Action);
    harness.check(mp.get("positiveBlockIncrement") instanceof Action);
    harness.check(mp.get("negativeUnitIncrement") instanceof Action);
    harness.check(mp.get("negativeBlockIncrement") instanceof Action);
    harness.check(mp.get("minScroll") instanceof Action);
    harness.check(mp.get("maxScroll") instanceof Action);
    harness.check(mp.keys().length, 6);
  }
View Full Code Here

public class replaceUIActionMap implements Testlet
{

  static int howManyMaps (JComponent t)
  {
    ActionMap curr = t.getActionMap();
    int num = 0;
    while (curr != null)
      {
        num ++;
        curr = curr.getParent();
      }
    return num;
  }
View Full Code Here

  public void test(TestHarness harness)
  {
    JTable t = new JTable();
    harness.check(howManyMaps(t) == 2);
   
    ActionMap map1 = SwingUtilities.getUIActionMap(t);
    map1.setParent(new ActionMap());

    harness.check(howManyMaps(t) == 3);

    ActionMapUIResource map2 = new ActionMapUIResource();
    SwingUtilities.replaceUIActionMap(t, map2);
View Full Code Here

public class getActionMap implements Testlet
{
  public void test(TestHarness harness)
  {
    JMenuBar mb = new JMenuBar();
    ActionMap m = mb.getActionMap();
    harness.check(m.keys(), null);
    ActionMap mp = m.getParent();
    //Object[] keys = mp.keys();
    //for (int i = 0; i < keys.length; i++)
    //    System.out.println(keys[i]);
    harness.check(mp.get("takeFocus") instanceof Action);
    harness.check(mp.keys().length, 1);
  }
View Full Code Here

  public void test(TestHarness harness)
  {
    // this is the original version of the test - it shows no actions for
    // a regular label...
    JLabel label = new JLabel("XYZ");
    ActionMap m = label.getActionMap();
    harness.check(m.keys(), null);
    ActionMap mp = m.getParent();
    harness.check(mp, null);
   
    // but then I remembered that when a label has a mnemonic and target
    // component, you can get the focus for the target component via the
    // keyboard
    JLabel label2 = new JLabel("ABC");
    JButton button = new JButton("Target");
    label2.setLabelFor(button);
    label2.setDisplayedMnemonic('A');
   
    m = label2.getActionMap();
    harness.check(m.keys(), null);
    mp = m.getParent();
    harness.check(mp.size(), 2);
    harness.check(mp.get("press") != null);
    harness.check(mp.get("release") != null);
  }
View Full Code Here

TOP

Related Classes of javax.swing.ActionMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.