Java 类javax.swing.JToggleButton 实例源码

项目:knime-activelearning    文件:ToggleButtonList.java   
private JToggleButton addButton(final String value) {
    final int numBtns = m_buttons.size();

    if (numBtns >= (m_maxRows * m_panels.size())) {
        // create a new Panel
        final JPanel panel = new JPanel(new GridLayout(m_maxRows, 1));

        this.add(panel);

        m_panels.add(panel);
        m_lastPanel = panel;
    }
    // createButton and add this as itemListener
    final JToggleButton btn = new CustomToggleButton(value);
    btn.addActionListener(this);

    if (value.equals(ClassModel.NO_CLASS)) {
        btn.setText(m_defaultText);
    }

    m_lastPanel.add(btn); // add it to the last Panel

    m_buttons.add(btn);
    return btn;
}
项目:jdk8u-jdk    文件:Test4619792.java   
public static void main(String[] args) throws IntrospectionException {
    Class[] types = {
            Component.class,
            Container.class,
            JComponent.class,
            AbstractButton.class,
            JButton.class,
            JToggleButton.class,
    };
    // Control set. "enabled" and "name" has the same pattern and can be found
    String[] names = {
            "enabled",
            "name",
            "focusable",
    };
    for (String name : names) {
        for (Class type : types) {
            BeanUtils.getPropertyDescriptor(type, name);
        }
    }
}
项目:JavaGraph    文件:JGraph.java   
/**
 * In addition to delegating the method to the label list and to
 * <tt>super</tt>, sets the background color to <tt>null</tt> when disabled
 * and back to the default when enabled.
 */
