AbstractButton.getHorizontalAlignment() has the following syntax.
public int getHorizontalAlignment()
In the following code shows how to use AbstractButton.getHorizontalAlignment() method.
import javax.swing.AbstractButton; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingConstants; //from www .jav a 2s.c om public class Main { 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); f.pack(); f.setVisible(true); } }