Example usage for javax.swing AbstractButton setHorizontalAlignment

List of usage examples for javax.swing AbstractButton setHorizontalAlignment

Introduction

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

Prototype

@BeanProperty(visualUpdate = true, enumerationValues = { "SwingConstants.LEFT", "SwingConstants.CENTER",
        "SwingConstants.RIGHT", "SwingConstants.LEADING",
        "SwingConstants.TRAILING" }, description = "The horizontal alignment of the icon and text.")
public void setHorizontalAlignment(int alignment) 

Source Link

Document

Sets the horizontal alignment of the icon and text.

Usage

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setHorizontalAlignment(SwingConstants.RIGHT);
    jb.setIcon(new MyIcon());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);/*from ww w .j  a  v  a 2 s  . c  o m*/
    f.pack();
    f.setVisible(true);
}

From source file:org.zeromeaner.gui.reskin.StandaloneFrame.java

private static void add(JToolBar toolbar, ButtonGroup g, AbstractButton b) {
    b.setFocusable(false);//from  w  w  w  .j  a  va  2  s.  co  m
    b.setBorder(null);
    b.setHorizontalAlignment(SwingConstants.LEFT);
    toolbar.add(b);
    if (g != null)
        g.add(b);
}