Java Utililty Methods Swing Empty Border

List of utility methods to do Swing Empty Border

Description

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

Method

voidaddBorder(JComponent target, Border add)
add Border
addBorder(target, add, false);
voidaddBorderSpaces(JComponent com)
add Border Spaces
com.setBorder(
        BorderFactory.createCompoundBorder(com.getBorder(), BorderFactory.createEmptyBorder(2, 4, 2, 4)));
voidaddEmptyBorder(JComponent c, int i)
add Empty Border
addOuterBorder(c, BorderFactory.createEmptyBorder(i, i, i, i));
BorderaddMarginAndBorder(JComponent component, int margin)
Add a margin and border to a given component
Border marginBorder = BorderFactory.createEmptyBorder(margin, margin, margin, margin);
Border etchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
Border compoundBorder = BorderFactory.createCompoundBorder(etchedBorder, marginBorder);
component.setBorder(compoundBorder);
return compoundBorder;
BorderblankBorder(int top, int left, int bottom, int right)
Get a border consisting of empty space.
return BorderFactory.createEmptyBorder(top, left, bottom, right);
JScrollPaneborderlessScrollPane(final Component component)
Returns a new JScrollPane with the specified component and with an empty border.
JScrollPane pane = new JScrollPane(component);
pane.setBorder(BorderFactory.createEmptyBorder());
return pane;
JComponentbuildInfoPanelEmptyBorderScroll(final JComponent content)
build Info Panel Empty Border Scroll
final JPanel result = new JPanel(new BorderLayout());
result.setBorder(BorderFactory.createEmptyBorder());
final JScrollPane scroll = new JScrollPane(content);
result.add(scroll, BorderLayout.CENTER);
return result;
JComponentbuildPanelEmptyBorder(final JComponent content, final int top, final int left, final int bottom, final int right)
build Panel Empty Border
final JPanel result = new JPanel(new BorderLayout());
result.setBorder(BorderFactory.createEmptyBorder(top, left, bottom, right));
result.add(content, BorderLayout.CENTER);
return result;
JComponentcontentPaneBorder(JComponent component)
content Pane Border
return border(component, 5, TOP | LEFT | BOTTOM | RIGHT);
voidcorrectBorder(final JComponent comp)
Called for each tab panel component that is derived from a JComponent.
if (comp != null) {
    Border border = comp.getBorder();
    if (border == null) {
        border = BorderFactory.createEmptyBorder(7, 7, 7, 7);
    } else if (border instanceof EmptyBorder == false && (border instanceof CompoundBorder == false
            || ((CompoundBorder) border).getOutsideBorder() instanceof EmptyBorder == false)) {
        border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7), border);
    comp.setBorder(border);