本文整理汇总了Java中javax.swing.BorderFactory.createEmptyBorder方法的典型用法代码示例。如果您正苦于以下问题:Java BorderFactory.createEmptyBorder方法的具体用法?Java BorderFactory.createEmptyBorder怎么用?Java BorderFactory.createEmptyBorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.BorderFactory
的用法示例。
在下文中一共展示了BorderFactory.createEmptyBorder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jbInit
import javax.swing.BorderFactory; //导入方法依赖的package包/类
void jbInit() throws Exception {
border1 =
BorderFactory.createCompoundBorder(
BorderFactory.createEtchedBorder(
Color.white,
new Color(156, 156, 158)),
BorderFactory.createEmptyBorder(5, 5, 5, 5));
border2 = BorderFactory.createEmptyBorder(5, 0, 5, 0);
panel1.setLayout(borderLayout1);
this.getContentPane().setLayout(borderLayout2);
bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
topPanel.setBorder(new EmptyBorder(new Insets(0, 5, 0, 5)));
topPanel.setBackground(Color.WHITE);
jPanel1.setLayout(borderLayout3);
panel1.setBorder(border1);
jPanel1.setBorder(border2);
getContentPane().add(panel1, BorderLayout.CENTER);
panel1.add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.getViewport().add(stickerText, null);
panel1.add(jPanel1, BorderLayout.SOUTH);
this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
this.getContentPane().add(topPanel, BorderLayout.NORTH);
stickerText.setText(txt);
stickerText.setOpaque(true);
stickerText.setBackground(backGroundColor);
stickerText.setForeground(foreGroundColor);
}
示例2: initComponents2
import javax.swing.BorderFactory; //导入方法依赖的package包/类
private void initComponents2() {
header = new HeaderPanel();
title = header.getTitle();
button = header.getButton();
button2 = header.getButton2();
Border outsideBorder = BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray);
Border insideBorder = BorderFactory.createEmptyBorder(3, 3, 3, 3);
CompoundBorder compoundBorder = BorderFactory.createCompoundBorder(outsideBorder, insideBorder);
header.setBorder(compoundBorder);
button.setVisible(false);
button2.setVisible(false);
rightCornerHeader = new JPanel();
rightCornerHeader.setBorder(compoundBorder);
Color headerBgColor = UnitTable.getDarkerColor(getBackground());
header.setBackground(headerBgColor);
if (button != null) {
button.setOpaque(false);
}
if (button2 != null) {
button2.setOpaque(false);
}
rightCornerHeader.setBackground(headerBgColor);
setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 0));
}
示例3: updateProblem
import javax.swing.BorderFactory; //导入方法依赖的package包/类
void updateProblem()
{
String prob = wizard.getProblem();
problem.setText(prob == null ? " " : prob); // NOI18N
if (prob != null && prob.trim().length() == 0)
{
// Issue 3 - provide ability to disable next w/o
// showing the error line
prob = null;
}
Border b = prob == null ? BorderFactory.createEmptyBorder(1, 0, 0, 0) : BorderFactory
.createMatteBorder(1, 0, 0, 0, problem.getForeground());
Border b1 = BorderFactory.createCompoundBorder(BorderFactory
.createEmptyBorder(0, 12, 0, 12), b);
problem.setBorder(b1);
}
示例4: jbInit
import javax.swing.BorderFactory; //导入方法依赖的package包/类
void jbInit() throws Exception {
this.setResizable(false);
this.setIconImage(new ImageIcon(EventNotificationDialog.class.getResource("resources/icons/jnotes16.png")).getImage());
this.getContentPane().setBackground(new Color(251, 197, 63));
border2 = BorderFactory.createEmptyBorder(0,30,0,30);
border3 = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(Color.white,new Color(142, 142, 142)),BorderFactory.createEmptyBorder(0,30,0,30));
border4 = BorderFactory.createEmptyBorder(10,10,0,10);
panel1.setLayout(borderLayout1);
panel1.setBackground(new Color(251, 197, 63));
jButton1.setText(Local.getString("Ok"));
jButton1.setBounds(150, 415, 95, 30);
jButton1.setPreferredSize(new Dimension(95, 30));
jButton1.setBackground(new Color(69, 125, 186));
jButton1.setForeground(Color.white);
jButton1.setDefaultCapable(true);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
//JOptionPane.showMessageDialog(panel1, "Event was Saved");
}
});
panel1.setBorder(border4);
panel1.setMinimumSize(new Dimension(300, 200));
panel1.setPreferredSize(new Dimension(300, 200));
timeLabel.setFont(new java.awt.Font("Dialog", 0, 20));
timeLabel.setHorizontalAlignment(SwingConstants.CENTER);
textLabel.setHorizontalAlignment(SwingConstants.CENTER);
getContentPane().add(panel1);
panel1.add(jPanel1, BorderLayout.SOUTH);
jPanel1.add(jButton1, null);
jPanel1.setBackground(new Color(251, 197, 63));
panel1.add(textLabel, BorderLayout.CENTER);
panel1.add(timeLabel, BorderLayout.NORTH);
playSoundNotification();
}
示例5: jbInit
import javax.swing.BorderFactory; //导入方法依赖的package包/类
void jbInit() throws Exception {
border1 =
BorderFactory.createCompoundBorder(
BorderFactory.createEtchedBorder(
Color.white,
new Color(156, 156, 158)),
BorderFactory.createEmptyBorder(5, 5, 5, 5));
border2 = BorderFactory.createEmptyBorder(5, 0, 5, 0);
panel1.setLayout(borderLayout1);
this.getContentPane().setLayout(borderLayout2);
bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
topPanel.setBorder(new EmptyBorder(new Insets(0, 5, 0, 5)));
topPanel.setBackground(Color.WHITE);
jPanel1.setLayout(borderLayout3);
panel1.setBorder(border1);
jPanel1.setBorder(border2);
getContentPane().add(panel1, BorderLayout.CENTER);
panel1.add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.getViewport().add(stickerText, null);
panel1.add(jPanel1, BorderLayout.SOUTH);
this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
this.getContentPane().add(topPanel, BorderLayout.NORTH);
stickerText.setText(txt);
stickerText.setOpaque(true);
stickerText.setBackground(backGroundColor);
stickerText.setForeground(foreGroundColor);
PreferencesDialog.setJComponentBGandFG(this);
}
示例6: jbInit
import javax.swing.BorderFactory; //导入方法依赖的package包/类
void jbInit() throws Exception {
this.setResizable(false);
this.setIconImage(new ImageIcon(EventNotificationDialog.class.getResource("resources/icons/jnotes16.png")).getImage());
this.getContentPane().setBackground(new Color(251, 197, 63));
border2 = BorderFactory.createEmptyBorder(0,30,0,30);
border3 = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(Color.white,new Color(142, 142, 142)),BorderFactory.createEmptyBorder(0,30,0,30));
border4 = BorderFactory.createEmptyBorder(10,10,0,10);
panel1.setLayout(borderLayout1);
panel1.setBackground(new Color(251, 197, 63));
jButton1.setText(Local.getString("Ok"));
jButton1.setBounds(150, 415, 95, 30);
jButton1.setPreferredSize(new Dimension(95, 30));
jButton1.setBackground(new Color(69, 125, 186));
jButton1.setForeground(Color.white);
jButton1.setDefaultCapable(true);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
panel1.setBorder(border4);
panel1.setMinimumSize(new Dimension(300, 200));
panel1.setPreferredSize(new Dimension(300, 200));
timeLabel.setFont(new java.awt.Font("Dialog", 0, 20));
timeLabel.setHorizontalAlignment(SwingConstants.CENTER);
textLabel.setHorizontalAlignment(SwingConstants.CENTER);
getContentPane().add(panel1);
panel1.add(jPanel1, BorderLayout.SOUTH);
jPanel1.add(jButton1, null);
jPanel1.setBackground(new Color(251, 197, 63));
panel1.add(textLabel, BorderLayout.CENTER);
panel1.add(timeLabel, BorderLayout.NORTH);
playSoundNotification();
}
示例7: addTitledBorder
import javax.swing.BorderFactory; //导入方法依赖的package包/类
/**
* Adds a border and a title around a given component.
* If the component already has some border, it is overridden (not kept).
*
* @param component component the border and title should be added to
* @param insets insets between the component and the titled border
* @param title text of the title
*/
private static void addTitledBorder(JComponent component,
Insets insets,
String title) {
Border insideBorder = BorderFactory.createEmptyBorder(
insets.top, insets.left, insets.bottom, insets.right);
Border outsideBorder = new TitledBorder(
BorderFactory.createEtchedBorder(), title);
component.setBorder(new CompoundBorder(outsideBorder, insideBorder));
}
示例8: openDataWindow
import javax.swing.BorderFactory; //导入方法依赖的package包/类
public void openDataWindow() {
contentPane = new JPanel( new BorderLayout( 10, 10 ) );
Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 10, 10);
contentPane.setBorder( emptyBorder );
searchPane = new JPanel( new BorderLayout( 5, 5 ) );
top = new DefaultMutableTreeNode();
okButton = new JButton("OK");
okButton.addActionListener(this);
searchBar = new JTextField(20);
searchBar.setText(defaultSearchBarText);
searchBar.selectAll();
searchBar.addActionListener(this);
createNodes(top);
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
tree.addTreeSelectionListener(this);
JScrollPane treeView = new JScrollPane(tree);
contentPane.add(treeView, "Center");
contentPane.add(okButton, "South");
searchPane.add(searchLabel, "West");
searchPane.add(searchBar, "Center");
contentPane.add(searchPane, "North");
contentPane.setOpaque(true);
frame.setContentPane(contentPane);
frame.pack();
frame.setVisible(true);
}
示例9: createInstanceImpl
import javax.swing.BorderFactory; //导入方法依赖的package包/类
protected Border createInstanceImpl() {
Insets i = insets.createInstance();
if (i.top == 0 && i.left == 0 && i.bottom == 0 && i.right == 0) {
return BorderFactory.createEmptyBorder();
} else {
return BorderFactory.createEmptyBorder(i.top, i.left, i.bottom, i.right);
}
}
示例10: createEmptyBorder
import javax.swing.BorderFactory; //导入方法依赖的package包/类
/**
* Creates and returns an empty border with the right insets to position
* text correctly.
*/
private Border createEmptyBorder() {
Insets i = computeInsets();
return i == null ? null
: BorderFactory.createEmptyBorder(i.top + EXTRA_BORDER_SPACE,
i.left + EXTRA_BORDER_SPACE,
i.bottom + EXTRA_BORDER_SPACE,
i.right + EXTRA_BORDER_SPACE);
}
示例11: AccessAllData
import javax.swing.BorderFactory; //导入方法依赖的package包/类
public AccessAllData( haxby.map.MapApp owner , boolean parseLayers) {
this.parseLayers = parseLayers;
mapApp = owner;
switch (mapApp.getMapType()) {
default:
case MapApp.MERCATOR_MAP: layersXMLName = "layers.xml"; break;
case MapApp.SOUTH_POLAR_MAP: layersXMLName = "layers_SP.xml"; break;
case MapApp.NORTH_POLAR_MAP: layersXMLName = "layers_NP.xml"; break;
}
openTreePaths = new Vector();
layerNameToURL = new Hashtable();
globalNameToURL = new Hashtable();
globalNameToType = new Hashtable();
focusNameToURL = new Hashtable();
focusNameToType = new Hashtable();
focusNameToWFSLayer = new Hashtable();
rootVector = new Vector();
frame = new JFrame("Available Data");
contentPane = new JPanel( new BorderLayout( 10, 10 ) );
Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 10, 10);
contentPane.setBorder( emptyBorder );
searchPane = new JPanel( new BorderLayout( 5, 5 ) );
top = new DefaultMutableTreeNode();
okButton = new JButton("OK");
okButton.addActionListener(this);
searchBar = new JTextField(20);
searchBar.setText(defaultSearchBarText);
searchBar.selectAll();
searchBar.addActionListener(this);
createNodes(top);
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
tree.addTreeSelectionListener(this);
JScrollPane treeView = new JScrollPane(tree);
contentPane.add(treeView, "Center");
contentPane.add(okButton, "South");
searchPane.add(searchLabel, "West");
searchPane.add(searchBar, "Center");
contentPane.add(searchPane, "North");
contentPane.setOpaque(true);
frame.setContentPane(contentPane);
frame.pack();
traverseTree(top, treeMenu);
}
示例12: addPaddingToMainContainer
import javax.swing.BorderFactory; //导入方法依赖的package包/类
private void addPaddingToMainContainer() {
Border padding = BorderFactory.createEmptyBorder(TOP_PADDING,
LEFT_PADDING, BOTTOM_PADDING, RIGHT_PADDING);
mainContainer.setBorder(padding);
}
示例13: createApplicationSpecificKeysAndValues
import javax.swing.BorderFactory; //导入方法依赖的package包/类
@Override
public Object[] createApplicationSpecificKeysAndValues () {
Object propertySheetColorings = new WinClassicPropertySheetColorings();
Object[] result = {
DESKTOP_BORDER, new EmptyBorder(4, 2, 1, 2),
SCROLLPANE_BORDER, UIManager.get("ScrollPane.border"),
EXPLORER_STATUS_BORDER, new StatusLineBorder(StatusLineBorder.TOP),
EXPLORER_FOLDER_ICON , UIUtils.loadImage("org/netbeans/swing/plaf/resources/win-explorer-folder.gif"),
EXPLORER_FOLDER_OPENED_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/win-explorer-opened-folder.gif"),
EDITOR_STATUS_LEFT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.RIGHT),
EDITOR_STATUS_RIGHT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT),
EDITOR_STATUS_INNER_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT | StatusLineBorder.RIGHT),
EDITOR_TOOLBAR_BORDER, new EditorToolbarBorder(),
EDITOR_STATUS_ONLYONEBORDER, new StatusLineBorder(StatusLineBorder.TOP),
PROPERTYSHEET_BOOTSTRAP, propertySheetColorings,
EDITOR_TAB_CONTENT_BORDER, new WinClassicCompBorder(),
EDITOR_TAB_TABS_BORDER, new WinClassicTabBorder(),
VIEW_TAB_CONTENT_BORDER, new WinClassicCompBorder(),
VIEW_TAB_TABS_BORDER, new WinClassicTabBorder(),
DESKTOP_SPLITPANE_BORDER, BorderFactory.createEmptyBorder(4, 2, 1, 2),
//UI Delegates for the tab control
EDITOR_TAB_DISPLAYER_UI, "org.netbeans.swing.tabcontrol.plaf.WinClassicEditorTabDisplayerUI",
SLIDING_BUTTON_UI, "org.netbeans.swing.tabcontrol.plaf.WindowsSlidingButtonUI",
VIEW_TAB_DISPLAYER_UI, "org.netbeans.swing.tabcontrol.plaf.WinClassicViewTabDisplayerUI",
"Nb.BusyIcon.Height", 14,
PROGRESS_CANCEL_BUTTON_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/cancel_task_win_classic.png"),
//XXX convert to derived colors
"tab_unsel_fill", UIUtils.adjustColor (
new GuaranteedValue("InternalFrame.inactiveTitleGradient",
Color.GRAY).getColor(),
-12, -15, -22),
"tab_sel_fill", new GuaranteedValue("text", Color.WHITE),
"tab_bottom_border", UIUtils.adjustColor (
new GuaranteedValue("InternalFrame.borderShadow",
Color.GRAY).getColor(),
20, 17, 12),
"winclassic_tab_sel_gradient",
new RelativeColor (
new Color(7, 28, 95),
new Color(152, 177, 208),
"InternalFrame.activeTitleBackground"),
// progress component related
"nbProgressBar.Foreground", new Color(49, 106, 197),
"nbProgressBar.Background", Color.WHITE,
"nbProgressBar.popupDynaText.foreground", new Color(141, 136, 122),
"nbProgressBar.popupText.background", new Color(249, 249, 249),
"nbProgressBar.popupText.foreground", UIManager.getColor("TextField.foreground"),
"nbProgressBar.popupText.selectBackground", UIManager.getColor("List.selectionBackground"),
"nbProgressBar.popupText.selectForeground", UIManager.getColor("List.selectionForeground"),
//slide bar
"NbSlideBar.GroupSeparator.Gap.Before", 9,
"NbSlideBar.GroupSeparator.Gap.After", 1,
"NbSlideBar.RestoreButton.Gap", 1,
//browser picker
"Nb.browser.picker.background.light", new Color(255,255,255),
"Nb.browser.picker.foreground.light", new Color(130,130,130),
}; //NOI18N
//#108517 - turn off ctrl+page_up and ctrl+page_down mapping
return UIUtils.addInputMapsWithoutCtrlPageUpAndCtrlPageDown( result );
}
示例14: enlargeBorder
import javax.swing.BorderFactory; //导入方法依赖的package包/类
private static void enlargeBorder(JComponent c, int t, int l, int b, int r) {
Border current = c.getBorder();
Border larger = BorderFactory.createEmptyBorder(t, l, b, r);
if (current == null) c.setBorder(larger);
else c.setBorder(BorderFactory.createCompoundBorder(larger, current));
}
示例15: blankBorder
import javax.swing.BorderFactory; //导入方法依赖的package包/类
/**
* Get a border consisting of empty space.
*
* @param top Top spacing.
* @param left left spacing.
* @param bottom Bottom spacing.
* @param right Right spacing.
* @return A blank border.
*/
public static Border blankBorder(int top, int left, int bottom, int right) {
return BorderFactory.createEmptyBorder(top, left, bottom, right);
}