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

voidaddMarginBorder(JPanel panel, String title, int top, int left, int bottom, int right)
add Margin Border
Border border = BorderFactory.createTitledBorder(title);
Border marginBorder = new EmptyBorder(top, left, bottom, right);
panel.setBorder(new CompoundBorder(marginBorder, border));
voidborderTitle(JComponent component, String title)
border Title
component.setBorder(BorderFactory.createTitledBorder(title));
JComponentbuildInfoPanelTextBorder(final JLabel content, final String title)
build Info Panel Text Border
content.setHorizontalAlignment(SwingConstants.CENTER);
content.setVerticalAlignment(SwingConstants.CENTER);
content.setOpaque(true);
return buildInfoPanelTextBorder((JComponent) content, title);
JComponentbuildInfoPanelTextBorderScroll(final JComponent content, final String title)
build Info Panel Text Border Scroll
final JPanel result = new JPanel(new BorderLayout());
result.setBorder(BorderFactory.createTitledBorder(title));
final JScrollPane scroll = new JScrollPane(content);
result.add(scroll, BorderLayout.CENTER);
return result;
BorderbuildLabeledBorder(String label)
build Labeled Border
TitledBorder ret = new TitledBorder(new EtchedBorder(), label);
return ret;
BordercreateBorder()
create Border
return BorderFactory.createEmptyBorder(4, 4, 4, 4);
BordercreateBorder(String message)
Default look and feel titled border used in all interfaces.
return new TitledBorder(new EtchedBorder(), message, 1, 2, messageTextFont);
BordercreateBorder(String title)
Creates titled JPanel Borders
return BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title);
BordercreateBorder(String title)
create Border
return BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3),
        BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(title),
                BorderFactory.createEmptyBorder(2, 2, 2, 2)));
JPanelcreateBorderedPanel(String title, int margin)
Create a bordered panel.
final JPanel panel = new JPanel();
final Border outside = BorderFactory.createTitledBorder(title);
final Border inside = BorderFactory.createEmptyBorder(margin, margin, margin, margin);
panel.setBorder(BorderFactory.createCompoundBorder(outside, inside));
return panel;