Examples of ActionListener


Examples of java.awt.event.ActionListener

        Settings.propProgramTableCutTitleLines.getInt(), 1, 3, 1));
    mSettingsPn.add(mCutLongTitlesSelection, cc.xy(4, currentRow));
    mCutLongTitlesLabel = new JLabel(mLocalizer.msg("lines", "Lines"));
    mSettingsPn.add(mCutLongTitlesLabel, cc.xy(6, currentRow));
   
    mCutLongTitlesCB.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mCutLongTitlesSelection.setEnabled(mCutLongTitlesCB.isSelected());
        mCutLongTitlesLabel.setEnabled(mCutLongTitlesCB.isSelected());
      }
    });
    mCutLongTitlesCB.getActionListeners()[0].actionPerformed(null);
   
    // Short descriptions N lines
    mDescriptionLines = new JSpinner(new SpinnerNumberModel(
        Settings.propProgramPanelMaxLines.getInt(), 1, 5, 1));
    mSettingsPn.add(new JLabel(mLocalizer.msg("shortDescription",
        "Short description")), cc.xyw(2, currentRow += 2, 2));
    mSettingsPn.add(mDescriptionLines, cc.xy(4, currentRow));
    mSettingsPn.add(new JLabel(mLocalizer.msg("lines", "Lines")), cc.xy(6,
        currentRow));
   
    // Short programs no description
    mShortProgramsCB = new JCheckBox(mLocalizer.msg("shortPrograms",
        "If duration less than"),
        Settings.propProgramPanelShortDurationActive.getBoolean());
    mSettingsPn.add(mShortProgramsCB, cc.xyw(2, (currentRow += 2), 2));
    mShortProgramsMinutes = new JSpinner(new SpinnerNumberModel(
        Settings.propProgramPanelShortDurationMinutes.getInt(), 1, 30, 1));
    mSettingsPn.add(mShortProgramsMinutes, cc.xy(4, currentRow));
    mShortProgramsLabel = new JLabel(mLocalizer.msg("shortPrograms2",
        "minutes, then hide description"));
    mSettingsPn.add(mShortProgramsLabel, cc.xy(6, currentRow));

    mShortProgramsCB.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        mShortProgramsMinutes.setEnabled(mShortProgramsCB.isSelected());
        mShortProgramsLabel.setEnabled(mShortProgramsCB.isSelected());
      }
    });
    mShortProgramsCB.getActionListeners()[0].actionPerformed(null);
   
    // Column Rows ***************************************
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("5dlu"));
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("10dlu"));
   
    mSettingsPn.add(DefaultComponentFactory.getInstance().createSeparator(
        mLocalizer.msg("columnwidth", "column width")), cc.xyw(1,
        (currentRow += 2), 8));
   
    // column width
    int width = Settings.propColumnWidth.getInt();

    if (width > Settings.MAX_COLUMN_WIDTH) {
      width = Settings.MAX_COLUMN_WIDTH;
    }

    if (width < Settings.MIN_COLUMN_WIDTH) {
      width = Settings.MIN_COLUMN_WIDTH;
    }

    mColWidth = new JSpinner(new SpinnerNumberModel(
            width, Settings.MIN_COLUMN_WIDTH, Settings.MAX_COLUMN_WIDTH, 1));

    mSettingsPn.add(new JLabel(mLocalizer.msg("widthInPixels", "Width in Pixels")), cc.xy(2, (currentRow += 2)));
    mSettingsPn.add(mColWidth, cc.xy(4, currentRow));

    mDefaultBtn = new JButton(Localizer.getLocalization(Localizer.I18N_DEFAULT));
    mDefaultBtn.addActionListener(this);

    mSettingsPn.add(mDefaultBtn, cc.xy(6, currentRow));
   
    // Column Rows ***************************************
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("5dlu"));
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("3dlu"));
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("10dlu"));
   
    mSettingsPn.add(DefaultComponentFactory.getInstance().createSeparator(
        mLocalizer.msg("range", "Range")), cc.xyw(1, (currentRow += 2), 8));
   
    mSettingsPn.add(new JLabel(mLocalizer.msg("startOfDay", "Start of day")),
        cc.xy(2, (currentRow += 2)));
   
    TwoSpinnerDateModel startModel = new TwoSpinnerDateModel();
   
    mStartOfDayTimeSp = new JSpinner(startModel);
    startModel.setMe(mStartOfDayTimeSp);
   
    JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(mStartOfDayTimeSp, Settings.getTimePattern());
    mStartOfDayTimeSp.setEditor(dateEditor);
    mSettingsPn.add(mStartOfDayTimeSp, cc.xy(4, currentRow));
    mSettingsPn.add(new JLabel("("
        + Localizer.getLocalization(Localizer.I18N_TODAY) + ")"), cc.xy(6,
        currentRow));
    CaretPositionCorrector.createCorrector(dateEditor.getTextField(), new char[] {':'}, -1);
   
    mSettingsPn.add(new JLabel(mLocalizer.msg("endOfDay", "End of day")), cc
        .xy(2, (currentRow += 2)));
   
    TwoSpinnerDateModel endModel = new TwoSpinnerDateModel();
   
    mEndOfDayTimeSp = new JSpinner(endModel);
    endModel.setMe(mEndOfDayTimeSp);
   
    dateEditor = new JSpinner.DateEditor(mEndOfDayTimeSp, Settings.getTimePattern());
    mEndOfDayTimeSp.setEditor(dateEditor);
    mSettingsPn.add(mEndOfDayTimeSp, cc.xy(4, currentRow));
    mSettingsPn.add(new JLabel("(" + mLocalizer.msg("nextDay", "next day")
        + ")"), cc.xy(6, currentRow));
    CaretPositionCorrector.createCorrector(dateEditor.getTextField(), new char[] {':'}, -1);
   
    int minutes;
    Calendar cal = Calendar.getInstance();
    minutes = Settings.propProgramTableStartOfDay.getInt();
    cal.set(Calendar.HOUR_OF_DAY, minutes / 60);
    cal.set(Calendar.MINUTE, minutes % 60);
    mStartOfDayTimeSp.setValue(cal.getTime());
   
   
    minutes = Settings.propProgramTableEndOfDay.getInt();
    cal.set(Calendar.HOUR_OF_DAY, minutes / 60);
    cal.set(Calendar.MINUTE, minutes % 60);
    mEndOfDayTimeSp.setValue(cal.getTime());
   
   
   
    // Table Background ***************************************
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("5dlu"));
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("10dlu"));

    mSettingsPn.add(DefaultComponentFactory.getInstance().createSeparator(
        mLocalizer.msg("tableBackground", "Table background")), cc.xyw(1,
        (currentRow += 2), 8));

    mSettingsPn.add(new JLabel(mLocalizer.msg("tableBackgroundStyle",
        "Table background style")), cc.xy(2, (currentRow += 2)));
   
    TableBackgroundStyle[] styles = getTableBackgroundStyles();
    mBackgroundStyleCB = new JComboBox(styles);

    String style = Settings.propTableBackgroundStyle.getString();
    for (int i = 0; i < styles.length; i++) {
      if (styles[i].getSettingsString().equals(style)) {
        mBackgroundStyleCB.setSelectedIndex(i);
        break;
      }
    }

    mBackgroundStyleCB.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        updateBackgroundStyleConfigureButton();
      }
    });

    mSettingsPn.add(mBackgroundStyleCB, cc.xy(4, currentRow));
   
    mConfigBackgroundStyleBt = new JButton(mLocalizer.ellipsisMsg("configure", "Configure"));

    mConfigBackgroundStyleBt.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        ConfigureBackgroundStyleDialog dlg = new ConfigureBackgroundStyleDialog(mBackgroundStyleCB,
            (TableBackgroundStyle) mBackgroundStyleCB.getSelectedItem());
        dlg.show();
      }
    });

    mSettingsPn.add(mConfigBackgroundStyleBt, cc.xy(6, currentRow));
       
    // Foreground color
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("5dlu"));
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("5dlu"));

    mForegroundColorLb = new ColorLabel(Settings.propProgramPanelForegroundColor.getColor());
    mForegroundColorLb.setStandardColor(Settings.propProgramPanelForegroundColor.getDefaultColor());
    ColorButton programPanelForegroundColorChangeBtn = new ColorButton(mForegroundColorLb);

    mSettingsPn.add(DefaultComponentFactory.getInstance().createSeparator(
        mLocalizer.msg("foreground", "Foreground")), cc.xyw(1,
        (currentRow += 2), 8));
   
    mSettingsPn.add(new JLabel(mLocalizer.msg("fontColor", "Font color")), cc
        .xy(2,
        (currentRow += 2)));
    mSettingsPn.add(mForegroundColorLb, cc.xy(4, currentRow));
    mSettingsPn.add(programPanelForegroundColorChangeBtn, cc.xy(6, currentRow));
   
    // Miscellaneous *********************************************
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("5dlu"));
    layout.appendRow(RowSpec.decode("pref"));
    layout.appendRow(RowSpec.decode("3dlu"));
    layout.appendRow(RowSpec.decode("pref"));

    mSettingsPn.add(DefaultComponentFactory.getInstance().createSeparator(
        mLocalizer.msg("mouse", "Mouse")), cc.xyw(1,
        (currentRow += 2), 8));

    mMouseOverCb = new JCheckBox(mLocalizer.msg("MouseOver", "Mouse-Over-Effect"));
    mMouseOverCb.setSelected(Settings.propProgramTableMouseOver.getBoolean());
    mSettingsPn.add(mMouseOverCb, cc.xy(2, (currentRow += 2)));
   
    mMouseOverColorLb = new ColorLabel(Settings.propProgramTableMouseOverColor.getColor());
    mMouseOverColorLb.setStandardColor(Settings.propProgramTableMouseOverColor.getDefaultColor());
    final ColorButton mouseOverColorChangeBtn = new ColorButton(mMouseOverColorLb);
    mMouseOverCb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        boolean enabled = mMouseOverCb.isSelected();
        mMouseOverColorLb.setEnabled(enabled);
        mouseOverColorChangeBtn.setEnabled(enabled);
      }
