Package javax.swing

Examples of javax.swing.Action


        myOptionComponents = new JComponent[choiceChangeActions.length];
        Box result = Box.createVerticalBox();
        myExporterToggles = new ButtonGroup();
        for (int i = 0; i < choiceChangeActions.length; i++) {
            final int selectedIndex = i;
            final Action nextRealAction = choiceChangeActions[i];
            Action nextWrapperAction = new AbstractAction(String
                    .valueOf(nextRealAction.getValue(Action.NAME))) {
                public void actionPerformed(ActionEvent e) {
                    nextRealAction.actionPerformed(e);
                    updateSelectionUI(selectedIndex);
                }
View Full Code Here


                        popup = new JPopupMenu(""); //$NON-NLS-1$
                    }
                    popup.setLabel(getTitleAt(getSelectedIndex()));
                    popup.invalidate();
                    popup.removeAll();
                    Action action;
                    for (Enumeration en = actions.elements(); en.hasMoreElements();) {
                        action = (Action) en.nextElement();
                        if (action != null)
                            popup.add(action);
                    }
View Full Code Here

          if (c != this) {
            if (c instanceof ToolBarSeparator) {
              popup.addSeparator();
            } else {
              AbstractButton button = (AbstractButton) c;
              Action appAction = (Action) button.getAction();
              if (appAction != null) {
                popup.add(appAction);
              }
            }
          }
View Full Code Here

        });
        return result;
    }

    private Component createButtonComponent(GPOptionGroup optionGroup) {
        Action action = new AbstractAction(myi18n.getAdvancedActionTitle()) {
            public void actionPerformed(ActionEvent e) {
                System.err
                        .println("[OptionsPageBuilder] createButtonComponent: ");
            }
           
View Full Code Here

        return result;
    }

    private Component createColorComponent(final ColorOption option) {
        final JButton colorButton = new JButton();
        Action action = new AbstractAction(myi18n.getColorButtonText(option)) {
            public void actionPerformed(ActionEvent e) {
                ActionListener onOkPressing = new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        Color color = ourColorChooser.getColor();
                        colorButton.setBackground(color);
View Full Code Here

        final DefaultStringOption servernameOption = (DefaultStringOption) ftpGroup.getOption(DocumentCreator.SERVERNAME_OPTION_ID);
        final DefaultStringOption dirnameOption = (DefaultStringOption) ftpGroup.getOption(DocumentCreator.DIRECTORYNAME_OPTION_ID);
        final DefaultStringOption passwordOption = (DefaultStringOption) ftpGroup.getOption(DocumentCreator.PASSWORD_OPTION_ID);
        final JComponent optionsPane = builder.buildPage(project.getDocumentManager().getNetworkOptionGroups(), getPageID());
        final Action testConnectionAction = new AbstractAction() {
            {
                putValue(Action.NAME, GanttLanguage.getInstance().getText("testFTPConnection"));
                setEnabled(canEnableTestAction(ftpGroup));
            }
            public void actionPerformed(ActionEvent e) {
                StringBuffer urlString = new StringBuffer();
                urlString.append("ftp://");
                urlString.append(usernameOption.getUncommitedValue()==null ? "":usernameOption.getUncommitedValue());
                urlString.append(passwordOption.getUncommitedValue()==null ? "" : ":"+passwordOption.getUncommitedValue());
                urlString.append("@");
                urlString.append(servernameOption.getUncommitedValue());
                urlString.append("/");
                urlString.append(dirnameOption.getUncommitedValue());
                urlString.append("/");
                URL url = null;
                try {
                    url = new URL(urlString.toString() + "test.txt");
                    URLConnection urlc = url.openConnection();
                    OutputStream os = urlc.getOutputStream();
                    os.write(("This is GanttProject +++ I was here!")
                            .getBytes());
                    os.close();
                    JOptionPane.showMessageDialog(optionsPane, GanttLanguage
                            .getInstance().getText("successFTPConnection"),
                            GanttLanguage.getInstance().getText("success"),
                            JOptionPane.INFORMATION_MESSAGE);
                } catch (IOException e2) {
                    uiFacade.showErrorDialog(e2);
//                    JOptionPane.showMessageDialog(, GanttLanguage
//                            .getInstance().getText("errorFTPConnection"),
//                            GanttLanguage.getInstance().getText("error"),
//                            JOptionPane.ERROR_MESSAGE);
                } finally {

                }
            }               
        };
        ChangeValueListener listener = new ChangeValueListener() {
            public void changeValue(ChangeValueEvent event) {
                testConnectionAction.setEnabled(canEnableTestAction(ftpGroup));
            }
        };
        servernameOption.addChangeValueListener(listener);
        usernameOption.addChangeValueListener(listener);
        passwordOption.addChangeValueListener(listener);
View Full Code Here

    public Component getComponent() {
        Action[] choiceChangeActions = new Action[myImporters.length];
        GPOptionGroup[] choiceOptions = new GPOptionGroup[myImporters.length];
        for (int i = 0; i < myImporters.length; i++) {
            final Importer nextImporter = myImporters[i];
            Action nextAction = new AbstractAction(nextImporter
                    .getFileTypeDescription()) {
                public void actionPerformed(ActionEvent e) {
                    ImporterChooserPage.this.myState.myImporter = nextImporter;
                }
            };
View Full Code Here

  }

  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()).intValue());
        final List<FrostDownloadItem> 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

        // /////////////////////////////////////////////////////////////////////////////////////////////////////////
        ScrollingManager scrollingManager = getScrollingManager();
        scrollingManager.addScrollingListener(area.getViewState());
        scrollingManager.addScrollingListener(getResourcePanel().area
                .getViewState());
        Action scrollLeft = new ScrollGanttChartLeftAction(scrollingManager,
                options.getIconSize());
        myRolloverActions.add(scrollLeft);
        bPrev = new TestGanttRolloverButton(scrollLeft);
        bPrev.setAutoRepeatMousePressedEvent(300);
        // toolBar.add(bPrev);

        Action scrollCenter = area.getScrollCenterAction(scrollingManager,
                Mediator.getTaskSelectionManager(), options.getIconSize());
        myRolloverActions.add(scrollCenter);
        bScrollCenter = new TestGanttRolloverButton(scrollCenter);
        bScrollCenter.setAutoRepeatMousePressedEvent(300);
        // toolBar.add(bScrollCenter);

        Action scrollRight = new ScrollGanttChartRightAction(scrollingManager,
                options.getIconSize());
        myRolloverActions.add(scrollRight);
        bNext = new TestGanttRolloverButton(scrollRight);
        bNext.setAutoRepeatMousePressedEvent(300);
        // toolBar.add(bNext);

        // /////////////////////////////////////////////////////////////////////////////////////////////////////////
        Action zoomOut = new ZoomOutAction(getZoomManager(), options
                .getIconSize());
        myRolloverActions.add(zoomOut);
        bZoomOut = new TestGanttRolloverButton(zoomOut);
        // /////////////////////////////////////////////////////////////////////////////////////////////////////////
        Action zoomIn = new ZoomInAction(getZoomManager(), options
                .getIconSize());
        myRolloverActions.add(zoomIn);
        bZoomIn = new TestGanttRolloverButton(zoomIn);
        // toolBar.add(bZoomIn);
        // /////////////////////////////////////////////////////////////////////////////////////////////////////////
        bAbout = new TestGanttRolloverButton(
                new ImageIcon(getClass().getResource(
                        "/icons/manual_" + options.getIconSize() + ".gif")));
        bAbout.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                aboutDialog();
            }
        });
        Action undo = new UndoAction(getUndoManager(), options.getIconSize(), this);
        myRolloverActions.add(undo);
        bUndo = new TestGanttRolloverButton(undo);

        Action redo = new RedoAction(getUndoManager(), options.getIconSize(), this);
        myRolloverActions.add(redo);
        bRedo = new TestGanttRolloverButton(redo);

        Action critic = new CalculateCriticalPathAction(getTaskManager(), tree,
                options, getUIConfiguration(), this);
        myRolloverActions.add(critic);
        bCritical = new TestGanttRolloverButton(critic);
        bRefresh = new TestGanttRolloverButton(new ImageIcon(
                getClass().getResource(
View Full Code Here

    }

    public void showPopupMenu(Component invoker, Action[] actions, int x, int y) {
        JPopupMenu menu = new JPopupMenu();
        for (int i = 0; i < actions.length; i++) {
            Action next = actions[i];
            if (next == null) {
                menu.addSeparator();
            } else {
                menu.add(next);
            }
View Full Code Here

TOP

Related Classes of javax.swing.Action

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.