javax.swing

Class BorderFactory


public class BorderFactory
extends Object

Factory class for vending standard Border objects. Wherever possible, this factory will hand out references to shared Border instances. For further information and examples see How to Use Borders, a section in The Java Tutorial.

Method Summary

static Border
createBevelBorder(int type)
Creates a beveled border of the specified type, using brighter shades of the component's current background color for highlighting, and darker shading for shadows.
static Border
createBevelBorder(int type, Color highlight, Color shadow)
Creates a beveled border of the specified type, using the specified highlighting and shadowing.
static Border
createBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner)
Creates a beveled border of the specified type, using the specified colors for the inner and outer highlight and shadow areas.
static CompoundBorder
createCompoundBorder()
Creates a compound border with a null inside edge and a null outside edge.
static CompoundBorder
createCompoundBorder(Border outsideBorder, Border insideBorder)
Creates a compound border specifying the border objects to use for the outside and inside edges.
static Border
createEmptyBorder()
Creates an empty border that takes up no space.
static Border
createEmptyBorder(int top, int left, int bottom, int right)
Creates an empty border that takes up space but which does no drawing, specifying the width of the top, left, bottom, and right sides.
static Border
createEtchedBorder()
Creates a border with an "etched" look using the component's current background color for highlighting and shading.
static Border
createEtchedBorder(int type)
Creates a border with an "etched" look using the component's current background color for highlighting and shading.
static Border
createEtchedBorder(int type, Color highlight, Color shadow)
Creates a border with an "etched" look using the specified highlighting and shading colors.
static Border
createEtchedBorder(Color highlight, Color shadow)
Creates a border with an "etched" look using the specified highlighting and shading colors.
static Border
createLineBorder(Color color)
Creates a line border withe the specified color.
static Border
createLineBorder(Color color, int thickness)
Creates a line border with the specified color and width.
static Border
createLoweredBevelBorder()
Creates a border with a lowered beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows.
static MatteBorder
createMatteBorder(int top, int left, int bottom, int right, Color color)
Creates a matte-look border using a solid color.
static MatteBorder
createMatteBorder(int top, int left, int bottom, int right, Icon tileIcon)
Creates a matte-look border that consists of multiple tiles of a specified icon.
static Border
createRaisedBevelBorder()
Creates a border with a raised beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows.
static TitledBorder
createTitledBorder(String title)
Creates a new title border specifying the text of the title, using the default border (etched), using the default text position (sitting on the top line) and default justification (leading) and using the default font and text color determined by the current look and feel.
static TitledBorder
createTitledBorder(Border border)
Creates a new title border with an empty title specifying the border object, using the default text position (sitting on the top line) and default justification (leading) and using the default font, and text color.
static TitledBorder
createTitledBorder(Border border, String title)
Adds a title to an existing border, specifying the text of the title, using the default positioning (sitting on the top line) and default justification (leading) and using the default font and text color determined by the current look and feel.
static TitledBorder
createTitledBorder(Border border, String title, int titleJustification, int titlePosition)
Adds a title to an existing border, specifying the text of the title along with its positioning, using the default font and text color determined by the current look and feel.
static TitledBorder
createTitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont)
Adds a title to an existing border, specifying the text of the title along with its positioning and font, using the default text color determined by the current look and feel.
static TitledBorder
createTitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont, Color titleColor)
Adds a title to an existing border, specifying the text of the title along with its positioning, font, and color.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Details

createBevelBorder

public static Border createBevelBorder(int type)
Creates a beveled border of the specified type, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a lowered border, shadows are on top and highlights are underneath.)
Parameters:
type - an integer specifying either BevelBorder.LOWERED or BevelBorder.RAISED
Returns:
the Border object
Usages and Demos :

View More Examples of createBevelBorder(int type)
   1:       valuePanel.setToolTipText("Click here to change the color");
   2:       valuePanel.setBorder(BorderFactory.createCompoundBorder(
   3:         ...
   4:       BorderFactory.createLineBorder(Color.black),
   5:         ...
   6:       BorderFactory.createBevelBorder(BevelBorder.RAISED)));
   7:       valuePanel.setMaximumSize(colorPanelDim);
   8:         ...
   9:       
  10:       setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

View Full Code Here
   1: import javax.swing.JPanel;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.border.Border;
   4: import javax.swing.border.TitledBorder;
   5: import javax.swing.border.EtchedBorder;

View Full Code Here
   1: import javax.swing.BoxLayout;
   2: import javax.swing.BorderFactory;
   3: 
   4: import java.awt.Toolkit;
   5: import java.awt.Dimension;

View Full Code Here
   1:       orientPanel = new BooleanValuePanel("Vertical", "Horizontal", true);
   2:       orientPanel.setBorder(BorderFactory.createTitledBorder(
   3:         ...
   4:       BorderFactory.createBevelBorder(BevelBorder.LOWERED), "Orientation",
   5:       TitledBorder.LEFT, TitledBorder.TOP));
   6:         ...
   7: 
   8:       Border innerBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED);
   9:         ...
  10:       Border outerBorder = BorderFactory.createEmptyBorder(8,2,2,2);

