Set title position
import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
public class Main {
public static void main(String[] argv) {
LineBorder border = new LineBorder(Color.red);
TitledBorder titledBorder = BorderFactory.createTitledBorder(border, "Title");
// Or: DEFAULT_POSITION, ABOVE_TOP, TOP, ABOVE_BOTTOM, BOTTOM, BELOW_BOTTOM
titledBorder.setTitlePosition(TitledBorder.BELOW_TOP);
}
}
Related examples in the same category