Package javax.swing

Examples of javax.swing.JToggleButton$ToggleButtonModel


        m_pasteB.setToolTipText("Paste from clipboard");
        m_deleteB = new JButton(new ImageIcon(loadImage(BeanVisual.ICON_PATH +
        "delete.png")));
        m_deleteB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
        m_deleteB.setToolTipText("Delete selected");
        m_snapToGridB = new JToggleButton(new ImageIcon(loadImage(BeanVisual.ICON_PATH +
        "shape_handles.png")));
        //m_snapToGridB.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
        m_snapToGridB.setToolTipText("Snap to grid");
        /*Dimension d = m_snapToGridB.getPreferredSize();
        d = new Dimension((int)d.getWidth() * 8, (int)d.getHeight()*8);
 
View Full Code Here


    if (PLUGIN_PERSPECTIVES.size() > 0) {

      // add the main perspective first
      String titleM = m_mainKFPerspective.getPerspectiveTitle();
      Icon icon = m_mainKFPerspective.getPerspectiveIcon();
      JToggleButton tBut = new JToggleButton(titleM, icon, true);
      tBut.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          KFPerspective current = (KFPerspective)m_perspectiveHolder.getComponent(0);
          current.setActive(false);
          m_perspectiveHolder.remove(0);
          m_perspectiveHolder.add((JComponent)m_perspectives.get(0),
View Full Code Here

      if (toAdd instanceof JComponent) {
        toAdd.setLoaded(true);
        m_perspectives.add(toAdd);
        String titleM = toAdd.getPerspectiveTitle();
        Icon icon = toAdd.getPerspectiveIcon();
        JToggleButton tBut = null;
        if (icon != null) {
          tBut = new JToggleButton(titleM, icon, false);
        } else {
          tBut = new JToggleButton(titleM, false);
        }
        tBut.setToolTipText(toAdd.getPerspectiveTipText());
        final int theIndex = index;
        tBut.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setActivePerspective(theIndex);
          }
        });
        m_perspectiveToolBar.add(tBut);
View Full Code Here

      this.getComponent(i).addMouseListener(s);
    }
  }

  private void addToggleButton(final Action action) {
    final JToggleButton button = new JToggleButton();
    button.setAlignmentX(Component.CENTER_ALIGNMENT);

    action.putValue(ACTION_VALUE, button);
    addButtonProperties(button, action);
    Boolean isSelected = (Boolean) action.getValue(ACTION_IS_SELECTED);
    if (isSelected != null) {
      button.setSelected(isSelected.booleanValue());
    }
    button.setBorderPainted(isSelected != null && isSelected.booleanValue());
    button.addMouseListener(new MouseAdapter() {
      public void mouseEntered(MouseEvent e) {
        if (!button.isSelected()) {
          button.setBorderPainted(true);
        }
      }

      public void mouseExited(MouseEvent e) {
        if (!button.isSelected()) {
          button.setBorderPainted(false);
        }
      }

      public void mousePressed(MouseEvent e) {
        if (e.isPopupTrigger() && !disabled) {
View Full Code Here

        URL url;
        ImageIcon imageIcon;
        if (polygonButton == null) {
            url = getImageURL("enclosepoly.gif");
            imageIcon = new ImageIcon(url);
            polygonButton = new JToggleButton(imageIcon);
            polygonButton.setToolTipText(i18n.get(EditableOMPoly.class,
                    "polygonButton.tooltip",
                    "Automatically link first and last nodes"));
        }
View Full Code Here

    protected void createGUI(ButtonGroup bg) {
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        setLayout(gridbag);

        layerName = new JToggleButton(layer.getName());
        layerName.setBorderPainted(false);
        layerName.addActionListener(this);
        offColor = layerName.getBackground();
        layerName.setToolTipText(i18n.get(LayerPane.class,
                "layerName.tooltip",
View Full Code Here

            ImageIcon snapshotIcon = new ImageIcon(url);

            url = PropUtils.getResourceOrFileOrURL(this, totalScenarioIconName);
            ImageIcon totalScenarioIcon = new ImageIcon(url);

            timeWrapToggle = new JToggleButton(totalScenarioIcon, timeWrap);
            timeWrapToggle.setSelectedIcon(snapshotIcon);
            timeWrapToggle.setActionCommand(SCENARIO_MODE_CMD);
            timeWrapToggle.addActionListener(this);
            timeWrapToggle.setToolTipText("Wrap Scenario Time Scale");
            // jtb.add(timeWrapToggle);
            innerBox.add(timeWrapToggle);

        } catch (MalformedURLException murle) {
            Debug.error("ScenarioGraphicLoader " + getName() + ":"
                    + murle.getMessage());
        } catch (NullPointerException npe) {
            Debug.error("ScenarioGraphicLoader " + getName() + ":"
                    + npe.getMessage());
        }

        timerControl = new TimerControlButtonPanel(this);
        // jtb.add(timerControl);
        innerBox.add(timerControl);
        rightBox.add(innerBox);

        pcs.addPropertyChangeListener(TIMER_RUNNING_STATUS, timerControl);

        String runningStatus = timer.isRunning() ? (getClockDirection() > 0 ? TIMER_FORWARD
                : TIMER_BACKWARD)
                : TIMER_STOPPED;
        pcs.firePropertyChange(TIMER_RUNNING_STATUS, null, runningStatus);

        timerRateControl = new TimerRateComboBox(this);
        timerRateControl.setToolTipText("Change clock rate for Scenario");

        Iterator it = timerRates.iterator();
        while (it.hasNext()) {
            TimerRateHolder trh = (TimerRateHolder) it.next();
            timerRateControl.add(trh.label, trh.clock, trh.pace);
        }

        int si = timerRates.size() / 2;
        if (si > 0) {
            timerRateControl.setSelectedIndex(si);
        }

        // jtb.add(timerRateControl);
        rightBox.add(timerRateControl);

        timeSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 100, 0);
        timeSliderSupport = new TimeSliderSupport(timeSlider, this, startTime, endTime);
        // jtb.add(timeSlider);
        leftBox.add(timeSlider);

        timeLabel = new JLabel(" ", SwingConstants.CENTER);
        java.awt.Font defaultFont = timeLabel.getFont();
        timeLabel.setFont(new java.awt.Font(defaultFont.getName(), defaultFont.getStyle(), 10));
        // jtb.add(timeLabel);
        leftBox.add(timeLabel);

        URL url = ScenarioGraphicLoader.class.getResource("path.png");
        ImageIcon icon = new ImageIcon(url);

        JToggleButton modeButton = new JToggleButton(icon, mode == TOTAL_SCENARIO_MODE);
        modeButton.setToolTipText((mode == TOTAL_SCENARIO_MODE ? "Hide"
                : "Show")
                + " scenario paths on " + getName());
        modeButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                JToggleButton jtb = (JToggleButton) ae.getSource();
                boolean sel = jtb.isSelected();
                setMode((sel ? TOTAL_SCENARIO_MODE : SNAPSHOT_SCENARIO_MODE));
                jtb.setToolTipText((sel ? "Hide" : "Show")
                        + " scenario paths on " + getName());
                manageGraphics();
            }
        });

        bigBox.add(modeButton);
        bigBox.add(leftBox);
        bigBox.add(rightBox);
        jtb.add(bigBox);

        return jtb;
    }
View Full Code Here

        sizesFont.addActionListener(this);

        int textButtonWidth = 10;
        int textButtonHeight = 15;

        boldFont = new JToggleButton();
        boldFont.setIcon(getTextAccentToggleButtonImage(textButtonWidth,
                textButtonHeight,
                new Font(boldFont.getFont().getName(), Font.BOLD, boldFont.getFont()
                        .getSize()),
                "B"));

        // Too wide margins for 1 letter look unnatural
        Insets insets = boldFont.getInsets();
        insets.left = insets.left / 2;
        insets.right = insets.right / 2;
        boldFont.setMargin(insets);
        boldFont.setSelected(text.getFont().isBold());
        boldFont.setToolTipText(i18n.get(EditableOMText.class,
                "boldFont",
                I18n.TOOLTIP,
                "Bold Font"));
        boldFont.setActionCommand(TextFontCommand);
        boldFont.addActionListener(this);

        italicFont = new JToggleButton();
        italicFont.setIcon(getTextAccentToggleButtonImage(textButtonWidth,
                textButtonHeight,
                new Font(italicFont.getFont().getName(), Font.ITALIC, italicFont.getFont()
                        .getSize()),
                "I"));
View Full Code Here

                bg = new ButtonGroup();
            }

            fillFaceToolBar(faceTB, bg);

            unpickBtn = new JToggleButton("", false);
            unpickBtn.setActionCommand(RESET_CMD);
            unpickBtn.addActionListener(this);
            unpickBtn.setVisible(false);
            bg.add(unpickBtn);
            faceTB.add(unpickBtn);
View Full Code Here

            EditToolLoader loader = (EditToolLoader) it.next();
            String[] classnames = loader.getEditableClasses();

            for (int i = 0; i < classnames.length; i++) {
                ImageIcon icon = loader.getIcon(classnames[i]);
                JToggleButton btn = new JToggleButton(icon, false);
                btn.setToolTipText(loader.getPrettyName(classnames[i]));
                btn.setActionCommand(classnames[i]);
                btn.addActionListener(this);
                bg.add(btn);
                faceTB.add(btn);
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.swing.JToggleButton$ToggleButtonModel

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.