Package javax.swing

Examples of javax.swing.ActionMap


    contentPane.add(createParametersPanel(), BorderLayout.CENTER);
    contentPane.add(createButtonsPanel(), BorderLayout.SOUTH);
    setContentPane(contentPane);
   
    final InputMap inputMap = contentPane.getInputMap();
    final ActionMap actionMap = contentPane.getActionMap();

    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "confirm"); // NON-NLS
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NON-NLS
    actionMap.put("confirm", new OkAction()); // NON-NLS
    actionMap.put("cancel", new CancelAction()); // NON-NLS

    setModal(true);
    pack();
    LibSwingUtil.centerDialogInParent(this);
  }
View Full Code Here


    pack();


    final JComponent contentPane = (JComponent) getContentPane();
    final InputMap inputMap = contentPane.getInputMap();
    final ActionMap actionMap = contentPane.getActionMap();

    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NON-NLS
    actionMap.put("cancel", new CloseActionListener()); // NON-NLS

  }
View Full Code Here

    getContentPane().add(createButtons(), c);


    final JComponent contentPane = (JComponent) getContentPane();
    final InputMap inputMap = contentPane.getInputMap();
    final ActionMap actionMap = contentPane.getActionMap();

    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NON-NLS
    actionMap.put("cancel", new IgnoreAction()); // NON-NLS

  }
View Full Code Here

      if( editIdx == -1 ) return;
    }
 
    if( editMarkerPane == null ) {
      final SpringPanel    spring;
      final ActionMap      amap;
      final InputMap      imap;
      JLabel          lb;
      KeyStroke        ks;
      Action          a;

      spring      = new SpringPanel( 4, 2, 4, 2 );
      ggMarkName    = new JTextField( 24 );
//      GUIUtil.setInitialDialogFocus( ggMarkName );  // removes itself automatically
      ggMarkName.addAncestorListener( new AncestorAdapter() {
        public void ancestorAdded( AncestorEvent e ) {
          ggMarkName.requestFocusInWindow();
          ggMarkName.selectAll();
//          c.removeAncestorListener( this );
        }
      });

      // XXX sync
      timeTrans    = new DefaultUnitTranslator();
      ggMarkPos    = new ParamField( timeTrans );
      ggMarkPos.addSpace( ParamSpace.spcTimeHHMMSS );
      ggMarkPos.addSpace( ParamSpace.spcTimeSmps );
      ggMarkPos.addSpace( ParamSpace.spcTimeMillis );
      ggMarkPos.addSpace( ParamSpace.spcTimePercentF );

      lb        = new JLabel( getResourceString( "labelName" ));
//      lb.setLabelFor( ggMarkName );
      spring.gridAdd( lb, 0, 0 );
      spring.gridAdd( ggMarkName, 1, 0 );
      lb        = new JLabel( getResourceString( "labelPosition" ));
//      lb.setLabelFor( ggMarkPos );
      spring.gridAdd( lb, 0, 1 );
      spring.gridAdd( ggMarkPos, 1, 1, -1, 1 );
//      GUIUtil.setDeepFont( spring, null );
      spring.makeCompactGrid();
      editMarkerPane  = new JPanel( new BorderLayout() );
      editMarkerPane.add( spring, BorderLayout.NORTH );
     
      amap      = spring.getActionMap();
      imap      = spring.getInputMap( JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
      ks        = KeyStroke.getKeyStroke( KeyEvent.VK_LEFT, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() );
// XXX DOESN'T WORK ;-(
//      ggMarkName.getInputMap().remove( ks );
      imap.put( ks, "prev" );
      a        = new ActionEditPrev();
//      amap.put( "prev", a );
      ggEditPrev    = new JButton( a );
      amap.put( "prev", new DoClickAction( ggEditPrev ));
      ks        = KeyStroke.getKeyStroke( KeyEvent.VK_RIGHT, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() );
// XXX DOESN'T WORK ;-(
//      ggMarkName.getInputMap().remove( ks );
      imap.put( ks, "next" );
      a        = new ActionEditNext();
//      amap.put( "next", a );
      ggEditNext    = new JButton( a );
      amap.put( "next", new DoClickAction( ggEditNext ));
     
      editOptions    = new Object[] { ggEditNext, ggEditPrev, getResourceString( "buttonOk" ), getResourceString( "buttonCancel" )};
//      editOptions    = new Object[] { ggEditNext, ggEditPrev, JOptionPane.OK_OPTION, JOptionPane.CANCEL_OPTION };
    }
View Full Code Here

        // Close the dialog when Esc is pressed
        String cancelName = "cancel";
        InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), cancelName);
        ActionMap actionMap = getRootPane().getActionMap();
        actionMap.put(cancelName, new AbstractAction() {

            /**
             *
             */
            private static final long serialVersionUID = 1820594207832189538L;
View Full Code Here

    /**
     * Register the actions that this class can handle.
     */
    protected void initActions() {
        ActionMap map = getActionMap();
        map.put(ACTION_FIND, new Actions(ACTION_FIND));
        map.put(ACTION_UNDO, new Actions(ACTION_UNDO));
        map.put(ACTION_REDO, new Actions(ACTION_REDO));
        map.put(ACTION_CUT, new Actions(ACTION_CUT));
        map.put(ACTION_COPY, new Actions(ACTION_COPY));
        map.put(ACTION_PASTE, new Actions(ACTION_PASTE));
       
        KeyStroke findStroke = SearchFactory.getInstance().getSearchAccelerator();
        getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(findStroke, "find");
    }
View Full Code Here

                } catch (CannotRedoException ex) {
                    LOG.info("Could not redo");
                }
                updateActionState();
            } else if (ACTION_CUT.equals(name)) {
                ActionMap map = getActionMap();
                map.remove(ACTION_CUT);
                cut();
                map.put(ACTION_CUT, this);
            } else if (ACTION_COPY.equals(name)) {
                ActionMap map = getActionMap();
                map.remove(ACTION_COPY);
                copy();
                map.put(ACTION_COPY, this);
            } else if (ACTION_PASTE.equals(name)) {
                ActionMap map = getActionMap();
                map.remove(ACTION_PASTE);
                paste();
                map.put(ACTION_PASTE, this);
            }
            else {
                LOG.fine("ActionHandled: " + name);
            }
