Package javax.swing

Examples of javax.swing.AbstractAction


    b.add(getMessageLabel(), cc.xy(12, 1));

    /*
     * Close action for the SearchPanel.
     */
    Action close = new AbstractAction() {
      private static final long serialVersionUID = 1L;

      public void actionPerformed(ActionEvent e) {
        mSearchBar.setVisible(false);
        setBlockAutoClosing(false);
View Full Code Here


   *
   * @param component
   *          The component to close on pressing escape key.
   */
  public static void registerForClosing(final WindowClosingIf component) {
    Action a = new AbstractAction() {
      private static final long serialVersionUID = 1L;

      public void actionPerformed(ActionEvent e) {
        component.close();
      }
    };

    if (OperatingSystem.isMacOs()) {
      // Add MacOS Apple+W for Closing of Dialogs
      KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_W,
          InputEvent.META_DOWN_MASK);
      component.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
          .put(stroke, "CLOSE_ON_APPLE_W");
      component.getRootPane().getActionMap().put("CLOSE_ON_APPLE_W", a);

      stroke = KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.META_DOWN_MASK);
      component.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
          .put(stroke, "CLOSE_COMPLETE_ON_APPLE");
      component.getRootPane().getActionMap().put("CLOSE_COMPLETE_ON_APPLE",
          new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              MainFrame.getInstance().quit();
            }
          });
    }
View Full Code Here

      final ReminderListItem item = mReminderList.getReminderItem(program);
      String[] entries = ReminderFrame.REMIND_MSG_ARR;

      ArrayList<ActionMenu> actions = new ArrayList<ActionMenu>(maxIndex + 2);

      actions.add(new ActionMenu(new AbstractAction(entries[0]) {
        public void actionPerformed(ActionEvent e) {
          mReminderList.removeWithoutChecking(program);
          updateRootNode(true);
        }
      }));
      actions.add(new ActionMenu(ContextMenuSeparatorAction.getInstance()));

      for (int i = 1; i <= maxIndex; i++) {
        final int minutes = ReminderFrame.REMIND_VALUE_ARR[i];
        actions.add(new ActionMenu(new AbstractAction(entries[i]) {
          public void actionPerformed(ActionEvent e) {
            item.setMinutes(minutes);
          }
        }, minutes == item.getMinutes()));
      }

      actions.add(new ActionMenu(ContextMenuSeparatorAction.getInstance()));
      actions.add(new ActionMenu(new AbstractAction(mLocalizer.msg("comment",
          "Change comment"), TVBrowserIcons.edit(TVBrowserIcons.SIZE_SMALL)) {
        @Override
        public void actionPerformed(ActionEvent e) {
          item.changeComment(parentFrame);
        }
View Full Code Here

   */
  public void updateRootNode(boolean save) {
    mRootNode.removeAllActions();
    mRootNode.getMutableTreeNode().setIcon(IconLoader.getInstance().getIconFromTheme("apps", "appointment", 16));

    Action editReminders = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        ReminderListDialog dlg = new ReminderListDialog(MainFrame.getInstance(), mReminderList);
        UiUtilities.centerAndShow(dlg);
      }
    };
    editReminders.putValue(Action.SMALL_ICON, IconLoader.getInstance().getIconFromTheme("apps", "appointment", 16));
    editReminders.putValue(Action.NAME, mLocalizer.ellipsisMsg("buttonText", "Edit reminder list"));

    Action openSettings = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        MainFrame.getInstance().showSettingsDialog(SettingsItem.REMINDER);
      }
    };
    openSettings.putValue(Action.SMALL_ICON, TVBrowserIcons.preferences(TVBrowserIcons.SIZE_SMALL));
    openSettings.putValue(Action.NAME, Localizer.getLocalization(Localizer.I18N_SETTINGS));

    mRootNode.addAction(editReminders);
    mRootNode.addAction(null);
    mRootNode.addAction(openSettings);

