Package javax.swing

Examples of javax.swing.JToggleButton.addActionListener()


                btn = new JToggleButton(toolUI.getIcon());
            } else {
                btn = new JToggleButton(new ImageIcon(getClass().getResource("/org/gephi/desktop/tools/tool.png")));
            }
            btn.setToolTipText(toolUI.getName() + " - " + toolUI.getDescription());
            btn.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    //Let the user unselect a tool (by clicking on it again) without having to select other tool:
                    if (tool == currentTool) {
                        toolbar.clearSelection();
View Full Code Here


                    bg.add(aibutton);
                    try {
                        // TODO there must be a better way to parse a number like "+3" than this.
                        final int buttonvalue = (NumberFormat.getIntegerInstance().parse(ai.replace("+", ""))).intValue();
                        if (auto_increment_selected == buttonvalue) aibutton.setSelected(true);
                        aibutton.addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                auto_increment_selected = buttonvalue;
                            }
                        });
View Full Code Here

        final JToggleButton scale = new JToggleButton(ImageProvider.get("misc", "rectangle"));

        JPanel p2 = new JPanel();
        p2.add(scale);
        p.add(p2, BorderLayout.SOUTH);
        scale.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent ev) {
                p.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                if (scale.getModel().isSelected()) {
                    ((JLabel)vp.getView()).setIcon(loadScaledImage(imageUrl, Math.max(vp.getWidth(), vp.getHeight())));
View Full Code Here

    turtleLabel[14].setBackground(new java.awt.Color(0, 0, 0));
    turtleLabel[14].setOpaque(true);
    blackButtonContainer.add(turtleLabel[14]);

    JToggleButton blackName = new JToggleButton(org.nlogo.api.Color.getColorNameByIndex(14) + " = 0");
    blackName.addActionListener(this);
    blackName.setActionCommand("0.0");
    blackName.setOpaque(true);
    blackName.setFont(new java.awt.Font("ArialNarrow", 0, 10));
    Insets insets = new Insets(0, 0, 0, 0);
    blackName.setMargin(insets);
View Full Code Here

    whiteButtonContainer.setLayout(new GridLayout(1, 3));

    whiteButtonContainer.add(new JLabel(""));

    JToggleButton whiteName = new JToggleButton(org.nlogo.api.Color.getColorNameByIndex(15) + " = 9.9");
    whiteName.addActionListener(this);
    whiteName.setActionCommand("9.9");
    whiteName.setOpaque(true);
    whiteName.setFont(new java.awt.Font("ArialNarrow", 0, 10));
    whiteName.setMargin(insets);
    swatchesGroup.add(whiteName);
View Full Code Here

    for (int i = 5; i < 140; i += 10) {
      // Create name Buttons
      String colorNameString = org.nlogo.api.Color.getColorNameByIndex(i / 10) + " = " + i;
      JToggleButton colorName = new JToggleButton(colorNameString);
      colorName.addActionListener(this);
      colorName.setActionCommand(String.valueOf(i));
      colorName.setFont(new java.awt.Font("ArialNarrow", 0, 10));
      swatchesGroup.add(colorName);
      leftNameContainer.add(colorName);
    }
View Full Code Here

          }
          s.add(label);
        }
        swatch.add(s);
        swatch.setActionCommand(String.valueOf(colorNumber));
        swatch.addActionListener(this);
        swatch.addMouseListener(this);

        swatchesGroup.add(swatch);
        swatchesContainer.add(swatch);
View Full Code Here

        private WeekIndex currentWeekIndex;

        public WeekButtons() {
            for(int i=0; i<4; i++) {
                JToggleButton btn = new JToggleButton("Неделя " + (i+1));
                btn.addActionListener(this);
                buttons.add(btn);
            }
        }
           
        public WeekIndex getCurrentWeekIndex() {
View Full Code Here

        buttonPanel.add(Box.createGlue());

        final JToggleButton fixOrderButton = new JToggleButton("fix order");
        fixOrderButton.setToolTipText("Fixes the order of the threads in the table, only 'new' busy threads will pop up.");
        fixOrderButton.setActionCommand("fix");
        fixOrderButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (e.getActionCommand().equals("fix")) {
                    fixOrderButton.setActionCommand("unfix");
                    fixOrder(true);
                }
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.