Package javax.swing

Examples of javax.swing.AbstractAction


    }
  }

  public Action getSeparatorAction() {
    if (mSeparatorAction == null) {
      mSeparatorAction = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {

        }
      };
View Full Code Here


    return mSeparatorAction;
  }

  public Action getGlueAction() {
    if(mGlueAction == null) {
      mGlueAction = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {

        }
      };
View Full Code Here

    return mGlueAction;
  }

  public Action getSpaceAction() {
    if(mSpaceAction == null) {
      mSpaceAction = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {

        }
      };
View Full Code Here

    final JScrollPane scrollPane = new JScrollPane(mInfoEP);
    scrollPane.getVerticalScrollBar().setUnitIncrement(30);

    // ScrollActions
    mUpAction = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        scrollPane.getVerticalScrollBar().setValue(
            scrollPane.getVerticalScrollBar().getValue()
                - scrollPane.getVerticalScrollBar().getUnitIncrement());
      }
    };

    mDownAction = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        scrollPane.getVerticalScrollBar().setValue(
            scrollPane.getVerticalScrollBar().getValue()
                + scrollPane.getVerticalScrollBar().getUnitIncrement());
      }
    };

    mPluginsPane = new JTaskPane();
    mPluginsPane.add(mFunctionGroup);

    mActionsPane = new JScrollPane(mPluginsPane);

    mConfigBtn = new JButton(mLocalizer.msg("config", "Configure view"));
    mConfigBtn.setIcon(TVBrowserIcons.preferences(TVBrowserIcons.SIZE_SMALL));

    ButtonBarBuilder2 buttonBuilder = new ButtonBarBuilder2();

    buttonBuilder.addButton(mConfigBtn);
    mConfigBtn.setVisible(showSettings);

    if (pluginsSize == null) {
      mActionsPane.setPreferredSize(new Dimension(250, 500));
    } else {
      mActionsPane.setPreferredSize(pluginsSize);
    }

    if (ProgramInfo.getInstance().getSettings().getShowFunctions()) {
      JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
      split.setDividerSize(5);
      split.setContinuousLayout(true);
      split.setDividerLocation(mActionsPane.getPreferredSize().width + 1);
      split.setLeftComponent(mActionsPane);
      split.setRightComponent(scrollPane);
      mMainPanel.add(split, BorderLayout.CENTER);
      mFindAsYouType.installKeyListener(split);
    } else {
      final JButton functions = new JButton(mLocalizer.msg("functions",
          "Functions"));
      functions.setFocusable(false);

      functions.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
          if (e.getClickCount() == 1) {
            JPopupMenu popupMenu = PluginProxyManager.createPluginContextMenu(
                mProgram, ProgramInfoProxy.getInstance());
            popupMenu.show(functions, e.getX(), e.getY()
                - popupMenu.getPreferredSize().height);
          }
        }
      });

      buttonBuilder.addUnrelatedGap();
      buttonBuilder.addButton(functions);
      mMainPanel.add(scrollPane, BorderLayout.CENTER);
    }

    // buttons
    JPanel buttonPn = new JPanel(new BorderLayout(0, 5));
    buttonPn.add(mFindAsYouType.getSearchBar(), BorderLayout.NORTH);
    buttonPn.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));

    mMainPanel.add(buttonPn, BorderLayout.SOUTH);

    mConfigBtn.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        exit();
        MainFrame.getInstance().showSettingsDialog(SettingsItem.PROGRAMINFO);
      }
    });

    mHighlight = new JCheckBox(mLocalizer
        .msg("highlight", "Highlight favorite"), ProgramInfo.getInstance()
        .getSettings().getHighlightFavorite());
    mHighlight.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent e) {
        ProgramInfo.getInstance().getSettings().setHighlightFavorite(
            mHighlight.isSelected());
        highlightFavorites();
      }
    });
    buttonBuilder.addUnrelatedGap();
    buttonBuilder.addFixed(mHighlight);

    mCloseBtn = new JButton(Localizer.getLocalization(Localizer.I18N_CLOSE));
    mCloseBtn.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        exit();
      }
    });

    buttonBuilder.addGlue();
    buttonBuilder.addButton(mCloseBtn);

    buttonPn.add(buttonBuilder.getPanel(), BorderLayout.SOUTH);

    /*
     * The action for the search button in the function panel.
     */
    final Action searchAction = new AbstractAction() {
      private static final long serialVersionUID = 1L;

      public void actionPerformed(ActionEvent e) {
        // Open the SearchPanel
        if (mFindAsYouType.getCloseButton().isVisible()) {
          mFindAsYouType.interrupt();
          mFindAsYouType.getSearchBar().setVisible(false);
          mFindAsYouType.getCloseButton().setVisible(false);
        } else {
          mFindAsYouType.showSearchBar();
        }
      }
    };

    searchAction.putValue(Action.SMALL_ICON, TVBrowserIcons
        .search(TVBrowserIcons.SIZE_SMALL));
    searchAction.putValue(Action.ACTION_COMMAND_KEY, "action");
    searchAction.putValue(Action.NAME, mLocalizer.msg("search", "Search Text"));

    mSearchMenu = new ActionMenu(searchAction);

    mFindAsYouType.installKeyListener(scrollPane);
    mFindAsYouType.installKeyListener(mMainPanel);
    mFindAsYouType.installKeyListener(mConfigBtn);
    mFindAsYouType.installKeyListener(mCloseBtn);
    mFindAsYouType.installKeyListener(buttonPn);
    mFindAsYouType.installKeyListener(mPluginsPane);
    mFindAsYouType.installKeyListener(mActionsPane);
    mFindAsYouType.installKeyListener(mFunctionGroup);
    mFindAsYouType.installKeyListener(mActionsPane.getVerticalScrollBar());
    mFindAsYouType.installKeyListener(scrollPane.getVerticalScrollBar());

    mFindAsYouType.getCloseButton().addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentHidden(ComponentEvent e) {
            if (mTextSearch != null) {
              mTextSearch.setText(mLocalizer.msg("search", "Search Text"));
            }
            searchAction.putValue(Action.NAME, mLocalizer.msg("search",
                "Search Text"));
          }

          @Override
          public void componentShown(ComponentEvent e) {
            if (mTextSearch != null) {
              mTextSearch.setText(mLocalizer.msg("closeSearch",
                  "Close search bar"));
            }
            searchAction.putValue(Action.NAME, mLocalizer.msg("closeSearch",
                "Close search bar"));
          }
        });

    // Scroll to the beginning
