Example usage for javax.swing AbstractButton getIconTextGap

List of usage examples for javax.swing AbstractButton getIconTextGap

Introduction

In this page you can find the example usage for javax.swing AbstractButton getIconTextGap.

Prototype

public int getIconTextGap() 

Source Link

Document

Returns the amount of space between the text and the icon displayed in this button.

Usage

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setSelected(true);/*from ww  w . j a  va2  s. c  om*/
    System.out.println(jb.getIconTextGap());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static String layoutCustomButton(AbstractButton b, Icon icon, Rectangle viewRect, Rectangle iconRect,
        Rectangle textRect) {/*from  w  ww  .j a  va2s  .  c om*/
    return layoutComponent(b, b.getText(), icon, b.getIconTextGap(), b.getVerticalAlignment(),
            b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect,
            iconRect, textRect);
}