View Full Code Here

Examples of java.awt.event.ActionListener

    mConfigBackgroundStyleBt.setEnabled(style.hasContent());
  }

  public static JButton createBrowseButton(final Component parent, final JTextField tf) {
    JButton bt = new JButton(mLocalizer.msg("change", "Change"));
    bt.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        File file = new File(tf.getText());
        JFileChooser fileChooser = new JFileChooser(file.getParent());
        String[] extArr = { ".jpg", ".jpeg", ".gif", ".png" };
        fileChooser.setFileFilter(new util.ui.ExtensionFileFilter(extArr, ".jpg, .gif, png"));
View Full Code Here

Examples of java.awt.event.ActionListener

    mTitleRb.setSelected(true);

    updateTextfields();

    mTitleRb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        updateTextfields();
      }
    });

    mTopicRb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        updateTextfields();
      }
    });

    mActorsRb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        updateTextfields();
      }
    });

    expertBtn.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        handler.closeCurrentStep();
        String title;
        if (mProgram != null) {
          title = mProgram.getTitle();
View Full Code Here

Examples of java.awt.event.ActionListener

      if(last.isDirectoryNode() && last.getChildCount() > 0) {
        item = new JMenuItem(isExpanded(path) ? mLocalizer.msg("collapse", "Collapse") : mLocalizer.msg("expand", "Expand"));
        item.setFont(item.getFont().deriveFont(Font.BOLD));

        item.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if(isExpanded(path)) {
              collapsePath(path);
            } else {
              expandPath(path);
            }
          }
        });

        if(!last.equals(mRootNode)) {
          menu.add(item);
        }

        item = new JMenuItem(mLocalizer.msg("expandAll", "Expand all"));

        item.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            expandAll(last);
          }
        });

        menu.add(item);

        item = new JMenuItem(mLocalizer.msg("collapseAll", "Collapse all"));

        item.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            collapseAll(last);
          }
        });
        menu.add(item);

        menu.addSeparator();
      }

      if (!last.isDirectoryNode()) {
        item = new JMenuItem(mLocalizer.ellipsisMsg("editFavorite", "Edit favorite '{0}'", last.getFavorite().getName()),
            TVBrowserIcons.edit(TVBrowserIcons.SIZE_SMALL));
        item.setFont(item.getFont().deriveFont(Font.BOLD));

        item.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ManageFavoritesDialog.getInstance().editSelectedFavorite();
          }
        });
        menu.add(item);
        menu.addSeparator();
      }

      item = new JMenuItem(mLocalizer.msg("newFolder", "New folder"),
          IconLoader.getInstance().getIconFromTheme("actions", "folder-new", 16));

      item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          newFolder(last);
        }
      });
      menu.add(item);

      item = new JMenuItem(mLocalizer.ellipsisMsg("newFavorite", "New Favorite"),
          TVBrowserIcons.newIcon(TVBrowserIcons.SIZE_SMALL));

      item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          ManageFavoritesDialog.getInstance().newFavorite(last.isDirectoryNode() ? last : (FavoriteNode)last.getParent());
        }
      });
      menu.add(item);

      if(last.isDirectoryNode()) {
        if(!last.equals(mRootNode)) {
          item = new JMenuItem(mLocalizer.msg("renameFolder", "Rename folder"),
              TVBrowserIcons.edit(TVBrowserIcons.SIZE_SMALL));

          item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              renameFolder(last);
            }
          });

          menu.add(item);
        }
      }

      FavoriteNode parentSort = null;

      if(!last.isDirectoryNode() && last.getParent().equals(mRootNode) && mRootNode.getChildCount() > 1) {
        parentSort = (FavoriteNode)last.getParent();
      }

      final FavoriteNode sortNode = parentSort == null ? last : parentSort;

      if(last.getChildCount() > 1 || (last.getParent().equals(mRootNode) && mRootNode.getChildCount() > 1 )) {
        menu.addSeparator();

        item = new JMenuItem(mLocalizer.msg("sort", "Sort alphabetically"),
            IconLoader.getInstance().getIconFromTheme("actions", "sort-list", 16));
        final String titleAlpha = item.getText();
        item.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
              FavoriteTreeModel.getInstance().sort(sortNode,FavoriteNodeComparator.getInstance(), titleAlpha);
              reload(sortNode);
          }
        });
        menu.add(item);

        item = new JMenuItem(mLocalizer.msg("sortCount", "Sort by number of programs"),
            IconLoader.getInstance().getIconFromTheme("actions", "sort-list-numerical", 16));
        final String titleCount = item.getText();
        item.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
              FavoriteTreeModel.getInstance().sort(sortNode,FavoriteNodeCountComparator.getInstance(),titleCount);
              reload(sortNode);
          }
        });
        menu.add(item);
      }

      if(parentSort != null) {
        menu.addSeparator();
      }


      item = new JMenuItem(Localizer.getLocalization(Localizer.I18N_DELETE),
          TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL));

      item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          delete(last);
        }
      });

      if(!last.equals(mRootNode) && last.getChildCount() < 1) {
        menu.add(item);
      }

      if(!ManageFavoritesDialog.getInstance().programListIsEmpty()) {
        menu.addSeparator();

        item = new JMenuItem(ManageFavoritesDialog.mLocalizer.msg("send", "Send Programs to another Plugin"), TVBrowserIcons.copy(TVBrowserIcons.SIZE_SMALL));
        item.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
             ManageFavoritesDialog.getInstance().showSendDialog();
          }
        });
