Package javax.swing

Examples of javax.swing.AbstractAction


    }

    private void assignHotkeys() {

      // assign keys 1-6 - set priority of selected items
      final Action setPriorityAction = new AbstractAction() {
        public void actionPerformed(final ActionEvent event) {
          final FreenetPriority prio = FreenetPriority.getPriority( new Integer(event.getActionCommand()));
          final List<FrostUploadItem> selectedItems = modelTable.getSelectedItems();
          changeItemPriorites(selectedItems, prio);
        }
      };
      getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_1, 0), "SETPRIO");
      getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_2, 0), "SETPRIO");
      getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_3, 0), "SETPRIO");
      getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_4, 0), "SETPRIO");
      getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_5, 0), "SETPRIO");
      getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_6, 0), "SETPRIO");
      getActionMap().put("SETPRIO", setPriorityAction);

      // Enter
      final Action setOpenFileAction = new AbstractAction() {
        public void actionPerformed(final ActionEvent event) {
          openFile(modelTable.getSelectedItem());
        }
      };
      getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),"OpenFile");
View Full Code Here


     * @return Vector of Actions
     */
    protected Vector getActions() {
        Vector actions = new Vector();

        actions.add(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                saveOMGraphics();
            }

            public String toString() {
                return i18n.get(DrawingToolLayer.class, "SAVE_MAP", "Save map");
            }
        });
        actions.add(new AbstractAction() {

            public void actionPerformed(ActionEvent e) {
                OMGraphicList list = getList();
                if (list != null && list.size() > 0) {
                    EsriShapeExport ese = new EsriShapeExport(list, getProjection(), null);
                    ese.export();
                } else {
                    String message = i18n.get(DrawingToolLayer.class,
                            "SHAPE_ERROR_MESSAGE",
                            "There's nothing on the map for this layer to save.");
                    fireRequestMessage(message);
                }
            }

            public String toString() {
                return i18n.get(DrawingToolLayer.class,
                        "SHAPE_SAVE_MAP",
                        "Save map as Shape file(s)");
            }
        });
        actions.add(new AbstractAction() {

            public void actionPerformed(ActionEvent e) {
                setList(load());
                doPrepare();
            }

            public String toString() {
                return i18n.get(DrawingToolLayer.class,
                        "RELOAD",
                        "Re-load map from file");
            }
        });
        actions.add(new AbstractAction() {

            public void actionPerformed(ActionEvent e) {
                Inspector inspector = new Inspector();
                inspector.inspectPropertyConsumer(DrawingToolLayer.this);
            }
View Full Code Here

                    getGroupSelector().showMatchingGroups(null, true);
            }
        };
        mainTable.addSelectionListener(groupsHighlightListener);

        mainTable.getActionMap().put("cut", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    try { runCommand("cut");
                    } catch (Throwable ex) {
                        ex.printStackTrace();
                    }
                }
            });
        mainTable.getActionMap().put("copy", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    try { runCommand("copy");
                    } catch (Throwable ex) {
                        ex.printStackTrace();
                    }
                }
            });
        mainTable.getActionMap().put("paste", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    try { runCommand("paste");
                    } catch (Throwable ex) {
                        ex.printStackTrace();
                    }
View Full Code Here

            JSynoptic.gui.addEditMenu(popup);
        }
        if(getElementContainer().getSelection().isEmpty()){
          // no selection add background color menu
          popup.addSeparator();
          popup.add(new JMenuItem(new AbstractAction(
              resources.getStringValue("backgroundColorAction")) {
            public void actionPerformed(ActionEvent e) {
              Color c=showColorDialog(ShapesContainer.this._diagParam.backgr);
              if(c!=null){
                ShapesContainer.this._diagParam.backgr=c;
View Full Code Here

            }
        }
    }

    protected void createActions() {
        aCut = new AbstractAction(resources.getStringValue("cutAction"), resources.getIcon("cutImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.executeSelectionCut();
                }
            }
        };
        aCopy = new AbstractAction(resources.getStringValue("copyAction"), resources.getIcon("copyImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.executeSelectionCopy();
                }
            }
        };
        aPaste = new AbstractAction(resources.getStringValue("pasteAction"), resources.getIcon("pasteImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.executeClipboardPaste();
                }
            }
        };
        aGroup = new AbstractAction(resources.getStringValue("groupAction"), resources.getIcon("groupImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if ((d != null) && (d instanceof ShapesComponent)) {
                    ((ShapesComponent) d).group();
                }
            }
        };
        aUngroup = new AbstractAction(resources.getStringValue("ungroupAction"), resources.getIcon("ungroupImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if ((d != null) && (d instanceof ShapesComponent)) {
                    ((ShapesComponent) d).unGroup();
                }
            }
        };
        aRegroup = new AbstractAction(resources.getStringValue("regroupAction"), resources.getIcon("regroupImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if ((d != null) && (d instanceof ShapesComponent)) {
                    ((ShapesComponent) d).reGroup();
                }
            }
        };
        aRemove = new AbstractAction(resources.getStringValue("removeAction")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.executeSelectionDelete();
                }
            }
        };
        aSelectAll = new AbstractAction(resources.getStringValue("selectAllAction"), null) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.executeSelectAll();
                }
            }
        };
        aSelectAll.setEnabled(isEditable);

        aFullScreen = new AbstractAction(resources.getStringValue("fullScreen")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                // Toggle full screen on / off
                if (d.isFullScreen()) {
                    d.setFullScreen(false);
                } else {
                    d.setFullScreen(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
                }
            }
        };
        aFullScreen.putValue(Action.ACCELERATOR_KEY, resources.getKeyStroke("fullScreenShortcut"));
        aFront = new AbstractAction(resources.getStringValue("frontAction"), resources.getIcon("frontImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().bringSelectionToFront();
                }
            }
        };
        aForward = new AbstractAction(resources.getStringValue("forwardAction"), resources.getIcon("forwardImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().bringSelectionForward();
                }
            }
        };
        aBackward = new AbstractAction(resources.getStringValue("backwardAction"), resources.getIcon("backwardImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().sendSelectionBackward();
                }
            }
        };
        aBack = new AbstractAction(resources.getStringValue("backAction"), resources.getIcon("backImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().sendSelectionToBack();
                }
            }
        };
        aLeft = new AbstractAction(resources.getStringValue("leftAction"), resources.getIcon("leftImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionToLeft();
                }
            }
        };
        aRight = new AbstractAction(resources.getStringValue("rightAction"), resources.getIcon("rightImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionToRight();
                }
            }
        };
        aTop = new AbstractAction(resources.getStringValue("topAction"), resources.getIcon("topImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionToTop();
                }
            }
        };
        aBottom = new AbstractAction(resources.getStringValue("bottomAction"), resources.getIcon("bottomImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionToBottom();
                }
            }
        };
        aVCenter = new AbstractAction(resources.getStringValue("vCenterAction"), resources.getIcon("vCenterImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionVCenter();
                }
            }
        };
        aHCenter = new AbstractAction(resources.getStringValue("hCenterAction"), resources.getIcon("hCenterImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionHCenter();
                }
            }
        };
        dHorizontally = new AbstractAction(resources.getStringValue("dHorizontallyAction"), resources
                .getIcon("dHorizontallyImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().distributeSelectionHorizontally();
                }
            }
        };
        dVertically = new AbstractAction(resources.getStringValue("dVerticallyAction"), resources
                .getIcon("dVerticallyImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().distributeSelectionVertically();
                }
            }
        };

        aZoomIn = new AbstractAction(resources.getStringValue("zoomInAction"),
                resources.getIcon("zoomInImage")) {
            public void actionPerformed(ActionEvent e) {
                zoomDiagram(true);
            }
        };

        aZoomOut = new AbstractAction(resources.getStringValue("zoomOutAction"),
                resources.getIcon("zoomOutImage")) {
            public void actionPerformed(ActionEvent e) {
                zoomDiagram(false);
            }
        };