View Full Code Here
   1:     JPanel spanSortPanel = new JPanel();
   2:     spanSortPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
   3:     spanSortPanel.add(spanPanel);
   4:         ...
   5:     stackedPanel = new BooleanValuePanel("Adjacent", "Stacked", false);
   6:     stackedPanel.setBorder(BorderFactory.createTitledBorder(
   7:         ...
   8:       BorderFactory.createBevelBorder(BevelBorder.LOWERED), "Stacking",
   9:       TitledBorder.LEFT, TitledBorder.TOP));
  10:         ...
  11:     horizPanel = new BooleanValuePanel("Vertical", "Horizontal", false);
  12:     horizPanel.setBorder(BorderFactory.createTitledBorder(

View Full Code Here

createBevelBorder

public static Border createBevelBorder(int type,
                                       Color highlight,
                                       Color shadow)
Creates a beveled border of the specified type, using the specified highlighting and shadowing. The outer edge of the highlighted area uses a brighter shade of the highlight color. The inner edge of the shadow area uses a brighter shade of the shadow color.
Parameters:
type - an integer specifying either BevelBorder.LOWERED or BevelBorder.RAISED
highlight - a Color object for highlights
shadow - a Color object for shadows
Returns:
the Border object
Usages and Demos :

View More Examples of createBevelBorder(int type,Color highlight,Color shadow)
   1:         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   2:         Border raisedBorder = BorderFactory.createRaisedBevelBorder();
   3:         ...
   4:         Border loweredBorder = BorderFactory.createLoweredBevelBorder();
   5:         ...
   6:         Border myRaisedBorder =  BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.PINK, Color.RED);
   7:         ...
   8:         Border myLoweredBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.PINK, Color.RED);

View Full Code Here
   1: import java.awt.event.MouseEvent;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JComponent;
   4:         ...
   5:                 if (borderPainted && isEnabled())
   6:                     setBorder(BorderFactory.createLoweredBevelBorder());
   7:             }
   8:         ...
   9:         if (BLACK.equals(color))
  10:             setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED, LIGHT_GRAY, GRAY));
  11:         else
  12:         ...
  13:             setBorder(BorderFactory.createRaisedBevelBorder());

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.Box;
   4:         ...
   5:         graphPanel = new JPanel();
   6:         graphPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.lightGray, Color.darkGray));
   7:         graphPanel.add(graph);
   8:         graphPanel.setBackground(Color.white);
   9:         return graphPanel;

View Full Code Here
   1: import java.util.Map;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JComponent;
   4:         ...
   5:             borderColor = WHITE;
   6:         component.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED, borderColor, borderColor));
   7: 
   8:         ...
   9:             if ((flags & BEVEL_BORDER) != 0) {
  10:                 JComponent.class.cast(info.component).setBorder(BorderFactory.createRaisedBevelBorder());
  11:             }
  12:         ...
  13:                         Color darker = fg.darker();
  14:                         JComponent.class.cast(i.component).setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED, brighter.brighter(), brighter, darker.darker(), darker));

View Full Code Here

createBevelBorder

public static Border createBevelBorder(int type,
                                       Color highlightOuter,
                                       Color highlightInner,
                                       Color shadowOuter,
                                       Color shadowInner)
Creates a beveled border of the specified type, using the specified colors for the inner and outer highlight and shadow areas.

Note: The shadow inner and outer colors are switched for a lowered bevel border.

Parameters:
type - an integer specifying either BevelBorder.LOWERED or BevelBorder.RAISED
highlightOuter - a Color object for the outer edge of the highlight area
highlightInner - a Color object for the inner edge of the highlight area
shadowOuter - a Color object for the outer edge of the shadow area
shadowInner - a Color object for the inner edge of the shadow area
Returns:
the Border object

createCompoundBorder

public static CompoundBorder createCompoundBorder()
Creates a compound border with a null inside edge and a null outside edge.
Returns:
the CompoundBorder object

createCompoundBorder

public static CompoundBorder createCompoundBorder(Border outsideBorder,
                                                  Border insideBorder)
Creates a compound border specifying the border objects to use for the outside and inside edges.
Parameters:
outsideBorder - a Border object for the outer edge of the compound border
insideBorder - a Border object for the inner edge of the compound border
Returns:
the CompoundBorder object
Usages and Demos :

View More Examples of createCompoundBorder(Border outsideBorder,Border insideBorder)
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JCheckBox;
   4:         ...
   5:     private Border createBorder() {
   6:         Border b1 = BorderFactory.createEmptyBorder(10, 10, 10, 10);
   7:         ...
   8:         Border b2 = BorderFactory.createEtchedBorder();
   9:         ...
  10:         Border b3 = BorderFactory.createCompoundBorder(b1, b2);

View Full Code Here
   1: 
   2:     button.setBorder(BorderFactory.createRaisedBevelBorder());
   3:     container.add(button, "South");
   4:         ...
   5:     {
   6:     Border raisedbevel = BorderFactory.createRaisedBevelBorder();
   7:         ...
   8:     Border loweredbevel = BorderFactory.createLoweredBevelBorder();
   9:     
  10:         ...
  11:     return
  12:         BorderFactory.createCompoundBorder(raisedbevel, loweredbevel);

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JComponent;
   4:         ...
   5:     windowPanel.setBorder(
   6:       BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black, 1),
   7:         ...
   8:                                          BorderFactory.createEmptyBorder(1,1,1,1)));
   9: 
  10:         ...
  11:     progressBar.setStringPainted(true);
  12:     progressBar.setBorder(BorderFactory.createLoweredBevelBorder());

View Full Code Here
   1:     private Border createBorder() {
   2:     Border raisedbevel = BorderFactory.createRaisedBevelBorder();
   3:         ...
   4:     Border loweredbevel = BorderFactory.createLoweredBevelBorder();
   5:     
   6:         ...
   7:     return
   8:         BorderFactory.createCompoundBorder(raisedbevel, loweredbevel);
   9:     }

