Example usage for javax.swing AbstractButton getHorizontalAlignment

List of usage examples for javax.swing AbstractButton getHorizontalAlignment

Introduction

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

Prototype

public int getHorizontalAlignment() 

Source Link

Document

Returns the horizontal alignment of the icon and text.

Usage

From source file:Main.java

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

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