Java Code Examples for javax.swing.AbstractButton#setContentAreaFilled()

The following examples show how to use javax.swing.AbstractButton#setContentAreaFilled() . 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: TransparentToolBar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void refresh(final AbstractButton b) {
    b.setBackground(UIUtils.getProfilerResultsBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
Example 2
Source File: SearchButton.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static void removeButtonContentAreaAndBorder(AbstractButton button) {
    boolean canRemove = true;
    if (button instanceof JToggleButton) {
        canRemove = !button.isSelected();
    }
    if (canRemove) {
        button.setContentAreaFilled(false);
        button.setBorderPainted(false);
    }
}
 
Example 3
Source File: SearchButton.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void mouseEntered(MouseEvent evt) {
    Object src = evt.getSource();

    if (src instanceof AbstractButton) {
        AbstractButton button = (AbstractButton) evt.getSource();
        if (button.isEnabled()) {
            button.setContentAreaFilled(true);
            button.setBorderPainted(true);
        }
    }
}
 
Example 4
Source File: NbEditorToolBar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public @Override void mouseEntered(MouseEvent evt) {
    Object src = evt.getSource();
    
    if (src instanceof AbstractButton) {
        AbstractButton button = (AbstractButton)evt.getSource();
        if (button.isEnabled()) {
            button.setContentAreaFilled(true);
            button.setBorderPainted(true);
        }
    }
}
 
Example 5
Source File: NbEditorToolBar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static void removeButtonContentAreaAndBorder(AbstractButton button) {
    boolean canRemove = true;
    if (button instanceof JToggleButton) {
        canRemove = !button.isSelected();
    }
    if (canRemove) {
        button.setContentAreaFilled(false);
        button.setBorderPainted(false);
    }
}
 
Example 6
Source File: DataViewUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void mouseEntered(MouseEvent evt) {
    Object src = evt.getSource();

    if (src instanceof AbstractButton) {
        AbstractButton button = (AbstractButton) evt.getSource();
        if (button.isEnabled()) {
            button.setContentAreaFilled(true);
            button.setBorderPainted(true);
        }
    }
}
 
Example 7
Source File: DataViewUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void mouseExited(MouseEvent evt) {
    Object src = evt.getSource();
    if (src instanceof AbstractButton) {
        AbstractButton button = (AbstractButton) evt.getSource();
        button.setContentAreaFilled(false);
        button.setBorderPainted(false);
    }
}
 
Example 8
Source File: DataViewUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void processButton(AbstractButton button) {
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setMargin(BUTTON_INSETS);
    if (button instanceof AbstractButton) {
        button.addMouseListener(sharedMouseListener);
    }
    //Focus shouldn't stay in toolbar
    button.setFocusable(false);
}
 
Example 9
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void refresh(final AbstractButton b) {
    b.setBackground(UIUtils.getProfilerResultsBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
Example 10
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void refresh(final AbstractButton b) {
    b.setBackground(UISupport.getDefaultBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
Example 11
Source File: NavigationButtons.java    From pumpernickel with MIT License 5 votes vote down vote up
public static void formatPrev(AbstractButton button) {
	button.setIcon(createIcon(false, .75f));
	button.setRolloverIcon(createIcon(false, .85f));
	button.setSelectedIcon(createIcon(false, 1f));
	button.setDisabledIcon(createIcon(false, .3f));
	button.setUI(new BevelButtonUI());
	button.setContentAreaFilled(true);
	button.putClientProperty("JButton.segmentPosition", "first");
	button.setBorderPainted(true);
}
 
Example 12
Source File: NavigationButtons.java    From pumpernickel with MIT License 5 votes vote down vote up
public static void formatNext(AbstractButton button) {
	button.setIcon(createIcon(true, .75f));
	button.setRolloverIcon(createIcon(true, .85f));
	button.setSelectedIcon(createIcon(true, 1f));
	button.setDisabledIcon(createIcon(true, .3f));
	button.setUI(new BevelButtonUI());
	button.setContentAreaFilled(true);
	button.putClientProperty("JButton.segmentPosition", "last");
	button.setBorderPainted(true);
}
 
Example 13
Source File: SwingUtil.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void removeButtonDecorations(AbstractButton button)
{
	button.setBorderPainted(false);
	button.setContentAreaFilled(false);
	button.setFocusPainted(false);
	button.setMargin(new Insets(0, 0, 0, 0));
	button.setOpaque(false);
}
 
Example 14
Source File: TGToolBar.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
private AbstractButton getImageButton( AbstractButton button, String iconPrefix, String iconSuffix ){
	button.setHorizontalTextPosition(JButton.CENTER);
	button.setVerticalTextPosition(JButton.CENTER);
	button.setBorderPainted( false );
	button.setContentAreaFilled( false );
	button.setFocusPainted( false );
	button.setMargin( new Insets(0,0,0,0) );
	button.setIcon( TGResourceUtils.loadIcon( iconPrefix + iconSuffix ) );
	button.setPressedIcon( TGResourceUtils.loadIcon( iconPrefix + "_pressed" + iconSuffix ) );
	button.setRolloverIcon( TGResourceUtils.loadIcon( iconPrefix + "_over" + iconSuffix ) );
	button.setSelectedIcon( TGResourceUtils.loadIcon( iconPrefix + "_selected" + iconSuffix ) );
	button.setRolloverSelectedIcon( TGResourceUtils.loadIcon( iconPrefix + "_selected_over" + iconSuffix ) );
	return button;
}
 
Example 15
Source File: LargeNavigationPanelUI.java    From pumpernickel with MIT License 4 votes vote down vote up
protected void format(AbstractButton button) {
	button.setBorderPainted(false);
	button.setContentAreaFilled(false);
	button.setUI(new BasicButtonUI());
}