Package java.awt.event

Examples of java.awt.event.ActionListener


    String channelFilterName = Settings.propLastUsedChannelGroup.getString();
    // all channels
    JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(mLocalizer.msg(
        "channelGroupAll", "All channels"));
    menuItem.setSelected(channelFilterName == null);
    menuItem.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        MainFrame.getInstance().setChannelGroup(null);
      }
    });
    // selective groups
    menu.add(menuItem);
    String[] channelFilterNames = FilterComponentList.getInstance()
        .getChannelFilterNames();
    for (final String filterName : channelFilterNames) {
      menuItem = new JRadioButtonMenuItem(filterName);
      menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
          MainFrame.getInstance().setChannelGroup(
              (ChannelFilterComponent) FilterComponentList.getInstance()
                  .getFilterComponentByName(filterName));
        }
      });
      menu.add(menuItem);
      if (channelFilterName != null && filterName.equals(channelFilterName)) {
        menuItem.setSelected(true);
      }
    }
    menu.add(new JSeparator());
    // new channel group
    JMenuItem menuItemAdd = createMenuItem("channelGroupNew",
        "Add channel group", null, true);
    menuItemAdd.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        EditFilterComponentDlg dlg = new EditFilterComponentDlg(null, null,
            ChannelFilterComponent.class);
        FilterComponent rule = dlg.getFilterComponent();
        if ((rule != null) && (rule instanceof ChannelFilterComponent)) {
          FilterComponentList.getInstance().add(rule);
          FilterComponentList.getInstance().store();
          MainFrame.getInstance()
              .setChannelGroup((ChannelFilterComponent) rule);
        }
      }
    });
    menu.add(menuItemAdd);
    // edit channel group
    JMenuItem menuItemEdit = createMenuItem("channelGroupEdit",
        "Edit current channel group", null, true);
    menuItemEdit.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        FilterComponent rule = MainFrame.getInstance().getChannelGroup();
        if (rule != null) {
          // rule must be removed before editing it, otherwise the dialog doesn't save it
View Full Code Here


    menuItemEdit.setEnabled(!MainFrame.isStarting() && MainFrame.getInstance().getChannelGroup() != null);
  }

  private JMenuItem createDateMenuItem(final Date date) {
    JMenuItem item = new JMenuItem(date.getLongDateString());
    item.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mMainFrame.goTo(date);
      }
    });
    return item;
View Full Code Here

    Icon icon = null;
    if (Settings.propShowChannelIconsInChannellist.getBoolean()) {
      icon = UiUtilities.createChannelIcon(channel.getIcon());
    }
    JMenuItem item = new JMenuItem(channel.getName(), icon);
    item.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mMainFrame.showChannel(channel);
      }
    });
View Full Code Here

  private JMenuItem createTimeMenuItem(final int time) {
    int h = time / 60;
    int min = time % 60;
    JMenuItem item = new JMenuItem((h < 10 ? "0" : "") + h + ":"
        + (min < 10 ? "0" : "") + min);
    item.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mMainFrame.scrollToTime(time);
      }
    });
    return item;
View Full Code Here

    for (int i = 0; i < filterArr.length; i++) {
      final ProgramFilter filter = filterArr[i];
      result[i] = new JRadioButtonMenuItem(filter.toString());
      final JRadioButtonMenuItem item = result[i];
      group.add(item);
      result[i].addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
          mMainFrame.setProgramFilter(filter);
          item.setSelected(true);
        }
      });
View Full Code Here

      if (license != null) {
        String name = service.getInfo().getName();
        JMenuItem item = new JMenuItem(name, new ImageIcon(
            "imgs/tvbrowser16.png"));
        setMnemonic(item);
        item.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            LicenseBox box = new LicenseBox(mMainFrame, license, false);
            util.ui.UiUtilities.centerAndShow(box);
          }
        });
View Full Code Here

  }

  private JMenuItem pluginHelpMenuItem(final String name, final String helpUrl) {
    JMenuItem item = new JMenuItem(name);
    setMnemonic(item);
    item.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        Launch.openURL(helpUrl);
      }
    });
View Full Code Here

      mOpenCloseMenuItem.setFont(f.deriveFont(Font.BOLD));
      mQuitMenuItem = new JMenuItem(mLocalizer.msg("menu.quit", "Quit"), TVBrowserIcons.quit(TVBrowserIcons.SIZE_SMALL));
      mConfigure = new JMenuItem(mLocalizer.msg("menu.configure", "Configure"), TVBrowserIcons
          .preferences(TVBrowserIcons.SIZE_SMALL));

      mConfigure.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          MainFrame.getInstance().showSettingsDialog(SettingsItem.TRAY);
        }
      });

      mOpenCloseMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
          toggleShowHide();
        }
      });

      mReminderItem = new JMenuItem(mLocalizer.msg("menu.pauseReminder", "Pause Reminder"));
      mReminderItem.setIcon(IconLoader.getInstance().getIconFromTheme("apps", "appointment", 16));
      mReminderItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          toggleReminderState(false);
        }
      });

      mQuitMenuItem.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent e) {
          MainFrame.getInstance().quit();
        }
      });

      mSystemTray.addLeftClickAction(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          if (mClickTimer == null || !mClickTimer.isAlive()) {
            toggleShowHide();
          }
        }
      });

      MainFrame.getInstance().addComponentListener(new ComponentListener() {

        public void componentResized(ComponentEvent e) {
          int state = MainFrame.getInstance().getExtendedState();

          if ((state & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH) {
            mState = Frame.MAXIMIZED_BOTH;
          } else if ((state & Frame.ICONIFIED) != Frame.ICONIFIED) {
            mState = Frame.NORMAL;
          }
        }

        public void componentHidden(ComponentEvent e) {
        }

        public void componentMoved(ComponentEvent e) {
        }

        public void componentShown(ComponentEvent e) {
        }
      });

      MainFrame.getInstance().addWindowListener(new java.awt.event.WindowAdapter() {

        public void windowOpened(WindowEvent e) {
          toggleOpenCloseMenuItem(false);
        }

        public void windowClosing(java.awt.event.WindowEvent evt) {
          if (Settings.propOnlyMinimizeWhenWindowClosing.getBoolean()) {
            toggleShowHide();
          } else {
            MainFrame.getInstance().quit();
          }
        }

        public void windowDeiconified(WindowEvent e) {
          toggleOpenCloseMenuItem(false);
        }

        public void windowIconified(java.awt.event.WindowEvent evt) {
          if (Settings.propTrayMinimizeTo.getBoolean()) {
            MainFrame.getInstance().setVisible(false);
          }
          toggleOpenCloseMenuItem(true);
        }
      });

      toggleOpenCloseMenuItem(false);

      mTrayMenu = new JPopupMenu();

      mSystemTray.addRightClickAction(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
          // mTrayMenu.getPopupMenu().setVisible(false);
          buildMenu();
        }
View Full Code Here

      JButton okBtn = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
      JButton cancelBtn = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
      pn.add(okBtn);
      pn.add(cancelBtn);

      okBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          mStyle.storeSettings();
          mDialog.setVisible(false);
        }
      });

      cancelBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          mDialog.setVisible(false);
        }
      });
View Full Code Here

    panel.add(new JScrollPane(infoPanel), cc.xyw(1,1,2));

    JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));

    ok.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        close();
      }
    });
View Full Code Here

TOP

Related Classes of java.awt.event.ActionListener

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.