TitledBorder.ABOVE_BOTTOM
import java.awt.Container;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.border.TitledBorder;
public class MainClass {
public static void main(final String args[]) {
JFrame frame = new JFrame("Positioned Titled Borders");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
TitledBorder aboveBottomBorder = BorderFactory.createTitledBorder("AboveBottom");
aboveBottomBorder.setTitlePosition(TitledBorder.ABOVE_BOTTOM);
JButton aboveBottomButton = new JButton();
aboveBottomButton.setBorder(aboveBottomBorder);
Container contentPane = frame.getContentPane();
contentPane.add(aboveBottomButton);
frame.setSize(300, 200);
frame.setVisible(true);
}
}
Related examples in the same category