Java JButton renderImageOnly(JButton button)

Here you can find the source of renderImageOnly(JButton button)

Description

Changes style formatting of a button so that only the images will show; no additional drawing.

License

Open Source License

Parameter

Parameter Description
the button to remove formatting to

Declaration

public static void renderImageOnly(JButton button) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.JButton;

public class Main {
    /**// w  w  w.j  ava  2s .  co  m
     * 
     * Changes style formatting of a button so that only the images will show; no additional drawing. This
     * modifies the passed button. This does not affect the button size or actually assigns images. It just
     * removes the extra drawing so the button only draws the image and not other buttony thingies the OS
     * would normally draw.
     * 
     * @param
     *       the button to remove formatting to
     * 
     */
    public static void renderImageOnly(JButton button) {
        button.setBorderPainted(false);
        button.setContentAreaFilled(false);
        button.setFocusPainted(false);
        button.setOpaque(false);
    }
}

Related

  1. reduceNimbusButtonMargin(final JButton button)
  2. registerCancelButton(final JButton cancelButton)
  3. removeAllActionListeners(JButton button)
  4. removeAllListeners(JButton bouton)
  5. removeMargins(JButton button)
  6. setButtonNo(JButton anButton)
  7. setCancelButton(final JRootPane rp, final JButton b)
  8. setEmptyBorder(JButton button, int paddingTop, int paddingLeft, int paddingBottom, int paddingRight)
  9. setEnable(boolean b, JButton... bs)