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

The following examples show how to use javax.swing.AbstractButton#setOpaque() . 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: QButtonUI.java    From pumpernickel with MIT License 6 votes vote down vote up
@Override
public void installUI(JComponent c) {
	super.installUI(c);
	AbstractButton button = (AbstractButton) c;
	ButtonInfo i = getButtonInfo(button, true);
	button.getModel().addChangeListener(i.buttonStateListener);
	button.addPropertyChangeListener(PROPERTY_BOOLEAN_BUTTON_STATE,
			i.booleanStateListener);
	button.addPropertyChangeListener(PROPERTY_HORIZONTAL_POSITION,
			i.refreshBorderListener);
	button.addPropertyChangeListener(PROPERTY_VERTICAL_POSITION,
			i.refreshBorderListener);
	button.addPropertyChangeListener(PROPERTY_STROKE_PAINTED,
			i.refreshBorderListener);
	button.addPropertyChangeListener(PROPERTY_IS_CIRCLE,
			i.refreshBorderListener);
	button.addKeyListener(focusArrowListener);
	button.setRolloverEnabled(true);
	buttons.add(button);
	button.setOpaque(false);
	button.setMargin(new Insets(0,4,0,4));
}
 
Example 2
Source File: BEButtonUI.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
protected void installDefaults(AbstractButton b) {
		super.installDefaults(b);
		b.setOpaque(false);
		
		if(!defaults_initialized) {
			String pp = getPropertyPrefix();
			dashedRectGapX = UIManager.getInt(pp + "dashedRectGapX");
			dashedRectGapY = UIManager.getInt(pp + "dashedRectGapY");
			dashedRectGapWidth = UIManager.getInt(pp + "dashedRectGapWidth");
			dashedRectGapHeight = UIManager.getInt(pp + "dashedRectGapHeight");
			focusColor = UIManager.getColor(pp + "focus");
			defaults_initialized = true;
		}

//		BEXPStyle xp = BEXPStyle.getXP();
//		if (xp != null) 
		{
			b.setBorder(new XPEmptyBorder(new Insets(3,3,3,3)));//xp.getBorder(b, getXPButtonType(b)));
			LookAndFeel.installProperty(b, "rolloverEnabled", Boolean.TRUE);
		}
	}
 
Example 3
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 4
Source File: IconPackagerButtonBarUI.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
public void installUI(JComponent c) {
  super.installUI(c);

  AbstractButton button = (AbstractButton)c;
  button.setOpaque(false);
  button.setRolloverEnabled(true);
  button.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
}
 
Example 5
Source File: BasicOutlookButtonUI.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
protected void installDefaults(AbstractButton b) {
  super.installDefaults(b);

  b.setRolloverEnabled(true);
  b.setOpaque(false);
  b.setHorizontalTextPosition(JButton.CENTER);
  b.setVerticalTextPosition(JButton.BOTTOM);

  LookAndFeel.installBorder(b, "OutlookButton.border");    
}
 
Example 6
Source File: BasicLinkButtonUI.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
protected void installDefaults(AbstractButton b) {
  super.installDefaults(b);

  b.setOpaque(false);
  b.setBorderPainted(false);
  b.setRolloverEnabled(true);

  dashedRectGapX = UIManager.getInt("ButtonUI.dashedRectGapX");
  dashedRectGapY = UIManager.getInt("ButtonUI.dashedRectGapY");
  dashedRectGapWidth = UIManager.getInt("ButtonUI.dashedRectGapWidth");
  dashedRectGapHeight = UIManager.getInt("ButtonUI.dashedRectGapHeight");
  focusColor = UIManager.getColor("ButtonUI.focus");

  b.setHorizontalAlignment(AbstractButton.LEFT);
}
 
Example 7
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 8
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 9
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 10
Source File: BasicOutlookButtonUI.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
protected void installDefaults(AbstractButton b) {
  super.installDefaults(b);

  b.setRolloverEnabled(true);
  b.setOpaque(false);
  b.setHorizontalTextPosition(JButton.CENTER);
  b.setVerticalTextPosition(JButton.BOTTOM);

  LookAndFeel.installBorder(b, "OutlookButton.border");    
}
 
Example 11
Source File: BlueishButtonBarUI.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
public void installButtonBarUI(AbstractButton button) {
  button.setUI(new BlueishButtonBarButtonUI());
  button.setHorizontalTextPosition(JButton.CENTER);
  button.setVerticalTextPosition(JButton.BOTTOM);
  button.setOpaque(false);
}