Example usage for javax.swing JToggleButton setContentAreaFilled

List of usage examples for javax.swing JToggleButton setContentAreaFilled

Introduction

In this page you can find the example usage for javax.swing JToggleButton setContentAreaFilled.

Prototype

@BeanProperty(visualUpdate = true, description = "Whether the button should paint the content area or leave it transparent.")
public void setContentAreaFilled(boolean b) 

Source Link

Document

Sets the contentAreaFilled property.

Usage

From source file:org.revager.tools.GUITools.java

/**
 * Creates a new image toggle button.//from  ww  w  .j  a v a 2  s  .  c  o m
 * 
 * @param icon
 *            the normal icon
 * @param rolloverIcon
 *            the rollover icon
 * @param action
 *            the action
 * 
 * @return the newly created image button
 */
public static JToggleButton newImageToggleButton(ImageIcon icon, ImageIcon rolloverIcon, Action action) {
    JToggleButton button = new JToggleButton(action);
    button.setToolTipText(button.getText());
    button.setText(null);
    button.setContentAreaFilled(false);
    button.setBorder(new EmptyBorder(0, 0, 0, 0));
    button.setMargin(new Insets(0, 0, 0, 0));
    button.setBorderPainted(false);
    button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    button.setFocusPainted(false);
    button.setFocusable(false);

    button.setIcon(icon);
    button.setRolloverIcon(rolloverIcon);
    button.setRolloverSelectedIcon(rolloverIcon);
    button.setSelectedIcon(rolloverIcon);

    return button;
}

From source file:org.revager.tools.GUITools.java

/**
 * Creates a new image toggle button./*w  w w  .  j a v  a2  s  .  com*/
 * 
 * @return the newly created image toggle button
 */
public static JToggleButton newImageToggleButton() {
    JToggleButton button = new JToggleButton();

    button.setBorder(new EmptyBorder(2, 2, 2, 8));
    button.setMargin(new Insets(0, 0, 0, 0));
    button.setBorderPainted(false);
    button.setOpaque(false);
    button.setContentAreaFilled(false);
    button.setFocusable(false);
    button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    return button;
}