37

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

OscarRyz
  • 196,001
  • 113
  • 385
  • 569
codegy
  • 2,259
  • 4
  • 25
  • 24

1 Answers1

75

just do this:


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

berlindev
  • 1,753
  • 14
  • 22