@Override
public void setEnabled(boolean enabled) {
    if (enabled != isEnabled()) {
        if (!enabled) {
            this.enabledBackground = getBackground();
            setBackground(null);
        } else if (this.enabledBackground != null) {
            setBackground(this.enabledBackground);
        }
        if (getLabelTree() != null) {
            getLabelTree().setEnabled(enabled);
        }
        for (JToggleButton button : getModeButtonMap().values()) {
            button.setEnabled(enabled);
        }
        getModeButton(getDefaultMode()).setSelected(true);
        // retrieve the layout action to get its key accelerator working
        getLayoutAction();
        super.setEnabled(enabled);
    }
}
项目:geomapapp    文件:GMAProfile.java   
void initSave() {
    savePanel = new JPanel(new GridLayout(0,1));
    savePanel.setBorder( BorderFactory.createTitledBorder("Save Options"));
    ButtonGroup gp = new ButtonGroup();
    saveToFile = new JToggleButton("Save ASCII table");
    savePanel.add( saveToFile );
    gp.add( saveToFile );
    saveToClipboard = new JToggleButton("Copy to clipboard");
    savePanel.add( saveToClipboard );
    gp.add( saveToClipboard );
    saveJPEG = new JToggleButton("Save JPEG image");
    savePanel.add( saveJPEG );
    gp.add( saveJPEG );
    savePNG = new JToggleButton("Save PNG image");
    savePanel.add( savePNG );
    gp.add( savePNG );
    print = new JToggleButton("Print");
    savePanel.add( print );
    gp.add( print );
}
项目:incubator-netbeans    文件:VariablesViewButtons.java   
private static JToggleButton createToggleButton (final String id, String iconName, String tooltip) {
    Icon icon = loadIcon(iconName);
    boolean isSelected = isButtonSelected(id);
    final JToggleButton toggleButton = new JToggleButton(icon, isSelected);
    // ensure small size, just for the icon
    Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
    toggleButton.setPreferredSize(size);
    toggleButton.setMargin(new Insets(1, 1, 1, 1));
    if (!"Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
        // We do not want an ugly border with the exception of Mac, where it paints the toggle state!
        toggleButton.setBorder(new EmptyBorder(toggleButton.getBorder().getBorderInsets(toggleButton)));
    }
    toggleButton.setToolTipText(tooltip);
    toggleButton.setFocusable(false);
    return toggleButton;
}
项目:Cognizant-Intelligent-Test-Scripter    文件:TestExecutionUI.java   
public void toggleConsolePanel(Object source) {
    if (source instanceof JToggleButton) {
        final Boolean flag = ((JToggleButton) source).isSelected();
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                if (flag) {
                    executionAndConsoleSplitPane.setBottomComponent(consolePanel);
                    executionAndConsoleSplitPane.setDividerLocation(0.5);
                } else {
                    executionAndConsoleSplitPane.remove(consolePanel);
                }
            }
        });
    }
}
项目:geomapapp    文件:ViewShapes.java   
void initToggle() {
    shapeToggle = new JToggleButton(Icons.getIcon(Icons.POLYGON, false));
    shapeToggle.setSelectedIcon(Icons.getIcon(Icons.POLYGON, true));
    shapeToggle.setBorder( null );
    shapeToggle.setToolTipText("Shapefile Manager");
    shapeToggle.addActionListener( new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if( shapeToggle.isSelected() ) {
            //  if( suite.getShapes().size()==0 ) {
                if( table==null ) {
                    init();
                //  shapeToggle.setSelected(false);
                    return;
                }
            }
            dialog.setVisible( shapeToggle.isSelected() );
        }
    });
}
项目:incubator-netbeans    文件:RuleEditorViews.java   
public RuleEditorViews(RuleEditorPanel ruleEditorPanel) {
    this.ruleEditorPanel = ruleEditorPanel;

    updatedOnlyToggleButton = new JToggleButton(new ViewActionSupport.UpdatedOnlyViewAction(this));
    updatedOnlyToggleButton.setToolTipText(updatedOnlyToggleButton.getText());
    updatedOnlyToggleButton.setText(null);
    updatedOnlyToggleButton.setSelected(getViewMode() == ViewMode.UPDATED_ONLY);
    updatedOnlyToggleButton.setFocusable(false);

    categorizedToggleButton = new JToggleButton(new ViewActionSupport.CategorizedViewAction(this));
    categorizedToggleButton.setToolTipText(categorizedToggleButton.getText());
    categorizedToggleButton.setText(null);
    categorizedToggleButton.setSelected(getViewMode() == ViewMode.CATEGORIZED);
    categorizedToggleButton.setFocusable(false);

    allToggleButton = new JToggleButton(new ViewActionSupport.AllViewAction(this));
    allToggleButton.setToolTipText(allToggleButton.getText());
    allToggleButton.setText(null);
    allToggleButton.setSelected(getViewMode() == ViewMode.ALL);
    allToggleButton.setFocusable(false);

}
项目:Cognizant-Intelligent-Test-Scripter    文件:WebORTable.java   
private void init() {
    setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.X_AXIS));
    setFloatable(false);

    add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
            new java.awt.Dimension(10, 0),
            new java.awt.Dimension(10, 32767)));
    JLabel label = new JLabel("Properties");
    label.setFont(new Font("Default", Font.BOLD, 12));
    add(label);

    add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)));

    add(Utils.createButton("Add Row", "add", "Ctrl+Plus", WebORTable.this));
    add(Utils.createButton("Delete Rows", "remove", "Ctrl+Minus", WebORTable.this));
    addSeparator();
    add(Utils.createButton("Move Rows Up", "up", "Ctrl+Up", WebORTable.this));
    add(Utils.createButton("Move Rows Down", "down", "Ctrl+Down", WebORTable.this));
    addSeparator();
    frameToggle = new JToggleButton(Utils.getIconByResourceName("/ui/resources/or/web/propViewer"));
    frameToggle.addItemListener(WebORTable.this);
    frameToggle.setToolTipText("Show/Hide Frame Property");
    frameToggle.setActionCommand("Toggle Frame");
    add(frameToggle);
}
项目:swing-memory-game    文件:FrameGame.java   
/**
 * Count the selected and enabled buttons.
 *
 * @return
 */