View Full Code Here
   1:     public static Border createBorder() {
   2:     Border raisedbevel = BorderFactory.createRaisedBevelBorder();
   3:         ...
   4:     Border loweredbevel = BorderFactory.createLoweredBevelBorder();
   5:     
   6:         ...
   7:     return
   8:         BorderFactory.createCompoundBorder(raisedbevel, loweredbevel);
   9:     }

View Full Code Here

createEmptyBorder

public static Border createEmptyBorder()
Creates an empty border that takes up no space. (The width of the top, bottom, left, and right sides are all zero.)
Returns:
the Border object
Usages and Demos :

View More Examples of createEmptyBorder()
   1:         foldTools.setOpaque(false) ;
   2:         foldTools.setBorder(BorderFactory.createEmptyBorder()) ;
   3:         
   4:         ...
   5:         JButton but = foldTools.add(a) ;
   6:         but.setBorder(BorderFactory.createEmptyBorder()) ;
   7:         but.setMargin(new Insets(1,1,1,1)) ;
   8:     }
   9:     

View Full Code Here
   1: 
   2:       label.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
   3: 
   4:         ...
   5:       button.setBorder(BorderFactory.createEmptyBorder());
   6:       button.setFont(desktopIcon.getFont());
   7:       button.setBackground(desktopIcon.getBackground());
   8:       button.setForeground(desktopIcon.getForeground());

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JComponent;
   4:         ...
   5:   public final static Border PANEL_BORDER =
   6:     BorderFactory.createEmptyBorder(3, 3, 3, 3);
   7:   
   8:         ...
   9:   public final static Border WINDOW_BORDER =
  10:     BorderFactory.createEmptyBorder(4, 10, 10, 10);
  11: 
  12:         ...
  13:   public final static Border EMPTY_BORDER =
  14:       BorderFactory.createEmptyBorder();

View Full Code Here
   1:             JLabel label = new JLabel(title);
   2:             label.setBorder(BorderFactory.createEmptyBorder());
   3:             titleBar.add(label);
   4:         ...
   5:             JButton button = titleBar.add(undock);
   6:             button.setBorder(BorderFactory.createEmptyBorder());
   7:         }
   8: 
   9:         private ImageIcon getIcon(String name) {

View Full Code Here
   1:     panel.add(new JLabel("Blogging tools written in Java", SwingConstants.CENTER), BorderLayout.SOUTH);
   2:     panel.setBorder(BorderFactory.createEmptyBorder());
   3:     panel.setBackground(Color.WHITE);
   4: 
   5:     return panel;

View Full Code Here

createEmptyBorder

public static Border createEmptyBorder(int top,
                                       int left,
                                       int bottom,
                                       int right)
Creates an empty border that takes up space but which does no drawing, specifying the width of the top, left, bottom, and right sides.
Parameters:
top - an integer specifying the width of the top, in pixels
left - an integer specifying the width of the left side, in pixels
bottom - an integer specifying the width of the bottom, in pixels
right - an integer specifying the width of the right side, in pixels
Returns:
the Border object
Usages and Demos :

View More Examples of createEmptyBorder(int top,int left,int bottom,int right)
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JPanel;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createTitledBorder("History"), 
   9:         ...
  10:                 BorderFactory.createEmptyBorder(0,0,0,0)));    

View Full Code Here
   1:     mainPanel.setLayout(new GridLayout(2,1,5,5));
   2:     mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
   3: 
   4:         ...
   5:     phaseIconLabel.setHorizontalTextPosition(JLabel.CENTER);
   6:     phaseIconLabel.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createLoweredBevelBorder(),
   9:         ...
  10:                 BorderFactory.createEmptyBorder(5,5,5,5)));

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JComponent;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createMatteBorder(0,0,1,1,new Color(128,128,128)));
   7: 
   8:         ...
   9: 
  10:         titlel.setBorder(BorderFactory.createEmptyBorder(2,4,2,2));
  11:         titlel.setForeground(Color.white);

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JPanel;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createTitledBorder("Input"), 
   9:         ...
  10:                 BorderFactory.createEmptyBorder(0,0,0,0)));    

View Full Code Here
   1:         framesPerSecond.setBorder(
   2:                 BorderFactory.createEmptyBorder(0,0,10,0));
   3: 
   4:         ...
   5:         picture.setAlignmentX(Component.CENTER_ALIGNMENT);
   6:         picture.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createLoweredBevelBorder(),
   9:         ...
  10:                 BorderFactory.createEmptyBorder(10,10,10,10)));

View Full Code Here

createEtchedBorder

public static Border createEtchedBorder()
Creates a border with an "etched" look using the component's current background color for highlighting and shading.
Returns:
the Border object
Usages and Demos :

