本文整理汇总了Java中javax.swing.Box.setBorder方法的典型用法代码示例。如果您正苦于以下问题:Java Box.setBorder方法的具体用法?Java Box.setBorder怎么用?Java Box.setBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.Box
的用法示例。
在下文中一共展示了Box.setBorder方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import javax.swing.Box; //导入方法依赖的package包/类
private void configure() {
MyListener listener = new MyListener();
this.addWindowListener(listener);
ok.addActionListener(listener);
cancel.addActionListener(listener);
Box buttons = Box.createHorizontalBox();
buttons.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
buttons.add(Box.createHorizontalGlue());
buttons.add(ok);
buttons.add(Box.createHorizontalStrut(10));
buttons.add(cancel);
buttons.add(Box.createHorizontalGlue());
Container pane = super.getContentPane();
pane.add(contents, BorderLayout.CENTER);
pane.add(buttons, BorderLayout.SOUTH);
}
示例2: createMenuButtons
import javax.swing.Box; //导入方法依赖的package包/类
private void createMenuButtons(Container pane) {
// Make a horizontal box at the bottom to hold menu buttons
Box menuBox = Box.createHorizontalBox();
pane.add(menuBox, BorderLayout.PAGE_END);
menuBox.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
// Add the menu buttons
Font menuFont = new Font("Arial", Font.PLAIN, 12);
// SEARCH button ------------
searchBt = new JButton("Find subtitles", createImageIcon("iconSearch.png", "search icon"));
searchBt.addActionListener(this);
searchBt.setFont(menuFont);
menuBox.add(searchBt);
menuBox.add(Box.createRigidArea(new Dimension(2, 0)));
// QUIT button ------------
menuBox.add(Box.createHorizontalGlue());
quitBt = new JButton("Quit", createImageIcon("iconTransparent.png", "use transparent icon for padding"));
quitBt.addActionListener(this);
quitBt.setFont(menuFont);
menuBox.add(quitBt);
}
示例3: makeTools
import javax.swing.Box; //导入方法依赖的package包/类
/**
* @return the editing tools bar
*/
JComponent makeTools() {
Box vbox = Box.createVerticalBox();
Box box = Box.createHorizontalBox();
/*JButton copyanchor=new JButton(ldTable.FILL_ACTION);
help.addHelp(copyanchor,"Copies the value in the focused cell to all selected cells");
box.add(copyanchor);*/
/*JButton copydown=new JButton(COPY_DOWN);
help.addHelp(copydown,"Copies the value in the focused cell down to all cells in the same column");
box.add(copydown);*/
help.addHelp(ldExpression, "Select cells, enter an expression and press ENTER or click \"Evaluate\".");
ldExpression.setMaximumSize(new Dimension(10000, 22));
box.add(ldExpression);
JButton evaluate = new JButton(EVALUATE);
help.addHelp(evaluate, "Click here to fill selected cells with evaluation results.");
box.add(evaluate);
box.setBorder(BorderFactory.createEtchedBorder());
JPanel lPanel = new JPanel();
lPanel.setLayout(new BorderLayout());
JLabel helpLabel = new JLabel(
"<html>Enter the expression to be evaluated, using <b><i>n</i></b> for the number of customers. "
+ "For syntax details and a list of supported functions click on \"Help\"</html>");
helpLabel.setHorizontalAlignment(SwingConstants.CENTER);
lPanel.add(helpLabel);
vbox.add(lPanel);
vbox.add(box);
return vbox;
}
示例4: makeTools
import javax.swing.Box; //导入方法依赖的package包/类
/**
* @return the editing tools bar
*/
JComponent makeTools() {
Box vbox = Box.createVerticalBox();
Box box = Box.createHorizontalBox();
/*JButton copyanchor=new JButton(ldTable.FILL_ACTION);
help.addHelp(copyanchor,"Copies the value in the focused cell to all selected cells");
box.add(copyanchor);*/
/*JButton copydown=new JButton(COPY_DOWN);
help.addHelp(copydown,"Copies the value in the focused cell down to all cells in the same column");
box.add(copydown);*/
help.addHelp(ldExpression, "Select cells, enter an expression and press ENTER or click \"Evaluate\".");
ldExpression.setMaximumSize(new Dimension(10000, 22));
box.add(ldExpression);
JButton evaluate = new JButton(EVALUATE);
help.addHelp(evaluate, "Click here to fill selected cells with evaluation results.");
box.add(evaluate);
box.setBorder(BorderFactory.createEtchedBorder());
JPanel lPanel = new JPanel();
lPanel.setLayout(new BorderLayout());
JLabel helpLabel = new JLabel(
"<html>Enter the expression to be evaluated, using <b><i>n</i></b> for the number of customers. For syntax details and a list of supported functions click on \"Help\"</html>");
helpLabel.setHorizontalAlignment(SwingConstants.CENTER);
lPanel.add(helpLabel);
vbox.add(lPanel);
vbox.add(box);
return vbox;
}
示例5: getPanel
import javax.swing.Box; //导入方法依赖的package包/类
private Box getPanel() {
Box result = Box.createVerticalBox();
result.setBorder(new EmptyBorder(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH));
result.add(getLabel());
result.add(Box.createVerticalGlue());
result.add(getBar());
result.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
return result;
}
示例6: createExceptionsPanel
import javax.swing.Box; //导入方法依赖的package包/类
Box createExceptionsPanel() {
Box box = Box.createVerticalBox();
box.setOpaque(false);
box.setBorder(new EmptyBorder(10, 0, 0, 10));
Box b0 = Box.createHorizontalBox();
b0.add(new JLabel(getString("LBL_EXCEPT")));
b0.setBorder(new EmptyBorder(0, 0, 10, 0));
b0.add(Box.createHorizontalGlue());
box.add(b0);
txtException = new JTextArea();
txtException.setLineWrap(false);
txtException.setWrapStyleWord(true);
JScrollPane jsp = new JScrollPane(txtException);
jsp.setPreferredSize(new Dimension(10, 10));
box.add(jsp);
Box b = Box.createHorizontalBox();
b.add(new JLabel(getString("LBL_EXCEPT_LN")));
b.add(Box.createHorizontalGlue());
b.setBorder(new EmptyBorder(5, 0, 5, 0));
box.add(b);
return box;
}
示例7: createTypesPanel
import javax.swing.Box; //导入方法依赖的package包/类
Box createTypesPanel() {
Box box = Box.createVerticalBox();
box.setOpaque(false);
box.setBorder(new EmptyBorder(10, 0, 0, 10));
Box b0 = Box.createHorizontalBox();
b0.add(new JLabel(getString("LBL_FILE_TYPES")));
b0.setBorder(new EmptyBorder(0, 0, 10, 0));
b0.add(Box.createHorizontalGlue());
box.add(b0);
txtArea = new JTextArea();
txtArea.setWrapStyleWord(true);
txtArea.setLineWrap(true);
JScrollPane jsp = new JScrollPane(txtArea);
jsp.setPreferredSize(new Dimension(10, 10));
box.add(jsp);
Box b = Box.createHorizontalBox();
b.add(Box.createHorizontalGlue());
defaults = new JButton(getString("LBL_DEFAULTS"));
defaults.addActionListener(this);
defaults.setName("LBL_DEFAULTS");
b.add(defaults);
b.setBorder(new EmptyBorder(5, 0, 5, 0));
box.add(b);
return box;
}
示例8: createConnectionPanel
import javax.swing.Box; //导入方法依赖的package包/类
Box createConnectionPanel() {
Box box = Box.createVerticalBox();
box.setOpaque(false);
box.setBorder(new EmptyBorder(10, 0, 0, 10));
Box box2 = Box.createHorizontalBox();
box2.add(new JLabel(getString("DWN_TYM")));
box2.add(Box.createHorizontalGlue());
cmbTimeout = new JComboBox(new String[] { "10", "15", "20", "30", "45",
"60", "120", "180", "240", "300" });
cmbTimeout.setMaximumSize(cmbTimeout.getPreferredSize());
box2.add(cmbTimeout);
box.add(box2);
box2.setBorder(new EmptyBorder(2, 0, 2, 0));
Box box1 = Box.createHorizontalBox();
box1.add(new JLabel(getString("DWN_SEG")));
box1.add(Box.createHorizontalGlue());
cmbConn = new JComboBox(new String[] { "1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "20",
"24", "26", "28", "30", "32" });
cmbConn.setMaximumSize(cmbTimeout.getPreferredSize());
cmbConn.setPreferredSize(cmbTimeout.getPreferredSize());
box1.add(cmbConn);
box.add(box1);
box1.setBorder(new EmptyBorder(2, 0, 2, 0));
Box box3 = Box.createHorizontalBox();
box3.add(new JLabel(getString("DWN_TCP")));
box3.add(Box.createHorizontalGlue());
cmbTcpW = new JComboBox(new String[] { "8", "16", "32", "64" });
cmbTcpW.setMaximumSize(cmbTimeout.getPreferredSize());
cmbTcpW.setPreferredSize(cmbTimeout.getPreferredSize());
box3.add(cmbTcpW);
box.add(box3);
box3.setBorder(new EmptyBorder(2, 0, 2, 0));
box.add(Box.createVerticalGlue());
return box;
}
示例9: createGeneralPanel
import javax.swing.Box; //导入方法依赖的package包/类
Box createGeneralPanel() {
chkDwnldPrg = new JCheckBox(getString("SHOW_DWNLD_PRG"));
chkDwnldPrg.setContentAreaFilled(false);
chkDwnldPrg.setFocusPainted(false);
chkDwnldNotify = new JCheckBox(getString("SHOW_DWNLD_PRG_NOTIFY"));
chkDwnldPrg.setContentAreaFilled(false);
chkDwnldPrg.setFocusPainted(false);
chkFinishedDlg = new JCheckBox(getString("SHOW_DWNLD_DLG"));
chkFinishedDlg.setContentAreaFilled(false);
chkFinishedDlg.setFocusPainted(false);
chkFinishedNotify = new JCheckBox(getString("SHOW_DWNLD_NOTIFY"));
chkFinishedNotify.setContentAreaFilled(false);
chkFinishedNotify.setFocusPainted(false);
// chkAllowBrowser = new JCheckBox(getString("ALLOW_BROWSER"));
// chkAllowBrowser.setContentAreaFilled(false);
// chkAllowBrowser.setFocusPainted(false);
cmbDupAction = new JComboBox(new String[] {
StringResource.getString("DUP__OP1"),
StringResource.getString("DUP__OP2"),
StringResource.getString("DUP__OP3"),
StringResource.getString("DUP__OP4") });
cmbDupAction.setBorder(null);
cmbDupAction.setMaximumSize(new Dimension(chkDwnldPrg
.getPreferredSize().width,
cmbDupAction.getPreferredSize().height));
Box box = Box.createVerticalBox();
box.setOpaque(false);
box.setBorder(new EmptyBorder(10, 0, 0, 10));
Box b0 = Box.createHorizontalBox();
b0.add(chkDwnldPrg);
b0.add(Box.createHorizontalGlue());
box.add(b0);
Box b1 = Box.createHorizontalBox();
b1.add(chkFinishedDlg);
b1.add(Box.createHorizontalGlue());
box.add(b1);
Box b31 = Box.createHorizontalBox();
b31.add(chkDwnldNotify);
b31.add(Box.createHorizontalGlue());
box.add(b31);
Box b3 = Box.createHorizontalBox();
b3.add(chkFinishedNotify);
b3.add(Box.createHorizontalGlue());
box.add(b3);
// Box b2 = Box.createHorizontalBox();
// b2.add(chkAllowBrowser);
// b2.add(Box.createHorizontalGlue());
// box.add(b2);
Box b4 = Box.createHorizontalBox();
b4.add(new JLabel(getString("SHOW_DUP_ACTION")));
b4.add(Box.createHorizontalGlue());
b4.add(cmbDupAction);
box.add(Box.createVerticalStrut(10));
box.add(b4);
return box;
}
示例10: initComponents
import javax.swing.Box; //导入方法依赖的package包/类
/**
* This method initializes the components for the wizard dialog: it creates a JDialog
* as a CardLayout panel surrounded by a small amount of space on each side, as well
* as three buttons at the bottom.
*/
private void initComponents() {
wizardModel.addPropertyChangeListener(this);
wizardController = new WizardController(this);
wizardDialog.getContentPane().setLayout(new BorderLayout());
wizardDialog.addWindowListener(this);
// Create the outer wizard panel, which is responsible for three buttons:
// Next, Back, and Cancel. It is also responsible a JPanel above them that
// uses a CardLayout layout manager to display multiple panels in the
// same spot.
JPanel buttonPanel = new JPanel();
JSeparator separator = new JSeparator();
Box buttonBox = new Box(BoxLayout.X_AXIS);
cardPanel = new JPanel();
cardPanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
cardLayout = new CardLayout();
cardPanel.setLayout(cardLayout);
backButton = new JButton(new ImageIcon("com/nexes/wizard/backIcon.gif"));
nextButton = new JButton();
cancelButton = new JButton();
backButton.setActionCommand(BACK_BUTTON_ACTION_COMMAND);
nextButton.setActionCommand(NEXT_BUTTON_ACTION_COMMAND);
cancelButton.setActionCommand(CANCEL_BUTTON_ACTION_COMMAND);
backButton.addActionListener(wizardController);
nextButton.addActionListener(wizardController);
cancelButton.addActionListener(wizardController);
// Create the buttons with a separator above them, then place them
// on the east side of the panel with a small amount of space between
// the back and the next button, and a larger amount of space between
// the next button and the cancel button.
buttonPanel.setLayout(new BorderLayout());
buttonPanel.add(separator, BorderLayout.NORTH);
buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
buttonBox.add(backButton);
buttonBox.add(Box.createHorizontalStrut(10));
buttonBox.add(nextButton);
buttonBox.add(Box.createHorizontalStrut(30));
buttonBox.add(cancelButton);
buttonPanel.add(buttonBox, java.awt.BorderLayout.EAST);
wizardDialog.getContentPane().add(buttonPanel, java.awt.BorderLayout.SOUTH);
wizardDialog.getContentPane().add(cardPanel, java.awt.BorderLayout.CENTER);
}
示例11: createP1
import javax.swing.Box; //导入方法依赖的package包/类
void createP1() {
Box p11 = Box.createVerticalBox();
p11.setBackground(Color.white);
p11.setOpaque(true);
p1 = new JPanel(new BorderLayout());
Box b1 = Box.createHorizontalBox();
b1.setBackground(Color.white);
b1.setOpaque(true);
b1.setBorder(new EmptyBorder(25, 15, 10, 15));
JLabel lbl = new JLabel();
lbl.setText(StringResource.getString("YT_LBL1"));
lbl.setOpaque(false);
JLabel icon = new JLabel(XDMIconMap.getIcon("YT_ICON"));
icon.setMaximumSize(new Dimension(75, 75));
b1.add(icon);
b1.add(Box.createRigidArea(new Dimension(10, 10)));
b1.add(lbl);
ytaddr = new JTextField();
ytaddr.setMaximumSize(new Dimension(ytaddr.getMaximumSize().width,
ytaddr.getPreferredSize().height));
p11.add(b1);
Box b2 = Box.createHorizontalBox();
b2.add(ytaddr);
b2.setBackground(Color.white);
b2.setOpaque(true);
b2.setBorder(new EmptyBorder(10, 15, 15, 15));
p11.add(b2);
p11.add(Box.createVerticalStrut(20));
p1.add(p11);
Box b3 = Box.createHorizontalBox();
get_video = new JButton(StringResource.getString("YT_LBL4"));
btnDim = get_video.getPreferredSize();
get_video.setName("YT_LBL4");
get_video.addActionListener(this);
cancel = new JButton(StringResource.getString("CANCEL"));
cancel.setName("CANCEL");
cancel.addActionListener(this);
cancel.setPreferredSize(btnDim);
b3.add(Box.createHorizontalGlue());
b3.add(get_video);
b3.add(Box.createRigidArea(new Dimension(10, 10)));
b3.add(cancel);
b3.setBorder(new EmptyBorder(10, 15, 10, 15));
b3.setOpaque(true);
b3.setBackground(StaticResource.titleColor);
p1.add(b3, BorderLayout.SOUTH);
}
示例12: createSchedulerPanel
import javax.swing.Box; //导入方法依赖的package包/类
Box createSchedulerPanel() {
Box box = Box.createVerticalBox();
box.setOpaque(false);
box.setBorder(new EmptyBorder(10, 0, 0, 10));
Box b0 = Box.createHorizontalBox();
schedule = new JCheckBox(getString("LBL_Q"));
schedule.setContentAreaFilled(false);
schedule.setFocusPainted(false);
// schedule.addActionListener(this);
b0.add(schedule);
b0.setBorder(new EmptyBorder(0, 0, 10, 0));
b0.add(Box.createHorizontalGlue());
box.add(b0);
start = new SpinnerDateModel();
end = new SpinnerDateModel();
startDate = new JSpinner(start);
startDate.setEditor(new JSpinner.DateEditor(startDate,
"dd-MMM-yy hh:mm a"));
startDate.setMaximumSize(startDate.getPreferredSize());
endDate = new JSpinner(end);
endDate
.setEditor(new JSpinner.DateEditor(endDate, "dd-MMM-yy hh:mm a"));
endDate.setMaximumSize(endDate.getPreferredSize());
Box b1 = Box.createHorizontalBox();
b1.add(new JLabel(getString("LBL_START_Q")));
b1.add(Box.createHorizontalGlue());
b1.add(startDate);
box.add(b1);
box.add(Box.createRigidArea(new Dimension(10, 10)));
Box b2 = Box.createHorizontalBox();
b2.add(new JLabel(getString("LBL_STOP_Q")));
b2.add(Box.createHorizontalGlue());
b2.add(endDate);
box.add(b2);
return box;
}
示例13: createSaveToPanel
import javax.swing.Box; //导入方法依赖的package包/类
Box createSaveToPanel() {
Box box = Box.createVerticalBox();
box.setOpaque(false);
box.setBorder(new EmptyBorder(10, 0, 0, 10));
Box b = Box.createHorizontalBox();
b.add(new JLabel(getString("TMP_DIR")));
b.add(Box.createHorizontalGlue());
box.add(b);
Box box1 = Box.createHorizontalBox();
box1.setBorder(new EmptyBorder(5, 0, 5, 0));
txtTmpDir = new JTextField(15);
txtTmpDir.setMaximumSize(new Dimension(
txtTmpDir.getMaximumSize().width,
txtTmpDir.getPreferredSize().height));
txtTmpDir.setEditable(false);
txtTmpDir.setBackground(Color.white);
box1.add(txtTmpDir);
box1.add(Box.createRigidArea(new Dimension(10, 10)));
br1 = new JButton("...");
br1.addActionListener(this);
br1.setName("BR_TMP_DIR");
box1.add(br1);
box.add(box1);
Box b2 = Box.createHorizontalBox();
b2.add(new JLabel(getString("DST_DIR")));
b2.add(Box.createHorizontalGlue());
box.add(b2);
Box box2 = Box.createHorizontalBox();
box2.setBorder(new EmptyBorder(5, 0, 5, 0));
txtDstDir = new JTextField(15);
txtDstDir.setMaximumSize(new Dimension(
txtDstDir.getMaximumSize().width,
txtDstDir.getPreferredSize().height));
txtDstDir.setEditable(false);
box2.add(txtDstDir);
box2.add(Box.createRigidArea(new Dimension(10, 10)));
br2 = new JButton("...");
br2.addActionListener(this);
br2.setName("BR_DST_DIR");
box2.add(br2);
txtDstDir.setBackground(Color.white);
box.add(box2);
box.add(Box.createVerticalGlue());
return box;
}
示例14: createRightPanel
import javax.swing.Box; //导入方法依赖的package包/类
void createRightPanel() {
rightPanel = new JPanel(new BorderLayout());
rightPanel.setBackground(Color.white);
TitlePanel tp = new TitlePanel(new BorderLayout(), this);
tp.setBackground(Color.WHITE);
title = new JLabel();
title.setBorder(new EmptyBorder(20, 20, 20, 20));
title.setFont(title.getFont().deriveFont(Font.BOLD,
title.getFont().getSize() * 1.2f));
tp.add(title, BorderLayout.CENTER);
rightPanel.add(tp, BorderLayout.NORTH);
pane = new JPanel(new BorderLayout());
pane.setBackground(Color.white);
jsp = new JScrollPane(pane);
jsp.setBackground(Color.white);
jsp.setBorder(new EmptyBorder(10, 10, 10, 0));
rightPanel.add(jsp);
save = new JButton(getString("SAVE"));
save.setName("SAVE");
save.addActionListener(this);
cancel = new JButton(getString("CANCEL"));
cancel.setName("CANCEL");
cancel.addActionListener(this);
save.setPreferredSize(cancel.getPreferredSize());
Box downBox = Box.createHorizontalBox();
downBox.add(Box.createHorizontalGlue());
downBox.add(save);
downBox.add(Box.createRigidArea(new Dimension(5, 5)));
downBox.add(cancel);
downBox.setBorder(new EmptyBorder(10, 10, 10, 10));
rightPanel.add(downBox, BorderLayout.SOUTH);
centerPanel.add(rightPanel);
}