public int countSelectedButtons()
{
    int count = 0;

    for (JToggleButton button : buttons)
    {
        if (button.isSelected() && button.isEnabled())
        {
            count++;
        }
    }

    return count;
}
项目:chipKIT-importer    文件:SerialMonitorDisplayPane.java   
private JComponent createTopPane() {
    inputField = new JTextField(40);
    inputField.addActionListener( (e) -> sendMessage() );
    inputField.setMaximumSize( inputField.getPreferredSize() );

    JButton sendButton = new JButton( getLocalizedComponentText("sendButton") );
    sendButton.addActionListener( (e) -> sendMessage() );

    JPanel pane = new JPanel();
    pane.setLayout( new BoxLayout(pane, BoxLayout.LINE_AXIS) );

    crSwitch = new JToggleButton("CR", true);
    lfSwitch = new JToggleButton("LF", true);

    pane.add( inputField );
    pane.add( Box.createRigidArea( new Dimension(5, 0) ) );
    pane.add( sendButton );
    pane.add( Box.createGlue() );
    pane.add( crSwitch );
    pane.add( Box.createRigidArea( new Dimension(5, 0) ) );
    pane.add( lfSwitch );        

    pane.setBorder( BorderFactory.createEmptyBorder(3, 3, 3, 0) );

    return pane;
}
项目:incubator-netbeans    文件:ButtonBuilders.java   
static ComponentBuilder getBuilder(Instance instance, Heap heap) {
    if (DetailsUtils.isSubclassOf(instance, JButton.class.getName())) {
        return new JButtonBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JCheckBox.class.getName())) {
        return new JCheckBoxBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JRadioButton.class.getName())) {
        return new JRadioButtonBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JToggleButton.class.getName())) {
        return new JToggleButtonBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JCheckBoxMenuItem.class.getName())) {
        return new JCheckBoxMenuItemBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JRadioButtonMenuItem.class.getName())) {
        return new JRadioButtonMenuItemBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JMenu.class.getName())) {
        return new JMenuBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JMenuBar.class.getName())) {
        return new JMenuBarBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JMenuItem.class.getName())) {
        return new JMenuItemBuilder(instance, heap);
    }
    return null;
}
项目:JavaGraph    文件:JGraph.java   
private Map<JGraphMode,JToggleButton> getModeButtonMap() {
    if (this.modeButtonMap == null) {
        this.modeButtonMap = new EnumMap<>(JGraphMode.class);
        ButtonGroup modeButtonGroup = new ButtonGroup();
        for (JGraphMode any : JGraphMode.values()) {
            JToggleButton button = new JToggleButton(getModeAction(any));
            Options.setLAF(button);
            button.setToolTipText(any.getName());
            button.setEnabled(isEnabled());
            this.modeButtonMap.put(any, button);
            modeButtonGroup.add(button);
        }
        this.modeButtonMap.get(EDIT_MODE).setSelected(true);
    }
    return this.modeButtonMap;
}
项目:ramus    文件:ReportEditorView.java   
protected JToggleButton createOpenViewButton(ButtonGroup group,
                                             final SubView view) {
    JToggleButton button = new JToggleButton(view.getTitle());
    group.add(button);
    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            actionsRemoved(activeView.getActions());
            beforeSubviewActivated(view);
            content.removeAll();
            content.add(view, BorderLayout.CENTER);
            content.revalidate();
            content.repaint();
            activeView = view;
            actionsAdded(view.getActions());
        }
    });

    return button;
}
项目:marathonv5    文件:JavaElementFactory.java   
public static void reset() {
    add(Component.class, JavaElement.class);
    add(JList.class, JListJavaElement.class);
    add(JTabbedPane.class, JTabbedPaneJavaElement.class);
    add(JComboBox.class, JComboBoxJavaElement.class);
    add(JTable.class, JTableJavaElement.class);
    add(JTableHeader.class, JTableHeaderJavaElement.class);
    add(JTree.class, JTreeJavaElement.class);
    add(JToggleButton.class, JToggleButtonJavaElement.class);
    add(JSpinner.class, JSpinnerJavaElement.class);
    add(JProgressBar.class, JProgressBarJavaElement.class);
    add(JSplitPane.class, JSplitPaneJavaElement.class);
    add(JTextComponent.class, JTextComponentJavaElement.class);
    add(EditorContainer.class, JTreeEditingContainerJavaElement.class);
    add(JEditorPane.class, JEditorPaneJavaElement.class);
    add(JMenuItem.class, JMenuItemJavaElement.class);
    add(JSlider.class, JSliderJavaElement.class);
    add(JSpinner.class, JSpinnerJavaElement.class);
    add(DefaultEditor.class, DefaultEditorJavaElement.class);
    add(JColorChooser.class, JColorChooserJavaElement.class);
    add(JFileChooser.class, JFileChooserJavaElement.class);
}
项目:NBANDROID-V2    文件:LogTableManager.java   
@Override
public void stateChanged(ChangeEvent e) {
    Object o = e.getSource();
    if (o instanceof JToggleButton) {
        JToggleButton b = (JToggleButton) o;
        if (b.isSelected()) {
            if (!autoFollowScroll) {
                scrollToBottom();
            }
            autoFollowScroll = true;
        } else {
            autoFollowScroll = false;
        }
    }

}
项目:geomapapp    文件:RenderingTools.java   
protected void paste() {
    Palettes p = Palettes.clipboard;
    if( p==null )return;
    oceanPalette = (Palette)p.ocean.clone();
    landPalette = (Palette)p.land.clone();
    defaultPalette = (Palette)p.both.clone();
    if( Double.isNaN(p.colorInterval) ) {
        continuousB.setSelected(true);
    } else {
        discreteB.setSelected(true);
        colorInterval.setText(Double.toString(p.colorInterval));
    }
    int b = p.button;
    if( b==0&&(!oceanB.isEnabled()) ) b=1;
    else if( b==1&&(!landB.isEnabled()) ) b=0;
    sun.setSun( p.sun );
    JToggleButton t = b==0 ? oceanB
            : b==1 ? landB : bothB;
    t.doClick();
}
项目:FreeCol    文件:MapEditorTransformPanel.java   
/**
 * Creates a panel to choose a map transform.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public MapEditorTransformPanel(FreeColClient freeColClient) {
    super(freeColClient, new BorderLayout());

    nativeNation = first(getSpecification().getIndianNations());

    listPanel = new JPanel(new GridLayout(2, 0));

    group = new ButtonGroup();
    //Add an invisible, move button to de-select all others
    group.add(new JToggleButton());
    buildList();

    JScrollPane sl = new JScrollPane(listPanel,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sl.getViewport().setOpaque(false);
    add(sl);
}
项目:rapidminer    文件:ToggleButtonGroup.java   
@Override
public void actionPerformed(ActionEvent e) {
    for (JToggleButton button : primaryButtons) {
        if (button != e.getSource() && button.isSelected()) {
            button.setSelected(false);
        } else if (button == e.getSource() && !button.isSelected()) {
            button.setSelected(true);
        }

        if (button.isSelected()) {
            button.setFont(button.getFont().deriveFont(Font.BOLD));
        } else {
            button.setFont(button.getFont().deriveFont(Font.PLAIN));
        }
    }

    if (secondaryButton != null) {
        if (secondaryButton != e.getSource() && secondaryButton.isSelected()) {
            secondaryButton.clearMenuSelection();
        }
    }
}
项目:ScreenCut    文件:ScreenCut.java   
/**
 * 使工具按钮处于单选
 *
 * @param bt
 */