View More Examples of createEtchedBorder()
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.DefaultListCellRenderer;
   4:         ...
   5:         list.setBorder(
   6:                 BorderFactory.createTitledBorder(
   7:         ...
   8:                         BorderFactory.createEtchedBorder(), "Editors"));
   9:         list.setBackground(frame.getBackground());
  10:         ...
  11:         configureArea.setBorder(
  12:                 BorderFactory.createTitledBorder(

View Full Code Here
   1:         setName( "Phases" );
   2:         setBorder( BorderFactory.createTitledBorder(
   3:         ...
   4:             BorderFactory.createEtchedBorder(),
   5:             getName(),
   6:             TitledBorder.CENTER,
   7:             TitledBorder.ABOVE_TOP ) );

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JPanel;
   4:         ...
   5:         JPanel networkPanel = new JPanel( new GridBagLayout() );
   6:         networkPanel.setBorder( BorderFactory.createTitledBorder(
   7:         ...
   8:             BorderFactory.createEtchedBorder(),
   9:             Localizer.getString( "FiltersSettings" ) ) );

View Full Code Here
   1:     panel.setBorder(
   2:         BorderFactory.createCompoundBorder(
   3:         ...
   4:         BorderFactory.createEtchedBorder(),
   5:         ...
   6:         BorderFactory.createEmptyBorder(10, 20, 10, 20)));
   7:     
   8:         ...
   9:     serverList = new IPAddressList();
  10:     Border tb = BorderFactory.createTitledBorder(

View Full Code Here
   1:     panel.setBorder(
   2:         BorderFactory.createCompoundBorder(
   3:         ...
   4:         BorderFactory.createEtchedBorder(), 
   5:         ...
   6:         BorderFactory.createEmptyBorder(10, 20, 10, 20)));
   7:     

View Full Code Here

createEtchedBorder

public static Border createEtchedBorder(int type)
Creates a border with an "etched" look using the component's current background color for highlighting and shading.
Parameters:
type - one of EtchedBorder.RAISED, or EtchedBorder.LOWERED
Returns:
the Border object
Throws:
IllegalArgumentException - if type is not either EtchedBorder.RAISED or EtchedBorder.LOWERED
Since:
1.3
Usages and Demos :

View More Examples of createEtchedBorder(int type)
   1:       _descriptionText.setForeground(Color.DARK_GRAY);
   2:       _descriptionText.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
   3:       Font italic = _descriptionText.getFont().deriveFont(Font.ITALIC);
   4:         ...
   5: 
   6:       Border etched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
   7:         ...
   8:       Border padding = BorderFactory.createEmptyBorder(10, 10, 10, 10);
   9:         ...
  10:       Border border = BorderFactory.createCompoundBorder(etched, padding);

View Full Code Here
   1:     setBackground(bgColor);
   2:     setBorder(BorderFactory.createCompoundBorder
   3:         ...
   4:           (BorderFactory.createEtchedBorder(EtchedBorder.RAISED),
   5:         ...
   6:            BorderFactory.createEtchedBorder(EtchedBorder.RAISED)));

View Full Code Here
   1: 
   2:       Border border = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
   3:         ...
   4:       border = new CompoundBorder(border, BorderFactory.createEmptyBorder(3, 3, 3, 3));
   5:       setBorder(border);
   6: 
   7:       NullAssociation nullEO = 

View Full Code Here
   1:     JPanel panel = new JPanel();
   2:     panel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
   3:     String[] labels = colorTable.getColorLabels();
   4:     int rows = (labels.length + 1) / 2;
   5:     panel.setLayout(new GridLayout(rows, 2, 2, 2));

View Full Code Here
   1:       setBackground(new Color(0xf8f8ff));
   2:       Border border = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
   3:       setBorder(border);
   4:    }

View Full Code Here

createEtchedBorder

public static Border createEtchedBorder(int type,
                                        Color highlight,
                                        Color shadow)
Creates a border with an "etched" look using the specified highlighting and shading colors.
Parameters:
type - one of EtchedBorder.RAISED, or EtchedBorder.LOWERED
highlight - a Color object for the border highlights
shadow - a Color object for the border shadows
Returns:
the Border object
Since:
1.3

createEtchedBorder

public static Border createEtchedBorder(Color highlight,
                                        Color shadow)
Creates a border with an "etched" look using the specified highlighting and shading colors.
Parameters:
highlight - a Color object for the border highlights
shadow - a Color object for the border shadows
Returns:
the Border object
Usages and Demos :

View More Examples of createEtchedBorder(Color highlight,Color shadow)
   1: import javax.swing.JButton;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.ImageIcon;
   4:         ...
   5:     toolBar.putClientProperty("JToolBar.isRollover",Boolean.TRUE);
   6:     toolBar.setBorder(BorderFactory.createEtchedBorder(WHITE, LIGHT_GRAY));
   7:     getContentPane().add(toolBar, BorderLayout.NORTH);
   8: 

View Full Code Here

createLineBorder

public static Border createLineBorder(Color color)
Creates a line border withe the specified color.
Parameters:
color - a Color to use for the line
Returns:
the Border object
Usages and Demos :

View More Examples of createLineBorder(Color color)
   1:       Border border = 
   2:         BorderFactory.createLineBorder(Color.BLACK);
   3:       this.setBorder(border);
   4:     }
   5:     updateLabel();

View Full Code Here
   1: import java.awt.Paint;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.Icon;
   4:         ...
   5:         }
   6:         titlePanel.setBorder(BorderFactory.createEmptyBorder(borderOffset, 4, borderOffset, 1));
   7:         add(titlePanel, BorderLayout.NORTH);
   8:         ...
   9:         northPanel.add(content,BorderLayout.NORTH);
  10:         northPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
  11:         add(northPanel, BorderLayout.CENTER);
  12:         ...
  13:         if (outerBorder == null) {
  14:             setBorder(BorderFactory.createLineBorder(Color.GRAY));

View Full Code Here
   1: import javax.swing.Action;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.Icon;
   4:         ...
   5:         
   6:         button.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:             BorderFactory.createLineBorder(UI.getDarker(UI.getColor("TextField.selectionBackground"))),
   9:             UI.createEmptyBorder(2)

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.Icon;
   4:         ...
   5:   private static final CompoundBorder FOCUS_BORDER =
   6:     BorderFactory.createCompoundBorder(
   7:         ...
   8:       BorderFactory.createLineBorder(Color.GRAY),
   9:         ...
  10:       BorderFactory.createEmptyBorder(5, 5, 5, 5));

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JComponent;
   4:         ...
   5:         }
   6:         p.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                         BorderFactory.createLineBorder(Color.BLACK), 
   9:         ...
  10:                         BorderFactory.createEmptyBorder(10, 10, 10, 10)));

