| Java Doc By Examples | |
| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectjavax.swing.BorderFactorypublic class BorderFactoryextends ObjectBorder 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 |
|
static Border |
|
static Border |
|
static CompoundBorder |
|
static CompoundBorder |
|
static Border |
|
static Border |
|
static Border |
|
static Border |
|
static Border |
|
static Border |
|
static Border |
|
static Border |
|
static Border |
|
static MatteBorder |
|
static MatteBorder |
|
static Border |
|
static TitledBorder |
|
static TitledBorder |
|
static TitledBorder |
|
static TitledBorder |
|
static TitledBorder |
|
static TitledBorder |
|
Methods inherited from class java.lang.Object | |
clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait | |
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 eitherBevelBorder.LOWEREDorBevelBorder.RAISED
- Returns:
- the
Borderobject
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));
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;
1: import javax.swing.BoxLayout; 2: import javax.swing.BorderFactory; 3: 4: import java.awt.Toolkit; 5: import java.awt.Dimension;
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);
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(
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 eitherBevelBorder.LOWEREDorBevelBorder.RAISEDhighlight- aColorobject for highlightsshadow- aColorobject for shadows
- Returns:
- the
Borderobject
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);
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());
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;
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));
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 eitherBevelBorder.LOWEREDorBevelBorder.RAISEDhighlightOuter- aColorobject for the outer edge of the highlight areahighlightInner- aColorobject for the inner edge of the highlight areashadowOuter- aColorobject for the outer edge of the shadow areashadowInner- aColorobject for the inner edge of the shadow area
- Returns:
- the
Borderobject
public static CompoundBorder createCompoundBorder()
Creates a compound border with anullinside edge and anulloutside edge.
- Returns:
- the
CompoundBorderobject
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- aBorderobject for the outer edge of the compound borderinsideBorder- aBorderobject for the inner edge of the compound border
- Returns:
- the
CompoundBorderobject
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);
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);
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());
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
Borderobject
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:
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());
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();
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 pixelsleft- an integer specifying the width of the left side, in pixelsbottom- an integer specifying the width of the bottom, in pixelsright- an integer specifying the width of the right side, in pixels
- Returns:
- the
Borderobject
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)));
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)));
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);
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)));
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)));
public static Border createEtchedBorder()
Creates a border with an "etched" look using the component's current background color for highlighting and shading.
- Returns:
- the
Borderobject
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(
1: setName( "Phases" ); 2: setBorder( BorderFactory.createTitledBorder( 3: ... 4: BorderFactory.createEtchedBorder(), 5: getName(), 6: TitledBorder.CENTER, 7: TitledBorder.ABOVE_TOP ) );
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" ) ) );
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 ofEtchedBorder.RAISED, orEtchedBorder.LOWERED
- Returns:
- the
Borderobject
- Throws:
IllegalArgumentException- if type is not eitherEtchedBorder.RAISEDorEtchedBorder.LOWERED
- Since:
- 1.3
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);
1: setBackground(bgColor); 2: setBorder(BorderFactory.createCompoundBorder 3: ... 4: (BorderFactory.createEtchedBorder(EtchedBorder.RAISED), 5: ... 6: BorderFactory.createEtchedBorder(EtchedBorder.RAISED)));
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 =
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));
1: setBackground(new Color(0xf8f8ff)); 2: Border border = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); 3: setBorder(border); 4: }
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 ofEtchedBorder.RAISED, orEtchedBorder.LOWEREDhighlight- aColorobject for the border highlightsshadow- aColorobject for the border shadows
- Returns:
- the
Borderobject
- Since:
- 1.3
public static Border createEtchedBorder(Color highlight, Color shadow)
Creates a border with an "etched" look using the specified highlighting and shading colors.
- Parameters:
highlight- aColorobject for the border highlightsshadow- aColorobject for the border shadows
- Returns:
- the
Borderobject
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:
public static Border createLineBorder(Color color)
Creates a line border withe the specified color.
- Parameters:
color- aColorto use for the line
- Returns:
- the
Borderobject
1: Border border = 2: BorderFactory.createLineBorder(Color.BLACK); 3: this.setBorder(border); 4: } 5: updateLabel();
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));
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)
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, usecreateMatteBorder(int,int,int,int,Color).
- Parameters:
color- aColorto use for the linethickness- an integer specifying the width in pixels
- Returns:
- the
Borderobject
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)
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)
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));
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) {
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),
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
Borderobject
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));
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)));
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(),
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(),
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 pixelsleft- an integer specifying the width of the left side, in pixelsbottom- an integer specifying the width of the right side, in pixelsright- an integer specifying the width of the bottom, in pixelscolor- aColorto use for the border
- Returns:
- the
MatteBorderobject
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);
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)));
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)));
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)));
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 pixelsleft- an integer specifying the width of the left side, in pixelsbottom- an integer specifying the width of the right side, in pixelsright- an integer specifying the width of the bottom, in pixelstileIcon- theIconobject used for the border tiles
- Returns:
- the
MatteBorderobject
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);
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)));
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)));
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)));
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
Borderobject
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);
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]);
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());
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- aStringcontaining the text of the title
- Returns:
- the
TitledBorderobject
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)));
1: Border border = 2: BorderFactory.createTitledBorder("Examples"); 3: panel.setBorder(border); 4: ButtonGroup group = new ButtonGroup(); 5: AbstractButton abstract1 =
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)));
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- theBorderobject to add the title to, if null theBorderis determined by the current look and feel.
- Returns:
- the
TitledBorderobject
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)));
1: Border border = 2: BorderFactory.createTitledBorder("Examples"); 3: panel.setBorder(border); 4: ButtonGroup group = new ButtonGroup(); 5: AbstractButton abstract1 =
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)));
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- theBorderobject to add the title totitle- aStringcontaining the text of the title
- Returns:
- the
TitledBorderobject
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);
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"));
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);
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);
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"));
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- theBorderobject to add the title totitle- aStringcontaining the text of the titletitleJustification- an integer specifying the justification of the title -- one of the following:
TitledBorder.LEFTTitledBorder.CENTERTitledBorder.RIGHTTitledBorder.LEADINGTitledBorder.TRAILINGTitledBorder.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_TOPTitledBorder.ABOVE_BOTTOMTitledBorder.BOTTOM(sitting on the bottom line)TitledBorder.BELOW_BOTTOMTitledBorder.DEFAULT_POSITION(top)
- Returns:
- the
TitledBorderobject
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- theBorderobject to add the title totitle- aStringcontaining the text of the titletitleJustification- an integer specifying the justification of the title -- one of the following:
TitledBorder.LEFTTitledBorder.CENTERTitledBorder.RIGHTTitledBorder.LEADINGTitledBorder.TRAILINGTitledBorder.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_TOPTitledBorder.ABOVE_BOTTOMTitledBorder.BOTTOM(sitting on the bottom line)TitledBorder.BELOW_BOTTOMTitledBorder.DEFAULT_POSITION(top)titleFont- a Font object specifying the title font
- Returns:
- the TitledBorder object
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- theBorderobject to add the title totitle- aStringcontaining the text of the titletitleJustification- an integer specifying the justification of the title -- one of the following:
TitledBorder.LEFTTitledBorder.CENTERTitledBorder.RIGHTTitledBorder.LEADINGTitledBorder.TRAILINGTitledBorder.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_TOPTitledBorder.ABOVE_BOTTOMTitledBorder.BOTTOM(sitting on the bottom line)TitledBorder.BELOW_BOTTOMTitledBorder.DEFAULT_POSITION(top)titleFont- aFontobject specifying the title fonttitleColor- aColorobject specifying the title color
- Returns:
- the
TitledBorderobject