private void initButton(JToggleButton bt) {
    rectbtn.setSelected(bt.equals(rectbtn));
    circlebtn.setSelected(bt.equals(circlebtn));
    dirbtn.setSelected(bt.equals(dirbtn));
    fontbtn.setSelected(bt.equals(fontbtn));
    if (!fontbtn.isSelected()) {
        addText();
    }
}
项目:incubator-netbeans    文件:NotificationCenterTopComponent.java   
private void init() {
        initComponents();
        detailsPanel = new JPanel(new GridLayout(1, 1));
        Color color = Utils.getTextBackground();
        detailsPanel.setBackground(new Color(color.getRed(), color.getGreen(), color.getBlue()));
        lblEmptyDetails = new JLabel(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_EmptyDetails"), JLabel.CENTER);
        lblEmptyDetails.setFont(italicFont);
        lblEmptyDetails.setEnabled(false);

        JScrollPane scrollPane = new JScrollPane(detailsPanel);
        splitPane.setRightComponent(scrollPane);

        toolBar.setFocusable(false);
        toolBar.setFloatable(false);
        btnSearch = new JToggleButton(ImageUtilities.loadImageIcon("org/netbeans/modules/notifications/resources/find16.png", true));
        btnSearch.setToolTipText(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_SearchToolTip"));
        btnSearch.setFocusable(false);
        btnSearch.setSelected(NotificationSettings.isSearchVisible());
        //TODO delete 2 lines then quick search API clear text correctly
//        btnSearch.setToolTipText("Disabled due to Quick Search API defects");
//        btnSearch.setEnabled(false);
        btnSearch.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setSearchVisible(btnSearch.isSelected());
            }
        });
        toolBar.add(btnSearch);
        toolBar.add(new FiltersMenuButton(notificationManager.getActiveFilter()));

        initLeft();
        showDetails();
    }
项目:swing-memory-game    文件:FrameGame.java   
/**
 * Count the remaining and enabled buttons.
 *
 * @return
 */
public int countRemainingButtons()
{
    int count = 0;

    for (JToggleButton button : buttons)
    {
        if (!button.isSelected() && button.isEnabled())
        {
            count++;
        }
    }

    return count;
}
项目:incubator-netbeans    文件:GridDesigner.java   
/**
 * Creates and initializes "enable gap support" button.
 * 
 * @return "enable gap support" button.
 */
private JToggleButton initGapButton() {
    JToggleButton button = new JToggleButton();
    ImageIcon image = ImageUtilities.loadImageIcon("org/netbeans/modules/form/layoutsupport/griddesigner/resources/gaps.png", false); // NOI18N
    button.setIcon(image);
    button.setFocusPainted(false);
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            boolean gapSupport = ((JToggleButton)e.getSource()).isSelected();
            gapWidthSpinner.setEnabled(gapSupport);
            gapHeightSpinner.setEnabled(gapSupport);
            gapWidthSpinnerLabel.setEnabled(gapSupport);
            gapHeightSpinnerLabel.setEnabled(gapSupport);
            gapWidthSpinnerBox.setEnabled(gapSupport);
            gapHeightSpinnerBox.setEnabled(gapSupport);
            if(gapSupport) {
                assert !gridManager.getGridInfo().hasGaps();
                ((JToggleButton)e.getSource()).setToolTipText(NbBundle.getMessage(GridDesigner.class, "GridDesigner.gapSupportDisable")); // NOI18N
                int gapWidth = FormLoaderSettings.getInstance().getGapWidth();
                int gapHeight = FormLoaderSettings.getInstance().getGapHeight();
                gapWidthSpinner.setValue(gapWidth);
                gapHeightSpinner.setValue(gapHeight);
                glassPane.performAction(new AddGapsAction());
            } else {
                assert gridManager.getGridInfo().hasGaps();
                ((JToggleButton)e.getSource()).setToolTipText(NbBundle.getMessage(GridDesigner.class, "GridDesigner.gapSupportEnable")); // NOI18N
                glassPane.performAction(new RemoveGapsAction());
            }
        }
    });
    return button;
}
项目:geomapapp    文件:CustomDB.java   
protected JPanel createLassoPanel() {
        JPanel p2 = new JPanel(new BorderLayout());
        JToggleButton tb = new JToggleButton(Icons.getIcon(Icons.LASSO, false));
        tb.setSelectedIcon(Icons.getIcon(Icons.LASSO, true));
        tb.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
//              ((AbstractButton)e.getSource()).setSelected(true);
                if (((AbstractButton)e.getSource()).isSelected()) {
                    map.setBaseCursor(Cursors.getCursor(Cursors.LASSO));
                } else
                    map.setBaseCursor(Cursor.getDefaultCursor());
            }
        });
        tb.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 0));
        p2.add(tb, BorderLayout.WEST);
        p2.setBorder(null);
        JLabel l = new JLabel("<html>Lasso<br>Data</html>");
        l.setSize(35, 60);
        l.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
        p2.add(l);

//      ***** GMA 1.6.2: Listen for lasso button to ensure that it works correctly with the 
//      zoom buttons in the main toolbar
        lassoTB = tb;
        lassoTB.addMouseListener(this);

        return p2;
    }
项目:incubator-netbeans    文件:ActionFactory.java   
void updateState() {
    JEditorPane pane = getPane();
    if (pane != null) {
        boolean rectangleSelection = RectangularSelectionUtils.isRectangularSelection(pane);
        JToggleButton toggleButton = getToggleButton();
        if (toggleButton != null) {
            toggleButton.setSelected(rectangleSelection);
            toggleButton.setContentAreaFilled(rectangleSelection);
            toggleButton.setBorderPainted(rectangleSelection);
        }
    }
}
项目:incubator-netbeans    文件:ActionFactory.java   
@Override
public Component getToolbarPresenter() {
    JToggleButton toggleButton = new JToggleButton();
    toggleButtonRef = new WeakReference<>(toggleButton);
    toggleButton.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N
    toggleButton.setIcon((Icon) getValue(SMALL_ICON));
    toggleButton.setAction(this); // this will make hard ref to button => check GC
    return toggleButton;
}
项目:JavaGraph    文件:TypeTree.java   
/**
 * Returns the button for the show-supertypes action, lazily creating it
 * first.
 */
private JToggleButton getShowSupertypesButton() {
    if (this.showSupertypesButton == null) {
        this.showSupertypesButton = Options.createToggleButton(new ShowModeAction(false));
    }
    return this.showSupertypesButton;
}
项目:incubator-netbeans    文件:FiltersManagerImpl.java   
/**
 * @return component instance visually representing filters
 */
public JToolBar getComponent(JToggleButton... additionalButtons) {
    if(additionalButtons != null && additionalButtons.length > 0) {
        comp.addAdditionalButtons(additionalButtons);
    }
    return comp.toolbar;
}
项目:incubator-netbeans    文件:FiltersManagerImpl.java   
/**
 * Reactions to toggle button click,
 */
@Override
public void actionPerformed(ActionEvent e) {
    // copy changed state first
    JToggleButton toggle = (JToggleButton) e.getSource();
    int index = toggles.indexOf(e.getSource());
    synchronized (STATES_LOCK) {
        filterStates.put(filtersDesc.getKey(index),
                Boolean.valueOf(toggle.isSelected()));
    }
    // notify
    fireChange();
}
项目:incubator-netbeans    文件:ToggleDebuggingAction.java   
@Override
public Component getToolbarPresenter() {
    toggleButton = new JToggleButton();
    toggleButton.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N
    toggleButton.setIcon((Icon) getValue(SMALL_ICON));
    toggleButton.setAction(this); // this will make hard ref to button => check GC
    return toggleButton;
}
项目:Cognizant-Intelligent-Test-Scripter    文件:ImageORTable.java   
private void init() {

            add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
                    new java.awt.Dimension(10, 0),
                    new java.awt.Dimension(10, 32767)));
            JLabel label = new JLabel("Properties");
            label.setFont(new Font("Default", Font.BOLD, 12));
            add(label);

            add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)));
            toggleImage = new JToggleButton(Utils.getIconByResourceName("/ui/resources/or/image/image"));
            toggleImage.addItemListener(ImageORTable.this);
            toggleImage.setActionCommand("ToggleImage");
            toggleImage.setToolTipText("Show/Hide Image");
            add(toggleImage);

            JButton offset = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/findOffset"));
            offset.addActionListener(ImageORTable.this);
            offset.setToolTipText("Show Offset");
            offset.setActionCommand("Show Offset");
            add(offset);

            JButton findOn = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/findOnScreen"));
            findOn.addActionListener(ImageORTable.this);
            findOn.setToolTipText("Find on Screen");
            findOn.setActionCommand("Find on Screen");
            add(findOn);

            JButton editor = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/propViewer"));
            editor.addActionListener(ImageORTable.this);
            editor.setToolTipText("Show Property Editor");
            editor.setActionCommand("Show Property Editor");
            add(editor);
        }
项目:incubator-netbeans    文件:VariablesViewButtons.java   
public static JToggleButton createShowResultButton() {
    JToggleButton button = createToggleButton(
            SHOW_EVALUTOR_RESULT,
            "org/netbeans/modules/debugger/resources/localsView/show_evaluator_result_16.png",
            NbBundle.getMessage (VariablesViewButtons.class, "Hint_Show_Result")
        );
    button.addActionListener(new ShowResultActionListener(button));
    return button;
}
项目:incubator-netbeans    文件:ToggleHighlightSearchAction.java   
@Override
public Component getToolbarPresenter() {
    JToggleButton b = new MyGaGaButton();
    b.setModel(new HighlightButtonModel());
    b.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N
    b.setAction(this);
    return b;
}
项目:JavaGraph    文件:TypeTree.java   
/**
 * Returns the button for the show-supertypes action, lazily creating it
 * first.
 */
private JToggleButton getShowAllLabelsButton() {
    if (this.showAllLabelsButton == null) {
        this.showAllLabelsButton = Options.createToggleButton(new ShowAllLabelsAction());
    }
    return this.showAllLabelsButton;
}
项目:incubator-netbeans    文件:MetalSlidingButtonUI.java   
public void installDefaults (AbstractButton b) {
       super.installDefaults(b);
if(!defaults_initialized) {
           hiddenToggle = new JToggleButton();
           hiddenToggle.setText("");
           JToolBar bar = new JToolBar();
           bar.setRollover(true);
           bar.add(hiddenToggle);
    defaults_initialized = true;
}
   }
项目:ramus    文件:ScriptReportEditorView.java   
@Override
protected void createButtons(ButtonGroup group) {
    JToggleButton button1 = createOpenViewButton(group, editorView);
    button1.setSelected(true);
    buttonsPanel.add(button1);
    super.createButtons(group);
}
项目:incubator-netbeans    文件:FiltersManager.java   
/** Called only from AWT */
private void initPanel () {
    setBorder(new EmptyBorder(1, 2, 3, 5));

    // configure toolbar
    JToolBar toolbar = new JToolBar(JToolBar.HORIZONTAL);
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setBorderPainted(false);
    // create toggle buttons
    int filterCount = filtersDesc.getFilterCount();
    toggles = new ArrayList<JToggleButton>(filterCount);
    JToggleButton toggleButton = null;

    Map<String,Boolean> fStates = new HashMap<String, Boolean>(filterCount * 2);

    for (int i = 0; i < filterCount; i++) {
        toggleButton = createToggle(fStates, i);
        toggles.add(toggleButton);
    }

    // add toggle buttons
    JToggleButton curToggle;
    Dimension space = new Dimension(3, 0);
    for (int i = 0; i < toggles.size(); i++) {
        curToggle = toggles.get(i);
        curToggle.addActionListener(this);
        toolbar.add(curToggle);
        if (i != toggles.size() - 1) {
            toolbar.addSeparator(space);
        }
    }

    add(toolbar);

    // initialize member states map
    synchronized (STATES_LOCK) {
        filterStates = fStates;
    }
}
项目:incubator-netbeans    文件:FiltersManager.java   
private JToggleButton createToggle (Map<String,Boolean> fStates, int index) {
    boolean isSelected = filtersDesc.isSelected(index);
    Icon icon = filtersDesc.getSelectedIcon(index);
    // ensure small size, just for the icon
    JToggleButton result = new JToggleButton(icon, isSelected);
    Dimension size = new Dimension(icon.getIconWidth() + 6, icon.getIconHeight() + 4);
    result.setPreferredSize(size);
    result.setMargin(new Insets(2,3,2,3));
    result.setToolTipText(filtersDesc.getTooltip(index));

    fStates.put(filtersDesc.getName(index), Boolean.valueOf(isSelected));

    return result;
}
项目:incubator-netbeans    文件:FiltersManager.java   
/** Reactions to toggle button click,  */
public void actionPerformed(ActionEvent e) {
    // copy changed state first
    JToggleButton toggle = (JToggleButton)e.getSource();
    int index = toggles.indexOf(e.getSource());
    synchronized (STATES_LOCK) {
        filterStates.put(filtersDesc.getName(index),
                        Boolean.valueOf(toggle.isSelected()));
    }
    // notify
    fireChange();
}
项目:incubator-netbeans    文件:StatisticsPanel.java   
private JToggleButton newShowButton(String iconId,
                                      String tooltip,
                                      String accessibleName,
                                      Status status) {
    JToggleButton btn = new JToggleButton(ImageUtilities.loadImageIcon(iconId, true));
    btn.setToolTipText(tooltip);
    btn.getAccessibleContext().setAccessibleName(accessibleName);
    btn.setSelected((filterMask & status.getBitMask()) == 0);
    btn.addItemListener(new FilterItemListener(status));
    return btn;
}