Java Utililty Methods Swing LineBorder

List of utility methods to do Swing LineBorder

Description

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

Method

BordergetLineBorder()
get an outlined border
return BorderFactory.createLineBorder(Color.gray);
BordergetMandatoryBorder()
Lazily creates and returns a Border instance that is used to indicate that a component's content is mandatory.
if (mandatoryBorder == null) {
    mandatoryBorder = new CompoundBorder(new LineBorder(getMandatoryForeground()),
            new BasicBorders.MarginBorder());
return mandatoryBorder;
BordergetToolTipBorder()
Returns the border used by tool tips in this look and feel.
Border border = UIManager.getBorder("ToolTip.border");
if (border == null || isNimbusLookAndFeel()) {
    border = UIManager.getBorder("nimbusBorder");
    if (border == null) {
        border = BorderFactory.createLineBorder(SystemColor.controlDkShadow);
return border;
...
BorderintToBorder(int borderConstant)
int To Border
switch (borderConstant) {
case EMPTY_BORDER: {
    return new EmptyBorder(0, 0, 0, 0);
case BLACK_LINE_SQUARE_BORDER: {
    return new LineBorder(Color.black, 3, false);
case BLACK_LINE_THIN_SQUARE_BORDER: {
...
booleanisAtScrollPaneRightBorder(Component c, int x)
is At Scroll Pane Right Border
JScrollPane sp = (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class, c);
if (sp != null) {
    int localX = SwingUtilities.convertPoint(c, x, 0, sp).x;
    if (localX + 1 == sp.getWidth()) {
        return true;
return false;
...
voidlineBorder(JComponent comp)
line Border
comp.setBorder(BorderFactory.createLineBorder(Color.BLUE));
voidrecursiveAddBorderToPanel(JComponent c)
recursive Add Border To Panel
if (c instanceof JPanel) {
    JPanel panel = (JPanel) c;
    panel.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLUE), panel.getName()));
    for (Component ch : panel.getComponents()) {
        if (ch instanceof JComponent) {
            recursiveAddBorderToPanel((JComponent) ch);
voidsetBorder(JComponent comp)
set Border
setBorder(comp, RAISED_BORDER);
JComponentsetBorder(JComponent comp, boolean setBorder)
set Border
return setBorder(comp, setBorder, BorderColor);
voidsetBorder(JComponent component, int width)
Set a border with the specified width to the swing component.
component.setBorder(BorderFactory.createLineBorder(component.getBackground(), width));