Java Utililty Methods Swing TitledBorder

List of utility methods to do Swing TitledBorder

Description

The list of methods to do Swing TitledBorder are organized into topic(s).

Method

BordermyBorder(String title)
my Border
return BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title, TitledBorder.LEFT,
        TitledBorder.LEFT, fnt_label1, new Color(25, 25, 250));
voidsetBoldTitledBorder(String title, JComponent p)
Formats and sets the title border of the passed component.
if (title == null)
    title = "";
if (p == null)
    return;
TitledBorder border = new TitledBorder(title);
border.setTitleFont(p.getFont().deriveFont(Font.BOLD));
p.setBorder(border);
voidsetBorder(Container panel, String title)
set Border
if (panel instanceof JPanel) {
    ((JPanel) panel).setBorder(BorderFactory.createTitledBorder(title));
voidsetBorder(JComponent component, String text, int titleJustification)
set Border
component.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), text,
        titleJustification, TitledBorder.TOP));
voidsetLabelBorder(String label, JComponent c)
set Label Border
TitledBorder b = new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), label);
b.setTitleColor(darkBlue);
c.setBorder(b);
voidsetPanelBorder(final JPanel p, final String s)
Set Border of JPanel.
p.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(s),
        BorderFactory.createEmptyBorder(5, 5, 5, 5)));
voidsetTitleBorder(JComponent pane, String title)
set Title Border
if (title != null) {
    pane.setBorder(
            new TitledBorder(new LineBorder(Color.BLACK), title, TitledBorder.LEFT, TitledBorder.TOP));
} else {
    pane.setBorder(new LineBorder(Color.BLACK));
BtitledBorder(String title, B comp)
titled Border
comp.setBorder(BorderFactory.createTitledBorder(title));
return comp;
JPanelwithTitledBorder(String title, JComponent c)
Place content within a titled border
JPanel p = new JPanel(new GridLayout(1, 1));
p.setBorder(BorderFactory.createTitledBorder(title));
p.add(c);
return p;