Examples of AbstractButton


Examples of javax.swing.AbstractButton

      settings.setHighlightColor(mHighlightColorLb.getColor());

      Enumeration<AbstractButton> actorSearchDefault = mAvailableTargetGroup.getElements();

      while (actorSearchDefault.hasMoreElements()) {
        AbstractButton button = actorSearchDefault.nextElement();

        if (button.isSelected()) {
          settings.setActorSearch(((InternalRadioButton<?>) button).getValue());
          break;
        }
      }
      settings.setEnableSearch(mPersonSearchCB.isSelected());
View Full Code Here

Examples of javax.swing.AbstractButton

        "menuinfo.update", ""));

  }

  void showPopupMenu(final Action item) {
    final AbstractButton btn = (AbstractButton) item
        .getValue(ToolBar.ACTION_VALUE);

    JPopupMenu popup = null;

    if (item == mFilterAction) {
      ScrollableMenu menu = new SelectFilterPopup(MainFrame.getInstance());
      popup = menu.getPopupMenu();
    } else if (item == mGoToDateAction) {
      popup = new JPopupMenu();

      Date curDate = Date.getCurrentDate().addDays(-1);

      if(TvDataBase.getInstance().dataAvailable(curDate)) {
        popup.add(createDateMenuItem(curDate));
      }

      curDate = curDate.addDays(1);

      Date maxDate = TvDataBase.getInstance().getMaxSupportedDate();
      while (maxDate.getNumberOfDaysSince(curDate) >= 0) {
        if(!TvDataBase.getInstance().dataAvailable(curDate)) {
          break;
        }
        if (curDate.isFirstDayOfWeek()) {
          popup.addSeparator();
        }

        popup.add(createDateMenuItem(curDate));
        curDate = curDate.addDays(1);
      }
    } else if (item == mScrollToChannelAction) {
      ScrollableMenu menu = new ScrollableMenu();
      popup = menu.getPopupMenu();

      Channel[] channels = Settings.propSubscribedChannels.getChannelArray();
      for (Channel channel : channels) {
        menu.add(createChannelMenuItem(channel, btn));
      }
    } else if (item == mScrollToTimeAction) {
      popup = new JPopupMenu();

      int[] array = Settings.propTimeButtons.getIntArray();

      for (int element : array) {
        popup.add(createTimeMenuItem(element, btn));
      }

      if (popup.getComponentCount() > 0) {
        popup.addSeparator();
      }

      JMenuItem menuItem = new JMenuItem(TVBrowserActions.scrollToNow.getValue(Action.NAME).toString());
      menuItem.setHorizontalTextPosition(SwingConstants.CENTER);

      menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          MainFrame.getInstance().scrollToNow();
          btn.setSelected(false);
          MainFrame.getInstance().updateToolbar();
        }
      });
      popup.add(menuItem);
    }

    if (popup != null) {
      popup.addPopupMenuListener(new PopupMenuListener() {
        public void popupMenuCanceled(PopupMenuEvent e) {  }

        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
          AbstractButton button = (AbstractButton) item
              .getValue(ToolBar.ACTION_VALUE);
          if (item == mFilterAction) {
            button.setSelected(!FilterManagerImpl.getInstance().getCurrentFilter().equals(FilterManagerImpl.getInstance().getDefaultFilter()));
            setFilterButtonSelected(button.isSelected());
          }
          if (item == mGoToDateAction) {
            button.setSelected(false);
          }

          MainFrame.getInstance().updateToolbar();
        }
View Full Code Here

Examples of javax.swing.AbstractButton

    /* Prepare all ToolBar buttons for Drag'n'Drop */
    for (int i = 0; i < x; i++) {
      (new DragSource()).createDefaultDragGestureRecognizer(this
          .getComponent(i), DnDConstants.ACTION_MOVE, s);
      if (this.getComponent(i) instanceof AbstractButton) {
        AbstractButton b = (AbstractButton) this.getComponent(i);
        b.setDisabledIcon(b.getIcon());
        b.setBorder(BorderFactory.createEmptyBorder(b.getInsets().top,b.getInsets().left,b.getInsets().bottom,b.getInsets().right));
        b.setEnabled(false);
      }
      else if(this.getComponent(i) instanceof JToolBar.Separator) {
        ((JToolBar.Separator)this.getComponent(i)).setBorder(BorderFactory.createLineBorder(getBackground().darker().darker().darker()));
      }
      else if(this.getComponent(i) instanceof JPanel) {
View Full Code Here

Examples of javax.swing.AbstractButton

    String title = getTitle(action);

    button.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        action.actionPerformed(new ActionEvent(action,ActionEvent.ACTION_PERFORMED,""));
        final AbstractButton btn = (AbstractButton) action.getValue(ToolBar.ACTION_VALUE);
        if (!(btn instanceof JToggleButton)) {
          MainFrame.getInstance().getProgramTableScrollPane().requestFocusInWindow();
        }
      }
    });
View Full Code Here

Examples of javax.swing.AbstractButton

        addMouseListener(new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            Component component = e.getComponent();

            if (component instanceof AbstractButton) {
              AbstractButton button = (AbstractButton) component;
              button.setBorderPainted(true);
            }
          }

          public void mouseExited(MouseEvent e) {
            Component component = e.getComponent();
            if (component instanceof AbstractButton) {
              AbstractButton button = (AbstractButton) component;
              button.setBorderPainted(false);
            }
          }
        });
        setRolloverEnabled(true);
        //Close the proper tab by clicking the button