View Full Code Here

createLineBorder

public static Border createLineBorder(Color color,
                                      int thickness)
Creates a line border with the specified color and width. The width applies to all four sides of the border. To specify widths individually for the top, bottom, left, and right, use createMatteBorder(int,int,int,int,Color).
Parameters:
color - a Color to use for the line
thickness - an integer specifying the width in pixels
Returns:
the Border object
Usages and Demos :

View More Examples of createLineBorder(Color color,int thickness)
   1: import javax.swing.JLabel;
   2: import javax.swing.BorderFactory;
   3: import java.awt.Color;
   4:         ...
   5:     label.setBorder(
   6:       BorderFactory.createCompoundBorder(
   7:         ...
   8:         BorderFactory.createLineBorder(Color.black, 3),
   9:         ...
  10:         BorderFactory.createEmptyBorder(5, 5, 5, 5)

View Full Code Here
   1: import javax.swing.JLabel;
   2: import javax.swing.BorderFactory;
   3: import java.awt.Color;
   4:         ...
   5:         label.setBorder(
   6:         BorderFactory.createCompoundBorder(
   7:         ...
   8:         BorderFactory.createLineBorder(Color.black, 3),
   9:         ...
  10:         BorderFactory.createEmptyBorder(5, 5, 5, 5)

View Full Code Here
   1:   Border lineBorder =
   2:     BorderFactory.createLineBorder(Color.black, 1);
   3:   Border emptyBorder =
   4:         ...
   5:     BorderFactory.createEmptyBorder(2, 2, 2, 2);
   6: 
   7:   public Exercise30_9CellRenderer() {
   8:     figurePanel.setPreferredSize(new Dimension(50, 20));

View Full Code Here
   1:         };
   2:         comboBox.setBorder(BorderFactory.createLineBorder(Color.RED, 2));
   3:         comboBox.setUI(comboBoxUI);
   4:         ...
   5:             super.installComponents();
   6:             arrowButton.setBorder(BorderFactory.createEtchedBorder());
   7:         }
   8: 
   9:         public void setBackground(Color c) {

View Full Code Here
   1: import javax.swing.JScrollPane;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.border.Border;
   4:         ...
   5: 
   6:     Border border = BorderFactory.createEmptyBorder(5, 5, 5, 5);
   7: 
   8:         ...
   9: 
  10:       border = BorderFactory.createCompoundBorder(
  11:         ...
  12:         BorderFactory.createLineBorder(Color.black, 3),

View Full Code Here

createLoweredBevelBorder

public static Border createLoweredBevelBorder()
Creates a border with a lowered beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a lowered border, shadows are on top and highlights are underneath.)
Returns:
the Border object
Usages and Demos :

View More Examples of createLoweredBevelBorder()
   1: import javax.swing.JTextField;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.border.Border;
   4:         ...
   5: 
   6:       Border border =     BorderFactory.createCompoundBorder(
   7:         ...
   8:               BorderFactory.createLoweredBevelBorder(),
   9:         ...
  10:               BorderFactory.createEmptyBorder(4,4, 2,2));

View Full Code Here
   1:     mainPanel.setLayout(new GridLayout(2,1,5,5));
   2:     mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
   3: 
   4:         ...
   5:     phaseIconLabel.setHorizontalTextPosition(JLabel.CENTER);
   6:     phaseIconLabel.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createLoweredBevelBorder(),
   9:         ...
  10:                 BorderFactory.createEmptyBorder(5,5,5,5)));

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JColorChooser;
   4:         ...
   5:         new Border[] {
   6:             BorderFactory.createRaisedBevelBorder(),
   7:         ...
   8:             BorderFactory.createLoweredBevelBorder(),
   9:         ...
  10:             BorderFactory.createEtchedBorder(),

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JLabel;
   4:         ...
   5:     setLayout(new BorderLayout());
   6:     setBorder(BorderFactory.createEmptyBorder(0,2,2,2));
   7:     statusLabel.setText("Open or create a net to begin.");
   8:         ...
   9:     statusLabel.setBorder(
  10:       BorderFactory.createCompoundBorder(
  11:         ...
  12:         BorderFactory.createLoweredBevelBorder(),

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: 
   4:         ...
   5:     chartPanel.setBorder(
   6:       BorderFactory.createCompoundBorder(
   7:         ...
   8:         BorderFactory.createLoweredBevelBorder(),
   9:         ...
  10:         BorderFactory.createEmptyBorder(10, 10, 10, 10)));

View Full Code Here

createMatteBorder

public static MatteBorder createMatteBorder(int top,
                                            int left,
                                            int bottom,
                                            int right,
                                            Color color)
Creates a matte-look border using a solid color. (The difference between this border and a line border is that you can specify the individual border dimensions.)
Parameters:
top - an integer specifying the width of the top, in pixels
left - an integer specifying the width of the left side, in pixels
bottom - an integer specifying the width of the right side, in pixels
right - an integer specifying the width of the bottom, in pixels
color - a Color to use for the border
Returns:
the MatteBorder object
Usages and Demos :

View More Examples of createMatteBorder(int top,int left,int bottom,int right,Color color)
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JComponent;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createMatteBorder(0,0,1,1,new Color(128,128,128)));
   7: 
   8:         ...
   9: 
  10:         titlel.setBorder(BorderFactory.createEmptyBorder(2,4,2,2));
  11:         titlel.setForeground(Color.white);

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JLabel;
   4:         ...
   5:         
   6:         al.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createMatteBorder(0,0,1,0,Color.lightGray),
   9:         ...
  10:                 BorderFactory.createEmptyBorder(3,3,3,30)));

View Full Code Here
   1: import javax.swing.AbstractButton;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JComponent;
   4:         ...
   5:     boolean mousePressed = false;
   6:     Border downBorder = BorderFactory.createCompoundBorder(
   7:         ...
   8:             BorderFactory.createMatteBorder(0,0,1,1,Color.white),
   9:         ...
  10:             BorderFactory.createMatteBorder(1,1,0,0,new Color(128,128,128)));

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JLabel;
   4:         ...
   5:         JLabel ol = new JLabel("Overall");
   6:         ol.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createMatteBorder(0,0,1,0,Color.lightGray),
   9:         ...
  10:                 BorderFactory.createEmptyBorder(3,3,3,30)));

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JLabel;
   4:         ...
   5:         
   6:         sl.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createMatteBorder(0,0,1,0,Color.lightGray),
   9:         ...
  10:                 BorderFactory.createEmptyBorder(3,3,3,30)));