View Full Code Here

    }

    protected void installKeyboardActions() {
        // install picker's actions
        ActionMap pickerMap = datePicker.getActionMap();
        pickerMap.put(JXDatePicker.CANCEL_KEY, createCancelAction());
        pickerMap.put(JXDatePicker.COMMIT_KEY, createCommitAction());
        pickerMap.put(JXDatePicker.HOME_NAVIGATE_KEY, createHomeAction(false));
        pickerMap.put(JXDatePicker.HOME_COMMIT_KEY, createHomeAction(true));
        TogglePopupAction popupAction = createTogglePopupAction();
        pickerMap.put("TOGGLE_POPUP", popupAction);
       
        InputMap pickerInputMap = datePicker.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        pickerInputMap.put(KeyStroke.getKeyStroke("ENTER"), JXDatePicker.COMMIT_KEY);
        pickerInputMap.put(KeyStroke.getKeyStroke("ESCAPE"), JXDatePicker.CANCEL_KEY);
        // PENDING: get from LF
View Full Code Here

     * PRE: keybindings installed on picker.
     */
    protected void installLinkPanelKeyboardActions() {
        if (datePicker.getLinkPanel() == null)
            return;
        ActionMap map = datePicker.getLinkPanel().getActionMap();
        map.put(JXDatePicker.HOME_COMMIT_KEY, datePicker.getActionMap().get(
                JXDatePicker.HOME_COMMIT_KEY));
        map.put(JXDatePicker.HOME_NAVIGATE_KEY, datePicker.getActionMap().get(
                JXDatePicker.HOME_NAVIGATE_KEY));
        InputMap inputMap = datePicker.getLinkPanel().getInputMap(
                JComponent.WHEN_IN_FOCUSED_WINDOW);
        // PENDING: get from LF
        inputMap.put(KeyStroke.getKeyStroke("F5"),
View Full Code Here

     * @param panel the component to uninstall
     *
     */
    protected void uninstallLinkPanelKeyboardActions(JComponent panel) {
        if (panel == null) return;
        ActionMap map = panel.getActionMap();
        map.remove(JXDatePicker.HOME_COMMIT_KEY);
        map.remove(JXDatePicker.HOME_NAVIGATE_KEY);
        InputMap inputMap = panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
        // PENDING: get from LF
        inputMap.remove(KeyStroke.getKeyStroke("F5"));
        inputMap.remove(KeyStroke.getKeyStroke("shift F5"));
       
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.