View Full Code Here

Examples of javax.swing.AbstractButton

            if (plugin != null) {
               
                if (SecurityCentre.getInstance().getUser().isAuthorized(plugin) &&
                    UserMode.isCorrectXpLevel(plugin.getXpLevel())) {
                   
                    AbstractButton button = c instanceof JToolBar ?
                            ComponentFactory.getToolBarButton(plugin) :
                            ComponentFactory.getMenuItem(plugin);
                           
                    if (plugin.getKeyStroke() != null && button instanceof JMenuItem)
                        ((JMenuItem) button).setAccelerator(plugin.getKeyStroke());
                       
                    button.setIcon(plugin.getIcon());
                    button.setEnabled(plugin.isEnabled());
                   
                    c.add(button);
                }
            } else {
                logger.error("No valid plugin available for " + key);   
View Full Code Here

Examples of javax.swing.AbstractButton

     * everything about the button.
     *
     * @return AbstractButton in an off state.
     */
    protected AbstractButton getOnOffButton() {
        AbstractButton onoffButton = createOnOffButton();
        onoffButton.setSelectedIcon(layerOnIcon);
        onoffButton.setActionCommand(toggleLayerCmd);
        onoffButton.addActionListener(this);

        String interString = i18n.get(LayerPane.class,
                "onoffButton.tooltip",
                "Turn \"{0}\" layer on/off",
                layer.getName());
        onoffButton.setToolTipText(interString);
        // Determine if this layer has already been activated
        onoffButton.setSelected(layer.isVisible());
        return onoffButton;
    }
View Full Code Here

Examples of javax.swing.AbstractButton

     * everything about the button.
     *
     * @return AbstractButton in an off state.
     */
    protected AbstractButton getPaletteButton() {
        AbstractButton paletteButton = createPaletteButton();
        paletteButton.setSelectedIcon(paletteOnIcon);
        paletteButton.setBorderPainted(false);

        String interString;
        if (!layer.hasGUI()) {
            interString = i18n.get(LayerPane.class,
                    "paletteButton.noPaletteAvailable.tooltip",
                    "No tools available for \"{0}\" layer",
                    layer.getName());
            paletteButton.setEnabled(false);
        } else {
            interString = i18n.get(LayerPane.class,
                    "paletteButton.paletteAvailable.tooltip",
                    "Display tools for \"{0}\" layer",
                    layer.getName());
        }
        paletteButton.setToolTipText(interString);

        paletteButton.setActionCommand(showPaletteCmd);
        paletteButton.addActionListener(this);
        return paletteButton;
    }
View Full Code Here

Examples of javax.swing.AbstractButton

  * gain control.
      */
    @Override
  protected void addControlListener(EventListener listener) {
  if (listener instanceof ActionListener) {
      AbstractButton ab;
      AbstractGainButtonPanel p =
    (AbstractGainButtonPanel) getControlComponent();

      ab = p.getGainIncreaseButton();
            ab.addActionListener((ActionListener) listener);
      ab = p.getGainDecreaseButton();
            ab.addActionListener((ActionListener) listener);
        } else {
      throw new IllegalArgumentException("ActionListener required");
  }
    }
View Full Code Here

Examples of javax.swing.AbstractButton

  * associated with this control.
      */
    @Override
  protected void removeControlListener(EventListener listener) {
  if (listener instanceof ActionListener) {
      AbstractButton ab;
      StandardGainButtonPanel p =
    (StandardGainButtonPanel) getControlComponent();

      ab = p.getGainIncreaseButton();
            ab.removeActionListener((ActionListener) listener);
      ab = p.getGainDecreaseButton();
            ab.removeActionListener((ActionListener) listener);
        } else {
      throw new IllegalArgumentException("ActionListener required");
        }
    }
View Full Code Here
TOP
Copyright © 2015 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.