View Full Code Here

createMatteBorder

public static MatteBorder createMatteBorder(int top,
                                            int left,
                                            int bottom,
                                            int right,
                                            Icon tileIcon)
Creates a matte-look border that consists of multiple tiles of a specified icon. Multiple copies of the icon are placed side-by-side to fill up the border area.

Note:
If the icon doesn't load, the border area is painted gray.

Parameters:
top - an integer specifying the width of the top, in pixels
left - an integer specifying the width of the left side, in pixels
bottom - an integer specifying the width of the right side, in pixels
right - an integer specifying the width of the bottom, in pixels
tileIcon - the Icon object used for the border tiles
Returns:
the MatteBorder object
Usages and Demos :

View More Examples of createMatteBorder(int top,int left,int bottom,int right,Icon tileIcon)
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JComponent;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createMatteBorder(0,0,1,1,new Color(128,128,128)));
   7: 
   8:         ...
   9: 
  10:         titlel.setBorder(BorderFactory.createEmptyBorder(2,4,2,2));
  11:         titlel.setForeground(Color.white);

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JLabel;
   4:         ...
   5:         
   6:         al.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createMatteBorder(0,0,1,0,Color.lightGray),
   9:         ...
  10:                 BorderFactory.createEmptyBorder(3,3,3,30)));

View Full Code Here
   1: import javax.swing.AbstractButton;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JComponent;
   4:         ...
   5:     boolean mousePressed = false;
   6:     Border downBorder = BorderFactory.createCompoundBorder(
   7:         ...
   8:             BorderFactory.createMatteBorder(0,0,1,1,Color.white),
   9:         ...
  10:             BorderFactory.createMatteBorder(1,1,0,0,new Color(128,128,128)));

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JLabel;
   4:         ...
   5:         JLabel ol = new JLabel("Overall");
   6:         ol.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createMatteBorder(0,0,1,0,Color.lightGray),
   9:         ...
  10:                 BorderFactory.createEmptyBorder(3,3,3,30)));

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JLabel;
   4:         ...
   5:         
   6:         sl.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createMatteBorder(0,0,1,0,Color.lightGray),
   9:         ...
  10:                 BorderFactory.createEmptyBorder(3,3,3,30)));

View Full Code Here

createRaisedBevelBorder

public static Border createRaisedBevelBorder()
Creates a border with a raised beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a raised border, highlights are on top and shadows are underneath.)
Returns:
the Border object
Usages and Demos :

