Example usage for javax.swing AbstractButton getVerticalTextPosition

List of usage examples for javax.swing AbstractButton getVerticalTextPosition

Introduction

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

Prototype

public int getVerticalTextPosition() 

Source Link

Document

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

Usage

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setSelected(true);/*w ww.ja  v a 2  s.  c o m*/
    System.out.println(jb.getVerticalTextPosition());

    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) {// w w w.j  av a2 s .com
    return layoutComponent(b, b.getText(), icon, b.getIconTextGap(), b.getVerticalAlignment(),
            b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect,
            iconRect, textRect);
}