View Full Code Here

Examples of java.awt.event.ActionListener

   
    JButton[] buttons = {new JButton(mLocalizer.msg("updatePlugins","Update Plugins now")),
        new JButton(mLocalizer.msg("closeTvBrowser","Close TV-Browser now")),
        new JButton(mLocalizer.msg("closeDialog","Close this dialog and don't update"))};
   
    buttons[0].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
          SoftwareUpdateItem[] updateItems = PluginAutoUpdater.getUpdateItemsForVersionChange();
         
          if(updateItems.length > 0) {
            Settings.propPluginBetaWarning.setBoolean(false);
            SoftwareUpdateDlg updateDlg = new SoftwareUpdateDlg(null,true,updateItems,true);
            updateDlg.setLocationRelativeTo(null);
            updateDlg.setVisible(true);
          }
         
          mCloseTvBrowser = false;
        } catch (IOException e1) {
        }
       
        close();
      }
    });
   
    buttons[1].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        close();
      }
    });
   
    buttons[2].addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mCloseTvBrowser = false;
        close();
      }
    });
View Full Code Here

Examples of java.awt.event.ActionListener

    JButton setButton = new JButton("Choose");

    // anonymous action listener shows a JTree popup and allows the user
    // to choose the class they want
    setButton.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent e) {

    JPopupMenu popup = getChooseClassPopupMenu();

    // show the popup where the source component is
View Full Code Here

Examples of java.awt.event.ActionListener

      // buttons
      panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
      getContentPane().add(panel, BorderLayout.SOUTH);
     
      m_OkButton.setMnemonic('O');
      m_OkButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          updateCapabilities();
          if (m_CapabilitiesFilter == null)
            m_CapabilitiesFilter = new Capabilities(null);
          m_CapabilitiesFilter.assign(m_Capabilities);
          m_Self.setVisible(false);
          showPopup();
        }
      });
      panel.add(m_OkButton);
     
      m_CancelButton.setMnemonic('C');
      m_CancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          m_Self.setVisible(false);
          showPopup();
        }
      });