View More Examples of createRaisedBevelBorder()
   1: 
   2:     button.setBorder(BorderFactory.createRaisedBevelBorder());
   3:     container.add(button, "South");
   4:         ...
   5:     {
   6:     Border raisedbevel = BorderFactory.createRaisedBevelBorder();
   7:         ...
   8:     Border loweredbevel = BorderFactory.createLoweredBevelBorder();
   9:     
  10:         ...
  11:     return
  12:         BorderFactory.createCompoundBorder(raisedbevel, loweredbevel);

View Full Code Here
   1:     pnParams_.setLayout(lyParams_);
   2:     pnParams_.setBorder(BorderFactory.createRaisedBevelBorder());
   3:     int tpPrjCur= RefluxResource.typeProjet;
   4:     for (int i= 0; i < tpsPrj.length; i++) {
   5:       String nmType= Definitions.projetToString(tpsPrj[i]);

View Full Code Here
   1: import javax.swing.ImageIcon;
   2: import javax.swing.BorderFactory;
   3: 
   4:         ...
   5: 
   6:         label.setBorder(BorderFactory.createRaisedBevelBorder());
   7:         cell = label;
   8:         ...
   9: 
  10:       label.setBorder(BorderFactory.createRaisedBevelBorder());
  11:       cell = label;
  12:         ...
  13: 
  14:       label.setBorder(BorderFactory.createRaisedBevelBorder());

View Full Code Here
   1: import javax.swing.AbstractButton;
   2: import javax.swing.BorderFactory;
   3: import javax.swing.Icon;
   4:         ...
   5:             fButton.setBorderPainted(true);
   6:             fButton.setBorder(BorderFactory.createRaisedBevelBorder());
   7:         }
   8:         fTool = tool;
   9:         fName = name;

View Full Code Here
   1:         button.addActionListener(m_buttonListener);
   2:         button.setBorder(BorderFactory.createCompoundBorder(
   3:         ...
   4:                   BorderFactory.createCompoundBorder(
   5:         ...
   6:                         BorderFactory.createEmptyBorder(10,10,4,10),
   7:         ...
   8:                     BorderFactory.createRaisedBevelBorder()),

View Full Code Here

createTitledBorder

public static TitledBorder createTitledBorder(String title)
Creates a new title border specifying the text of the title, using the default border (etched), using the default text position (sitting on the top line) and default justification (leading) and using the default font and text color determined by the current look and feel.
Parameters:
title - a String containing the text of the title
Returns:
the TitledBorder object
Usages and Demos :

View More Examples of createTitledBorder(String title)
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JPanel;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createTitledBorder("History"), 
   9:         ...
  10:                 BorderFactory.createEmptyBorder(0,0,0,0)));    

View Full Code Here
   1:         Border border =
   2:           BorderFactory.createTitledBorder("Examples");
   3:         panel.setBorder(border);
   4:         ButtonGroup group = new ButtonGroup();
   5:         AbstractButton abstract1 =

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JPanel;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createTitledBorder("Input"), 
   9:         ...
  10:                 BorderFactory.createEmptyBorder(0,0,0,0)));    

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.DefaultListModel;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createTitledBorder("Graph"), 
   9:         ...
  10:                 BorderFactory.createEmptyBorder(0,0,0,0)));

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.DefaultListModel;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createTitledBorder(""), 
   9:         ...
  10:                 BorderFactory.createEmptyBorder(5,5,5,5)));

View Full Code Here

createTitledBorder

public static TitledBorder createTitledBorder(Border border)
Creates a new title border with an empty title specifying the border object, using the default text position (sitting on the top line) and default justification (leading) and using the default font, and text color.
Parameters:
border - the Border object to add the title to, if null the Border is determined by the current look and feel.
Returns:
the TitledBorder object
Usages and Demos :

View More Examples of createTitledBorder(Border border)
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JPanel;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createTitledBorder("History"), 
   9:         ...
  10:                 BorderFactory.createEmptyBorder(0,0,0,0)));    

View Full Code Here
   1:         Border border =
   2:           BorderFactory.createTitledBorder("Examples");
   3:         panel.setBorder(border);
   4:         ButtonGroup group = new ButtonGroup();
   5:         AbstractButton abstract1 =

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.JPanel;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createTitledBorder("Input"), 
   9:         ...
  10:                 BorderFactory.createEmptyBorder(0,0,0,0)));    

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.DefaultListModel;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createTitledBorder("Graph"), 
   9:         ...
  10:                 BorderFactory.createEmptyBorder(0,0,0,0)));

View Full Code Here
   1: 
   2: import javax.swing.BorderFactory;
   3: import javax.swing.DefaultListModel;
   4:         ...
   5:         
   6:         this.setBorder(BorderFactory.createCompoundBorder(
   7:         ...
   8:                 BorderFactory.createTitledBorder(""), 
   9:         ...
  10:                 BorderFactory.createEmptyBorder(5,5,5,5)));

View Full Code Here

createTitledBorder

public static TitledBorder createTitledBorder(Border border,
                                              String title)
Adds a title to an existing border, specifying the text of the title, using the default positioning (sitting on the top line) and default justification (leading) and using the default font and text color determined by the current look and feel.
Parameters:
border - the Border object to add the title to
title - a String containing the text of the title
Returns:
the TitledBorder object
Usages and Demos :

View More Examples of createTitledBorder(Border border,String title)
   1:         p1.setLayout(new GridLayout(1,1));        
   2:         p1.setBorder(BorderFactory.createTitledBorder("????TextArea -???GridLayout,??ScrollBar"));         
   3:       
   4:         JTextArea t1 = new JTextArea(5,25);
   5:         t1.setTabSize(10);

View Full Code Here
   1:     labelOne.setBorder(
   2:         BorderFactory.createBevelBorder(BevelBorder.RAISED));
   3:     JLabel labelTwo = new JLabel("EtchedBorder", center);
   4:         ...
   5:     labelTwo.setBorder(BorderFactory.createEtchedBorder(  ));
   6:     JLabel labelThree = new JLabel("MatteBorder", center);
   7:         ...
   8:     labelThree.setBorder(
   9:         BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink));
  10:     JLabel labelFour = new JLabel("TitledBorder", center);
  11:         ...
  12:     labelFour.setBorder(
  13:         BorderFactory.createTitledBorder(etch, "Title"));

View Full Code Here
   1:             fsp.setCurrentDirectory(EEGAnalysis.getWorkingDirectory());
   2:             fsp.setBorder(BorderFactory.createTitledBorder(EEGAnalysis.getText(resources,"fspTitle")));
   3:             
   4:         ...
   5:             JPanel coloringInfoPanel=new JPanel(new BorderLayout());
   6:             coloringInfoPanel.setBorder(BorderFactory.createTitledBorder(EEGAnalysis.getText(resources,"coloringInfoPanel")));
   7:             
   8:             SimpleFileFilter[] coloringFilters={new SimpleFileFilter(".cfg",EEGAnalysis.getText("filterConfig")),SimpleFileFilter.allFilter()};
   9:             coloringFile=new FileChoiceCombo(EEGAnalysis.getText(resources,"chooseCInfoFile"),JFileChooser.FILES_ONLY,this,coloringFilters);

