Swing JButton: Icon above Text

codegy picture codegy · Dec 10, 2008 · Viewed 17.9k times · Source

How can I create a JButton in Swing with the icon above the text?

Answer

berlindev picture berlindev · Dec 10, 2008

just do this:


    button.setVerticalTextPosition(SwingConstants.BOTTOM);
    button.setHorizontalTextPosition(SwingConstants.CENTER);