View Full Code Here

Examples of java.awt.event.ActionListener

      add(panel, BorderLayout.SOUTH);

      if (ClassDiscovery.hasInterface(CapabilitiesHandler.class, m_ClassType)) {
  // filter
  m_FilterButton.setMnemonic('F');
  m_FilterButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (e.getSource() == m_FilterButton) {
        CapabilitiesFilterDialog dialog = new CapabilitiesFilterDialog();
        dialog.setCapabilities(m_CapabilitiesFilter);
        dialog.setPopup(m_Self);
        dialog.setVisible(true);
        m_Support.firePropertyChange("", null, null);
        repaint();
      }
    }
  });
  panel.add(m_FilterButton);
 
  // remove
  m_RemoveFilterButton.setMnemonic('R');
  m_RemoveFilterButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (e.getSource() == m_RemoveFilterButton) {
        m_CapabilitiesFilter = null;
        m_Support.firePropertyChange("", null, null);
        repaint();
      }
    }
  });
  panel.add(m_RemoveFilterButton);
      }

      // close
      m_CloseButton.setMnemonic('C');
      m_CloseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          if (e.getSource() == m_CloseButton) {
            m_Self.setVisible(false);
          }
        }
View Full Code Here

Examples of java.awt.event.ActionListener

    });
     
      m_OpenBut = new JButton("Open...");
      m_OpenBut.setToolTipText("Load a configured object");
      m_OpenBut.setEnabled(true);
      m_OpenBut.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      Object object = openObject();
      if (object != null) {
        // setValue takes care of: Making sure obj is of right type,
        // and firing property change.
        setValue(object);
        // Need a second setValue to get property values filled in OK.
        // Not sure why.
        setValue(object);
      }
    }
  });
     
      m_SaveBut = new JButton("Save...");
      m_SaveBut.setToolTipText("Save the current configured object");
      m_SaveBut.setEnabled(true);
      m_SaveBut.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      saveObject(m_Object);
    }
  });
     
      m_okBut = new JButton("OK");
      m_okBut.setEnabled(true);
      m_okBut.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {

      m_Backup = copyObject(m_Object);
      if ((getTopLevelAncestor() != null)
    && (getTopLevelAncestor() instanceof Window)) {
        Window w = (Window) getTopLevelAncestor();
        w.dispose();
      }
    }
  });
     
      m_cancelBut = new JButton("Cancel");
      m_cancelBut.setEnabled(true);
      m_cancelBut.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {    
      if (m_Backup != null) {
 
        m_Object = copyObject(m_Backup);
       
View Full Code Here

Examples of java.awt.event.ActionListener

        c.fill = GridBagConstraints.HORIZONTAL;
        c.insets = new Insets(5, 5, 5, 5);
        panel.add(processIdTextField, c);

        startButton = new JButton("Start");
        startButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                start();
            }
        });
        c = new GridBagConstraints();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.