View Full Code Here
   1:             fsp.setCurrentDirectory(EEGAnalysis.getWorkingDirectory());
   2:             fsp.setBorder(BorderFactory.createTitledBorder(EEGAnalysis.getText(resources,"fspTitle")));
   3:             
   4:         ...
   5:             JPanel coloringInfoPanel=new JPanel(new BorderLayout());
   6:             coloringInfoPanel.setBorder(BorderFactory.createTitledBorder(EEGAnalysis.getText(resources,"coloringInfoPanel")));
   7:             
   8:             SimpleFileFilter[] coloringFilters={new SimpleFileFilter(".cfg",EEGAnalysis.getText("filterConfig")),SimpleFileFilter.allFilter()};
   9:             coloringFile=new FileChoiceCombo(EEGAnalysis.getText(resources,"chooseCInfoFile"),JFileChooser.FILES_ONLY,this,coloringFilters);

View Full Code Here
   1:             fsp.setCurrentDirectory(EEGAnalysis.getWorkingDirectory());
   2:             fsp.setBorder(BorderFactory.createTitledBorder(EEGAnalysis.getText(resources,"fspTitle")));
   3:             
   4:         ...
   5:             bottomPanel.setLayout(new BoxLayout(bottomPanel,BoxLayout.Y_AXIS));
   6:             bottomPanel.setBorder(BorderFactory.createTitledBorder(EEGAnalysis.getText(resources,"bottomPanel")));
   7:             
   8:             JButton filterButton=EEGAUtil.createButton(EEGAnalysis.getText(resources,"filterButton"),this);
   9:             rereadBox=new JCheckBox(EEGAnalysis.getText(resources,"rereadBox"));

View Full Code Here

createTitledBorder

public static TitledBorder createTitledBorder(Border border,
                                              String title,
                                              int titleJustification,
                                              int titlePosition)
Adds a title to an existing border, specifying the text of the title along with its positioning, using the default font and text color determined by the current look and feel.
Parameters:
border - the Border object to add the title to
title - a String containing the text of the title
titleJustification - an integer specifying the justification of the title -- one of the following:
  • TitledBorder.LEFT
  • TitledBorder.CENTER
  • TitledBorder.RIGHT
  • TitledBorder.LEADING
  • TitledBorder.TRAILING
  • TitledBorder.DEFAULT_JUSTIFICATION (leading)
titlePosition - an integer specifying the vertical position of the text in relation to the border -- one of the following:
  • TitledBorder.ABOVE_TOP
  • TitledBorder.TOP (sitting on the top line)
  • TitledBorder.BELOW_TOP
  • TitledBorder.ABOVE_BOTTOM
  • TitledBorder.BOTTOM (sitting on the bottom line)
  • TitledBorder.BELOW_BOTTOM
  • TitledBorder.DEFAULT_POSITION (top)
Returns:
the TitledBorder object

createTitledBorder

public static TitledBorder createTitledBorder(Border border,
                                              String title,
                                              int titleJustification,
                                              int titlePosition,
                                              Font titleFont)
Adds a title to an existing border, specifying the text of the title along with its positioning and font, using the default text color determined by the current look and feel.
Parameters:
border - the Border object to add the title to
title - a String containing the text of the title
titleJustification - an integer specifying the justification of the title -- one of the following:
  • TitledBorder.LEFT
  • TitledBorder.CENTER
  • TitledBorder.RIGHT
  • TitledBorder.LEADING
  • TitledBorder.TRAILING
  • TitledBorder.DEFAULT_JUSTIFICATION (leading)
titlePosition - an integer specifying the vertical position of the text in relation to the border -- one of the following:
  • TitledBorder.ABOVE_TOP
  • TitledBorder.TOP (sitting on the top line)
  • TitledBorder.BELOW_TOP
  • TitledBorder.ABOVE_BOTTOM
  • TitledBorder.BOTTOM (sitting on the bottom line)
  • TitledBorder.BELOW_BOTTOM
  • TitledBorder.DEFAULT_POSITION (top)
titleFont - a Font object specifying the title font
Returns:
the TitledBorder object

createTitledBorder

public static TitledBorder createTitledBorder(Border border,
                                              String title,
                                              int titleJustification,
                                              int titlePosition,
                                              Font titleFont,
                                              Color titleColor)
Adds a title to an existing border, specifying the text of the title along with its positioning, font, and color.
Parameters:
border - the Border object to add the title to
title - a String containing the text of the title
titleJustification - an integer specifying the justification of the title -- one of the following:
  • TitledBorder.LEFT
  • TitledBorder.CENTER
  • TitledBorder.RIGHT
  • TitledBorder.LEADING
  • TitledBorder.TRAILING
  • TitledBorder.DEFAULT_JUSTIFICATION (leading)
titlePosition - an integer specifying the vertical position of the text in relation to the border -- one of the following:
  • TitledBorder.ABOVE_TOP
  • TitledBorder.TOP (sitting on the top line)
  • TitledBorder.BELOW_TOP
  • TitledBorder.ABOVE_BOTTOM
  • TitledBorder.BOTTOM (sitting on the bottom line)
  • TitledBorder.BELOW_BOTTOM
  • TitledBorder.DEFAULT_POSITION (top)
titleFont - a Font object specifying the title font
titleColor - a Color object specifying the title color
Returns:
the TitledBorder object