View Full Code Here

    thread.start();
  }


  protected static ActionMenu getButtonAction() {
    AbstractAction action = new AbstractAction() {
      public void actionPerformed(ActionEvent evt) {
        getInstance().showManageRemindersDialog();
      }
    };

    action.putValue(Action.NAME, getName());
    action.putValue(Action.SMALL_ICON, IconLoader.getInstance()
        .getIconFromTheme("apps", "appointment", 16));
    action.putValue(Plugin.BIG_ICON, IconLoader.getInstance().getIconFromTheme("apps", "appointment", 22));
    action.putValue(Action.SHORT_DESCRIPTION, mLocalizer.msg("description",
        "Eine einfache Implementierung einer Erinnerungsfunktion."));

    return new ActionMenu(action);
  }
View Full Code Here

  public ProgramContextMenu(PluginTree tree, TreePath[] paths, Plugin plugin, Program[] programs) {
    super(tree);
    mPaths = paths;
    mPrograms = programs;
    mDefaultAction = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        Node node = (Node) mPaths[0].getLastPathComponent();
        ProgramItem programItem = (ProgramItem) node.getUserObject();
        final Program program = programItem.getProgram();
        MainFrame.getInstance().scrollToProgram(program, new Runnable() {
View Full Code Here

  }


  protected JMenuItem getExpandAllMenuItem(final TreePath treePath) {

    Action action = new AbstractAction(){
      public void actionPerformed(ActionEvent e) {
        mTree.expandAll(treePath);
      }
    };

    action.putValue(Action.NAME, mLocalizer.msg("expandAll","Expand All"));

    JMenuItem item = new JMenuItem(action);
    item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
    return item;
  }
View Full Code Here

    return item;
  }

  protected JMenuItem getCollapseAllMenuItem(final TreePath treePath) {

    Action action = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        mTree.collapseAll(treePath);
      }
    };

    action.putValue(Action.NAME, mLocalizer.msg("collapseAll",
        "Collapse All"));

    JMenuItem item = new JMenuItem(action);
    item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
    return item;
View Full Code Here

  protected Action getCollapseExpandAction(final TreePath treePath) {

    final boolean mIsExpanded = mTree.isExpanded(treePath);

    Action action = new AbstractAction(){
      public void actionPerformed(ActionEvent e) {
        if (mIsExpanded) {
          mTree.collapsePath(treePath);
        }
        else {
          mTree.expandPath(treePath);
        }
      }
    };
    if (mIsExpanded) {
      action.putValue(Action.NAME, mLocalizer.msg("collapse","collapse"));
    }
    else {
      action.putValue(Action.NAME, mLocalizer.msg("expand","expand"));
    }

    return action;
  }
View Full Code Here

      }
      pathName = pathName + treePath.getPathComponent(i);
    }
    final String filterName = mLocalizer.msg("pluginFilter.name", "Plugin filter ({0})", pathName);

    Action action = new AbstractAction(){
      public void actionPerformed(ActionEvent e) {
        Program[] programs = collectProgramsFromNode(node);
        final ArrayList<Program> programList = new ArrayList<Program>();
        if (programs != null) {
          for (Program program : programs) {
            programList.add(program);
          }
          if (programs.length > 0) {
            ProgramFilter pluginFilter = new ProgramFilter() {

              public boolean accept(Program prog) {
                return programList.contains(prog);
              }

              public String getName() {
                return filterName;
              }
            };
            MainFrame.getInstance().setProgramFilter(pluginFilter);
          }
          else {
            JOptionPane
                .showMessageDialog(
                    UiUtilities.getBestDialogParent(MainFrame.getInstance()),
                    mLocalizer
                        .msg(
                            "pluginFilter.noPrograms",
                            "The plugin has marked no program, therefore your current filter will remain active."),
                    mLocalizer.msg("pluginFilter.noProgramsTitle",
                        "No programs marked"), JOptionPane.INFORMATION_MESSAGE);
          }
        }
      }
    };
    action.putValue(Action.NAME, mLocalizer.msg("filter","Show only contained programs"));

    JMenuItem item = new JMenuItem(action);
    item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
    item.setIcon(TVBrowserIcons.filter(TVBrowserIcons.SIZE_SMALL));
    return item;
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.