View Full Code Here

    }

    protected void setRecentFilesMenu() {
        miRecentFiles.removeAll();
        for (int i = 0; i < recentOpenedFiles.size(); i++) {
            AbstractAction action = new AbstractAction(((File) recentOpenedFiles.get(i)).getName()) {
                public void actionPerformed(ActionEvent e) {
                    JSynopticPanels.this.open((File) getValue((String) getValue(Action.NAME)));
                }
            };
            action.putValue(((File) recentOpenedFiles.get(i)).getName(), recentOpenedFiles.get(i));
            miRecentFiles.add(new JMenuItem(action));
        }
        miRecentFiles.setEnabled(recentOpenedFiles.size() != 0);
    }
View Full Code Here

    }
    // Key bindings:
    ActionMap am = statusPanel.getActionMap() ;
    InputMap im = statusPanel.getInputMap( JComponent.WHEN_IN_FOCUSED_WINDOW ) ;
    im.put( parent.prefs().getKey( "Close dialog" ), "close" ) ;
    am.put( "close", new AbstractAction()
    {
      public void actionPerformed( ActionEvent e )
      {
        dispose() ;
      }
View Full Code Here

    });
    btnsPnl.add(closeBtn);
    contentPane.add(btnsPnl, BorderLayout.SOUTH);


      AbstractAction closeAction = new AbstractAction()
      {
        private static final long serialVersionUID = 1L;

        public void actionPerformed(ActionEvent actionEvent)
         {
View Full Code Here

         }
      });
      btnsPnl.add(closeBtn);
      contentPane.add(btnsPnl, BorderLayout.SOUTH);

      AbstractAction closeAction = new AbstractAction() {
         private static final long serialVersionUID = 1L;

         public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
            dispose();
View Full Code Here

                }
            });

        //if the press enter, send the message
        Action sendMessageAction =
            new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    sendHandler(null);
                }
            };

        Action shiftEnterAction =
            new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    int pos = textEntryArea.getCaretPosition();
                    if (pos < 0) {
                        pos = 0;
                    }

                    textEntryArea.insert("\n", pos);

                    try {
                        textEntryArea.setCaretPosition(pos + 1);
                    } catch (IllegalArgumentException ex) {
                    }
                }
            };

        Action checkCloseAction =
            new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    checkCloseHandler();
                }
            };

        Action closeAction =
            new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    closeHandler();
                }
            };
View Full Code Here

TOP

Related Classes of javax.swing.AbstractAction

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.