Java 8 ActionMap - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ActionMap class.

This code example shows how to use the following methods:put
				if (button instanceof JButton) {
					 
					InputMap keyMap = new ComponentInputMap(button);
					keyMap.put(def.getAccelerator(), "action");
 
					ActionMap actionMap = new ActionMapUIResource();
					actionMap.put("action", new AbstractAction() {
						@Override 
						public void actionPerformed(ActionEvent e) {
							 
							ActionEvent evt = new ActionEvent(button, ActionEvent.ACTION_PERFORMED, "action");
							 
							//fire event listeners 
							if (button.getActionListeners() != null) {
								for(ActionListener listener : button.getActionListeners()) {
									listener.actionPerformed(evt);
								} 
							} 
							 
							//handle existing defined action 
5
CodeRank
This code example shows how to use the following methods:
            return CHOOSER.getBorder();
        } 
 
        @Override 
        protected ActionMap createActionMap() {
            return new ActionMapUIResource();
        } 
 
        @Override 
        public String getFileName() {
            return this.name;
        } 
 
        @Override 
        public void setFileName(String name) {
            this.name = name;
        } 
    } 
} 
4
CodeRank
This code example shows how to use the following methods:put
                grabFocus();
                setState(getNextState(getState())); 
            } 
        }); 
        // Reset the keyboard action map 
        ActionMap map = new ActionMapUIResource();
        map.put("pressed", new AbstractAction() {
            private static final long serialVersionUID = 7121802319351334948L;
 
            public void actionPerformed(ActionEvent e) {
                grabFocus();
                setState(getNextState(getState())); 
            } 
        }); 
        map.put("released", null);
        SwingUtilities.replaceUIActionMap(this, map);
        // set the model to the adapted model 
        model = new TristateDecorator(getModel());
        setModel(model);
        setState(initial);
5
CodeRank
This code example shows how to use the following methods:put
    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
 
  } 
 
  protected Action getYesAction()
  { 
    return yesAction;
  } 
 
  public boolean isSelectionActive() 
  { 
    return updateList.getSelectedRow() != -1;
  } 
 
  public UpdateInfo[] getUpdates() 
4
CodeRank
This code example shows how to use the following methods:put
		} 
 
		if (constructor != null) {
			ActionMap map = tabPane.getActionMap();
			try { 
				map.put("scrollTabsBackwardAction",
								(Action) constructor.newInstance("scrollTabsBackwardAction"));
				map.put("scrollTabsForwardAction",
								(Action) constructor.newInstance("scrollTabsForwardAction"));
			} catch (InstantiationException e) {
				getLogger().warning("Cannot instantiate action");
			} catch (IllegalAccessException e) {
				getLogger().warning("Action cannot be accessed");
			} catch (InvocationTargetException e) {
				getLogger().warning("Cannot instantiate action");
			} 
		} 
 
		super.installUI(c);
	} 
3
CodeRank
This code example shows how to use the following methods:put
            } 
        }; 
	 
        // Maps the dispose action to the 'Escape' keystroke 
        inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CUSTOM_DISPOSE_EVENT);
        actionMap.put(CUSTOM_DISPOSE_EVENT, disposeAction);
		 
        // Maps the dispose action to the 'Apple+W' keystroke under Mac OS X 
        if(OsFamily.MAC_OS_X.isCurrent()) 
            inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_W, ActionEvent.META_MASK), CUSTOM_DISPOSE_EVENT);
 
        // Under Windows, Alt+F4 automagically disposes the dialog, nothing to do 
    } 
 
    /** 
     * Method called when the user has canceled through the escape key. 
     * <p> 
     * This method is equivalent to a call to {@link #dispose()}. It's meant to be 
     * overriden by those implementations of <code>FocusDialog</code> that need to run 
     * code before canceling the dialog. 
3
CodeRank
This code example shows how to use the following methods:put
        System.out.println("Nifty Disposed");
        super.dispose();  
    } 
    
    /** 
     * This method is called from within the constructor to initialize the form. 
     * WARNING: Do NOT modify this code. The content of this method is always 
     * regenerated by the Form Editor. 
     */ 
    @SuppressWarnings("unchecked") 
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 
    private void initComponents() { 
 
        jMenuItem4 = new javax.swing.JMenuItem();
        jPanel1 = new javax.swing.JPanel();
        jSplitPane1 = new javax.swing.JSplitPane();
        proprietesView2 = new jada.ngeditor.guiviews.ProprietesView();
        jScrollPane1 = new javax.swing.JScrollPane();
        paletteView2 = new jada.ngeditor.guiviews.PaletteView();
        treeGuiView1 = new jada.ngeditor.guiviews.TreeGuiView();
2
CodeRank
This code example shows how to use the following methods:put
       
    public J2DNiftyView(int width , int height) {
        initComponents(); 
        //Init cut&paste 
        ActionMap map = this.getActionMap();
       map.put(TransferHandler.getCopyAction().getValue(javax.swing.Action.NAME),
                TransferHandler.getCopyAction());
         
         
        map.put(TransferHandler.getPasteAction().getValue(javax.swing.Action.NAME),
                TransferHandler.getPasteAction());
        map.put(TransferHandler.getCutAction().getValue(javax.swing.Action.NAME),
                TransferHandler.getCutAction());
 
        this.setPreferredSize(new Dimension(width,height));
        this.graphWrap = new GraphicsWrappImpl(width, height);
        this.setOpaque(true);
        previous=null;
        selecting=false;
        this.selected= new Rectangle();
3
CodeRank
See Code Examples for Java 8 ActionMap Methods: