Java Code Examples for javax.swing.JToggleButton#setBorderPainted()

The following examples show how to use javax.swing.JToggleButton#setBorderPainted() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FiltersManagerImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private JToggleButton createToggle(Map<String, Boolean> fStates, int index) {
            boolean isSelected = filtersDesc.isSelected(index);
            boolean enabled = filtersDesc.isEnabled(index);
            Icon icon = filtersDesc.getIcon(index);
            // ensure small size, just for the icon
            JToggleButton result = new JToggleButton(icon, enabled && isSelected);
            Dimension size = new Dimension(21, 21); // 3 less than other buttons
            result.setMaximumSize(size);
            result.setMinimumSize(size);
            result.setPreferredSize(size);
            if ("Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
                result.setBorderPainted(true);
            } else {
                result.setBorderPainted(false);
            }
//            result.setMargin(new Insets(2, 3, 2, 3));
            result.setToolTipText(filtersDesc.getTooltip(index));
            result.setEnabled(enabled);
            fStates.put(filtersDesc.getKey(index), Boolean.valueOf(isSelected));

            return result;
        }
 
Example 2
Source File: ActionFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example 3
Source File: PaletteUI.java    From pumpernickel with MIT License 5 votes vote down vote up
private JToggleButton createCell() {
	JToggleButton newCell = new JToggleButton();
	newCell.addMouseListener(mouseListener);
	newCell.addMouseMotionListener(mouseListener);
	newCell.setContentAreaFilled(false);
	newCell.setBorder(null);
	newCell.setRequestFocusEnabled(false);
	newCell.setBorderPainted(false);
	newCell.setOpaque(false);
	newCell.putClientProperty(PROPERTY_CELL, Boolean.TRUE);
	newCell.addActionListener(cellActionListener);
	return newCell;
}
 
Example 4
Source File: TableCellUtilities.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
ToggleButtonRenderer(JToggleButton button)
{
	this.button = button;
	button.setHorizontalAlignment(SwingConstants.CENTER);
	button.setBorderPainted(true);
	setLayout(new GridLayout(1, 1));
	add(button);
}
 
Example 5
Source File: Toolbar.java    From android-classyshark with Apache License 2.0 5 votes vote down vote up
private JToggleButton buildLeftPanelToggleButton() {
    final ImageIcon toggleIcon = theme.getToggleIcon();
    final JToggleButton jToggleButton = new JToggleButton(toggleIcon, true);
    jToggleButton.setToolTipText("Show/hide navigation tree");
    jToggleButton.setBorderPainted(false);
    jToggleButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            toolbarController.onChangeLeftPaneVisibility(jToggleButton.isSelected());
        }
    });
    return jToggleButton;
}
 
Example 6
Source File: HorizontalList.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
protected JToggleButton createButton(String label) {
    JToggleButton button = new DeletableToggle(label, getIconImage(label));
    button.setToolTipText(label);
    button.setRolloverEnabled(true);
    //button.setI
    button.setHorizontalAlignment(SwingConstants.LEFT);
    button.setBorderPainted(ResourceEditorApp.IS_MAC);
    return button;
}
 
Example 7
Source File: TableCellUtilities.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
ToggleButtonRenderer(JToggleButton button)
{
	this.button = button;
	button.setHorizontalAlignment(SwingConstants.CENTER);
	button.setBorderPainted(true);
	setLayout(new GridLayout(1, 1));
	add(button);
}