Use the JButton classes setVerticalTextPosition() and setHorizontalTextPosition() methods to control the text positioning.
JButton button = new JButton("Press Me", icon);
// Text below image
button.setVerticalTextPosition(SwingConstants.BOTTOM);
// And centred
button.setHorizontalTextPosition(SwingConstants.CENTER);
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment