Example usage for javax.swing AbstractButton getHorizontalTextPosition

List of usage examples for javax.swing AbstractButton getHorizontalTextPosition

Introduction

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

Prototype

public int getHorizontalTextPosition() 

Source Link

Document

Returns the horizontal position of the text relative to the icon.

Usage

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");
    System.out.println(jb.getHorizontalTextPosition());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);/* ww  w.  java2 s .c o  m*/
    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 v a 2  s .co m*/
    return layoutComponent(b, b.getText(), icon, b.getIconTextGap(), b.getVerticalAlignment(),
            b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect,
            iconRect, textRect);
}