View Full Code Here

          mFunctionGroup.add(Box.createRigidArea(new Dimension(0, 2)));
          lastEntry = contextMenuIf;
        }
      } else if (contextMenuIf.getId().compareTo(ConfigMenuItem.CONFIG) == 0
          && mShowSettings) {
        Action action = new AbstractAction() {
          private static final long serialVersionUID = 1L;

          public void actionPerformed(ActionEvent e) {
            MainFrame.getInstance()
                .showSettingsDialog(SettingsItem.CONTEXTMENU);
          }
        };

        action.putValue(Action.SMALL_ICON, TVBrowserIcons
            .preferences(TVBrowserIcons.SIZE_SMALL));
        action.putValue(Action.NAME, ConfigMenuItem.getInstance().toString());

        ActionMenu configure = new ActionMenu(action);
        new TaskMenuAction(mFunctionGroup, mProgram, configure, this,
            "id_configure", mFindAsYouType);
        lastEntry = contextMenuIf;
View Full Code Here

      getRootPane().setDefaultButton(mNextBtn);
    } else {
      getRootPane().setDefaultButton(mDoneBtn);
    }
   
    AbstractAction a = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        if(mBackBtn.isEnabled()) {
          mBackBtn.dispatchEvent(new KeyEvent(mBackBtn, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_SPACE, ' '));
          mBackBtn.dispatchEvent(new KeyEvent(mBackBtn, KeyEvent.KEY_RELEASED, 0, 0, KeyEvent.VK_SPACE, ' '));
        }
View Full Code Here

  // Adds the action to the TaskPaneGroup.
  private void addAction(final JTaskPaneGroup parent, final ActionMenu menu) {
    final Action a = menu.getAction();

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

      public void actionPerformed(final ActionEvent e) {
        a.actionPerformed(e);
View Full Code Here

          if (progArr.length > 0) {
            PluginTreeNode newNode = new PluginTreeNode(child.toString());
            newNode.setGroupingByWeekEnabled(true);
            newNode.getMutableTreeNode().setIcon(FavoritesPlugin.getFavoritesIcon(16));
            node.add(newNode);
            Action editFavorite = new AbstractAction() {
              public void actionPerformed(ActionEvent e) {
                FavoritesPlugin.getInstance().editFavorite(child.getFavorite());
              }
            };
            editFavorite.putValue(Action.NAME, mLocalizer.ellipsisMsg("editTree","Edit"));
            editFavorite.putValue(Action.SMALL_ICON, TVBrowserIcons.edit(TVBrowserIcons.SIZE_SMALL));

            Action deleteFavorite = new AbstractAction() {
              public void actionPerformed(ActionEvent e) {
                FavoritesPlugin.getInstance().askAndDeleteFavorite(child.getFavorite());
              }
            };
            deleteFavorite.putValue(Action.NAME, mLocalizer.ellipsisMsg("deleteTree","Delete"));
            deleteFavorite.putValue(Action.SMALL_ICON, TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL));
            deleteFavorite.putValue(ContextMenuIf.ACTIONKEY_KEYBOARD_EVENT,
                KeyEvent.VK_DELETE);

            newNode.addAction(editFavorite);
            newNode.addAction(deleteFavorite);
View Full Code Here

  public Properties storeSettings() {
    return mSettings.storeSettings();
  }

  public ActionMenu getButtonAction() {
    AbstractAction action = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        mRecieveFilter = null;
        showProgramList();
      }
    };
    action.putValue(Action.NAME, mLocalizer.msg("name", "Important programs"));
    action.putValue(Action.SMALL_ICON, createImageIcon("emblems", "emblem-important", 16));
    action.putValue(Plugin.BIG_ICON, createImageIcon("emblems", "emblem-important", 22));

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

    if (mConfigs.length > 1) {
      ArrayList<AbstractAction> list = new ArrayList<AbstractAction>();

      for (final AbstractPluginProgramFormating config : mConfigs) {
        if (config != null && config.isValid()) {
          list.add(new AbstractAction(config.getName()) {
            public void actionPerformed(ActionEvent e) {
              blogThis(program, config);
            }
          });
        }
      }

      return new ActionMenu(mLocalizer.ellipsisMsg("contextMenuText", "Create a new Blog-Entry"), icon,
          list.toArray(new AbstractAction[list.size()]));
    } else {
      AbstractAction blog = new AbstractAction(mLocalizer.msg("contextMenuText", "Create a new Blog-Entry")) {
        public void actionPerformed(ActionEvent evt) {
          blogThis(program, mConfigs.length != 1 ? DEFAULT_CONFIG : mConfigs[0]);
        }
      };

      blog.putValue(Action.SMALL_ICON, icon);

      return new ActionMenu(blog);
    }
  }
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.