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

BordercreateGroupBorder(String title)
create Group Border
return new TitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), title, TitledBorder.LEFT,
        TitledBorder.TOP);
BordercreateGuiElementBorder(final String title)
This method creates a titled border (used for structuring of GUI elements).
final Border titledBorder = BorderFactory.createTitledBorder(
        BorderFactory.createMatteBorder(1, 1, 1, 1, Color.gray), title, TitledBorder.CENTER,
        TitledBorder.DEFAULT_POSITION);
final Border emptyBoder = BorderFactory.createEmptyBorder(0, 2, 0, 2);
return BorderFactory.createCompoundBorder(titledBorder, emptyBoder);
BordercreateInsetTitledBorder(String title)
create Inset Titled Border
return BorderFactory.createCompoundBorder(
        new TitledBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 2), title,
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, BORDER_FONT),
        BorderFactory.createEmptyBorder(5, 5, 5, 5));
BordercreateStyleAttributeBorder(String title)
create Style Attribute Border
Border outer = BorderFactory.createTitledBorder(title);
Border inner = BorderFactory.createEmptyBorder(10, 10, 10, 10);
return BorderFactory.createCompoundBorder(outer, inner);
BordercreateTitleBorder(final String title)
create Title Border
final Border tb = BorderFactory.createTitledBorder(title);
final Border eb = BorderFactory.createEmptyBorder(0, 5, 5, 5);
return BorderFactory.createCompoundBorder(tb, eb);
BordercreateTitledBorder(final String title)
create Titled Border
final Border border;
if (title == null || title.trim().isEmpty()) {
    final Border aquaBorder = isAquaLAF() ? UIManager.getBorder("InsetBorder.aquaVariant") : null;
    border = aquaBorder != null ? aquaBorder : BorderFactory.createTitledBorder("SAMPLE").getBorder();
} else {
    final Border aquaBorder = isAquaLAF() ? UIManager.getBorder("TitledBorder.aquaVariant") : null;
    final TitledBorder tb = aquaBorder != null ? BorderFactory.createTitledBorder(aquaBorder, title)
            : BorderFactory.createTitledBorder(title);
...
BordercreateTitledBorder(String label)
create Titled Border
TitledBorder border = BorderFactory.createTitledBorder(lineBorder, label);
border.setTitleFont(borderFont);
return border;
BordercreateTitledBorder(String name)
Create Titled Border
Border margin = BorderFactory.createEmptyBorder(10, 10, 10, 10);
Border title = BorderFactory.createTitledBorder(name);
return BorderFactory.createCompoundBorder(title, margin);
TitledBordercreateTitledBorder(String title)
This method creates and returns a border.
return createTitledBorder(title, true);
TitledBordercreateTitledBorder(String title)
Creates a Titled Border with appropriate font settings.
TitledBorder border = new TitledBorder(title);
Font font = border.getTitleFont();
Font newFont = new Font(font.getFamily(), Font.BOLD, font.getSize() + 2);
border.setTitleFont(newFont);
border.setTitleColor(new Color(102, 51, 51));
return border;