本文整理汇总了Java中javax.swing.Box.add方法的典型用法代码示例。如果您正苦于以下问题:Java Box.add方法的具体用法?Java Box.add怎么用?Java Box.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.Box
的用法示例。
在下文中一共展示了Box.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createP3
import javax.swing.Box; //导入方法依赖的package包/类
JPanel createP3() {
p3 = new JPanel(new BorderLayout());
model = new DefaultListModel();
list = new JList(model);
list.setCellRenderer(new YTListRenderer());
p3.add(new JScrollPane(list));
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
btnDwnld = new JButton("Download");
btnDwnld.addActionListener(this);
btnCancel = new JButton("Close");
btnCancel.addActionListener(this);
box.add(btnDwnld);
box.add(Box.createHorizontalStrut(10));
box.add(btnCancel);
btnCancel.setPreferredSize(btnDwnld.getPreferredSize());
box.add(Box.createHorizontalStrut(10));
box.add(Box.createRigidArea(new Dimension(0, 40)));
p3.add(box, BorderLayout.SOUTH);
box.setOpaque(true);
box.setBackground(StaticResource.titleColor);
return p3;
}
示例2: createMatrixQQ
import javax.swing.Box; //导入方法依赖的package包/类
private void createMatrixQQ() {
Box mainBox = Box.createVerticalBox();
Box descBox = Box.createHorizontalBox();
Box tableBox = Box.createHorizontalBox();
scatterQQPlot.add(mainBox);
mainBox.add(Box.createVerticalStrut(10));
mainBox.add(descBox);
mainBox.add(Box.createVerticalStrut(10));
mainBox.add(tableBox);
mainBox.add(Box.createVerticalStrut(10));
descBox.add(new JLabel(QQ_MATRIX_DESCRIPTION));
qqMatrix = new DispQQPlotMatrix();
tableBox.add(qqMatrix);
}
示例3: createMatrix
import javax.swing.Box; //导入方法依赖的package包/类
/**
* Sets up dispersion matrix panel
*/
private void createMatrix() {
Box mainBox = Box.createVerticalBox();
Box descBox = Box.createHorizontalBox();
Box tableBox = Box.createHorizontalBox();
scatterMatrixPanel.add(mainBox);
mainBox.add(Box.createVerticalStrut(10));
mainBox.add(descBox);
mainBox.add(Box.createVerticalStrut(10));
mainBox.add(tableBox);
mainBox.add(Box.createVerticalStrut(10));
descBox.add(new JLabel(MATRIX_DESCRIPTION));
dispPanel = new DispMatrix();
tableBox.add(dispPanel);
}
示例4: createBivariate
import javax.swing.Box; //导入方法依赖的package包/类
/**
* Sets up bivariate statistics panel
*/
private void createBivariate() {
Box mainBox = Box.createVerticalBox();
Box centralBox = Box.createVerticalBox();
mainBox.add(Box.createVerticalStrut(10));
mainBox.add(centralBox);
mainBox.add(Box.createVerticalStrut(10));
bivStatsPanel.add(mainBox);
JPanel mainPanel = new JPanel(new BorderLayout(0, 20));
centralBox.add(mainPanel);
mainPanel.add(new JLabel(BIVARIATE_DESCRIPTION), BorderLayout.NORTH);
tableBivariate = new JWatBivariateStatsTable();
modelBivariate = new JWatBivariateStatsTableModel(model.getMatrix());
tableBivariate.setModel(modelBivariate);
panelBiv = new ScrollBivariatePanel(tableBivariate);
mainPanel.add(panelBiv, BorderLayout.CENTER);
}
示例5: getControls
import javax.swing.Box; //导入方法依赖的package包/类
public Component getControls() {
if (controls == null) {
Box b = Box.createVerticalBox();
b.add(new JLabel(Resources.getString("Notes.invisible"))); //$NON-NLS-1$
text = new TextConfigurer(null, null);
b.add(text.getControls());
controls = b;
}
return controls;
}
示例6: initComponents
import javax.swing.Box; //导入方法依赖的package包/类
/**
* Set up the panel contents and layout
*/
private void initComponents() {
stTable = new STTable();
Box hBox = Box.createHorizontalBox();
hBox.add(Box.createHorizontalStrut(20));
//Horizontal box containing Description label and buttons
Box descrBox = Box.createVerticalBox();
descrBox.add(new JLabel(DESCRIPTION_SERVICETIMES));
descrBox.add(Box.createHorizontalStrut(10));
descrBox.add(new JButton(SWITCH_TO_SD));
descrBox.setPreferredSize(new Dimension(220, 1000));
descrBox.setMinimumSize(new Dimension(200, 200));
hBox.add(descrBox);
hBox.add(Box.createHorizontalStrut(10));
JScrollPane visitTablePane = new JScrollPane(stTable);
visitTablePane.setPreferredSize(new Dimension(1000, 1000));
visitTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
visitTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
hBox.add(visitTablePane);
hBox.add(Box.createHorizontalStrut(20));
Box totalBox = Box.createVerticalBox();
totalBox.add(Box.createVerticalStrut(30));
totalBox.add(hBox);
totalBox.add(Box.createVerticalStrut(30));
setLayout(new BorderLayout());
add(totalBox, BorderLayout.CENTER);
}
示例7: AutoConfigurer
import javax.swing.Box; //导入方法依赖的package包/类
public AutoConfigurer(AutoConfigurable c) {
super(null, c.getConfigureName());
target = c;
setValue(target);
target.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent evt) {
if (Configurable.NAME_PROPERTY.equals(evt.getPropertyName())) {
setName((String) evt.getNewValue());
}
}
});
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
String[] name = c.getAttributeNames();
String[] prompt = c.getAttributeDescriptions();
Class<?>[] type = c.getAttributeTypes();
int n = Math.min(name.length, Math.min(prompt.length, type.length));
for (int i = 0; i < n; ++i) {
if (type[i] == null) {
continue;
}
Configurer config;
config = createConfigurer(type[i], name[i], prompt[i], target);
if (config != null) {
config.addPropertyChangeListener(this);
config.setValue(target.getAttributeValueString(name[i]));
Box box = Box.createHorizontalBox();
box.add(config.getControls());
box.add(Box.createHorizontalGlue());
p.add(box);
configurers.add(config);
}
setVisibility(name[i],c.getAttributeVisibility(name[i]));
}
}
示例8: createLeftPanel
import javax.swing.Box; //导入方法依赖的package包/类
void createLeftPanel() {
Box leftBox = Box.createVerticalBox();
leftBox.setOpaque(true);
leftBox.setBackground(StaticResource.titleColor);
JLabel title = new JLabel(getString("CONFIG_TITLE"));
title.setForeground(Color.white);
title.setFont(title.getFont().deriveFont(Font.BOLD,
title.getFont().getSize() * 1.2f));
title.setBorder(new EmptyBorder(20, 20, 20, 40));
leftBox.add(title);
centerPanel.add(leftBox, BorderLayout.WEST);
arrLbl = new JLabel[9];
for (int i = 0; i < 9; i++) {
String id = "CONFIG_LBL" + (i + 1);
arrLbl[i] = new JLabel(getString(id));
arrLbl[i].setName(id);
arrLbl[i].addMouseListener(clickHandler);
arrLbl[i].setForeground(Color.white);
arrLbl[i].setFont(plainFont);
arrLbl[i].setBorder(new EmptyBorder(5, 20, 5, 20));
leftBox.add(arrLbl[i]);
}
}
示例9: initComponents
import javax.swing.Box; //导入方法依赖的package包/类
/**
* Set up the panel contents and layout
*/
private void initComponents() {
stTable = new STTable();
/* and now some Box black magic */
Box hBox = Box.createHorizontalBox();
hBox.add(Box.createHorizontalStrut(20));
//Horizontal box containing Description label and buttons
Box descrBox = Box.createVerticalBox();
descrBox.add(new JLabel(DESCRIPTION_SERVICEDEMANDS));
descrBox.add(Box.createHorizontalStrut(10));
descrBox.add(new JButton(SWITCH_TO_ST_V));
descrBox.setPreferredSize(new Dimension(220, 1000));
descrBox.setMinimumSize(new Dimension(200, 200));
hBox.add(descrBox);
hBox.add(Box.createHorizontalStrut(10));
JScrollPane visitTablePane = new JScrollPane(stTable);
visitTablePane.setPreferredSize(new Dimension(1000, 1000));
visitTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
visitTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
hBox.add(visitTablePane);
hBox.add(Box.createHorizontalStrut(20));
Box totalBox = Box.createVerticalBox();
totalBox.add(Box.createVerticalStrut(30));
totalBox.add(hBox);
totalBox.add(Box.createVerticalStrut(30));
setLayout(new BorderLayout());
add(totalBox, BorderLayout.CENTER);
}
示例10: IntlOptions
import javax.swing.Box; //导入方法依赖的package包/类
public IntlOptions(PreferencesFrame window) {
super(window);
locale = Strings.createLocaleSelector();
replAccents = new PrefBoolean(AppPreferences.ACCENTS_REPLACE, Strings.getter("intlReplaceAccents"));
gateShape = new PrefOptionList(AppPreferences.GATE_SHAPE, Strings.getter("intlGateShape"),
new PrefOption[] { new PrefOption(AppPreferences.SHAPE_SHAPED, Strings.getter("shapeShaped")),
new PrefOption(AppPreferences.SHAPE_RECTANGULAR, Strings.getter("shapeRectangular")),
new PrefOption(AppPreferences.SHAPE_DIN40700, Strings.getter("shapeDIN40700")) });
Box localePanel = new Box(BoxLayout.X_AXIS);
localePanel.add(Box.createGlue());
localePanel.add(localeLabel);
localeLabel.setMaximumSize(localeLabel.getPreferredSize());
localeLabel.setAlignmentY(Component.TOP_ALIGNMENT);
localePanel.add(locale);
locale.setAlignmentY(Component.TOP_ALIGNMENT);
localePanel.add(Box.createGlue());
JPanel shapePanel = new JPanel();
shapePanel.add(gateShape.getJLabel());
shapePanel.add(gateShape.getJComboBox());
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
add(Box.createGlue());
add(shapePanel);
add(localePanel);
add(replAccents);
add(Box.createGlue());
}
示例11: 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;
}
示例12: 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);
}
示例13: createCredentialPanel
import javax.swing.Box; //导入方法依赖的package包/类
JPanel createCredentialPanel() {
JPanel box = new JPanel(new BorderLayout(5, 5));
box.setOpaque(false);
box.setBorder(new EmptyBorder(10, 0, 0, 10));
model = new CredentialTableModel();
Authenticator.getInstance().addObserver(model);
table = new JTable(model);
if (System.getProperty("xdm.defaulttheme") != null) {
table.getTableHeader().setDefaultRenderer(
new XDMTableHeaderRenderer());
}
table.setFillsViewportHeight(true);
JScrollPane jsp = new JScrollPane(table);
// jsp.setOpaque(false);
// jsp.getViewport().setOpaque(false);
jsp.setPreferredSize(new Dimension(10, 10));
// box.add(table);
box.add(jsp);
Box b = Box.createHorizontalBox();
b.add(Box.createHorizontalGlue());
addAuth = new JButton(getString("LBL_ADD_AUTH"));
addAuth.setName("LBL_ADD_AUTH");
addAuth.addActionListener(this);
removeAuth = new JButton(getString("LBL_DEL_AUTH"));
removeAuth.setName("LBL_DEL_AUTH");
removeAuth.addActionListener(this);
editAuth = new JButton(getString("LBL_EDT_AUTH"));
editAuth.setName("LBL_EDT_AUTH");
editAuth.addActionListener(this);
addAuth.setPreferredSize(removeAuth.getPreferredSize());
editAuth.setPreferredSize(removeAuth.getPreferredSize());
b.add(addAuth);
b.add(Box.createHorizontalStrut(10));
b.add(removeAuth);
b.add(Box.createHorizontalStrut(10));
b.add(editAuth);
box.add(b, BorderLayout.SOUTH);
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);
}
示例15: initComponents
import javax.swing.Box; //导入方法依赖的package包/类
/**
* Set up the panel contents and layout
*/
private void initComponents() {
stationSpinner.addChangeListener(spinnerListener);
stationTable = new StationTable();
/* and now some Box black magic */
Box stationSpinnerBox = Box.createHorizontalBox();
//OLD
//DEK (Federico Granata) 26-09-2003
//JLabel spinnerLabel = new JLabel("<html><font size=\"4\">Set the number of stations (1-" + MAX_STATIONS + "):</font></html>");
//NEW
//@author Stefano
JLabel spinnerLabel = new JLabel(DESCRIPTION_STATIONS);
//spinnerLabel.setMaximumSize(new Dimension(300, 18));
stationSpinnerBox.add(spinnerLabel);
stationSpinnerBox.add(Box.createHorizontalStrut(10));
Box numberBox = Box.createVerticalBox();
JPanel spinnerPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
JLabel numberLabel = new JLabel("Number:");
stationSpinner.setMaximumSize(new Dimension(600, 18));
spinnerPanel.add(numberLabel);
spinnerPanel.add(stationSpinner);
numberBox.add(spinnerPanel);
numberBox.add(new JButton(addStation));
numberBox.setMaximumSize(new Dimension(150, 50));
stationSpinnerBox.add(numberBox);
//END
Box stationBox = Box.createVerticalBox();
stationBox.add(Box.createVerticalStrut(20));
stationBox.add(stationSpinnerBox);
stationBox.add(Box.createVerticalStrut(10));
JScrollPane stationTablePane = new JScrollPane(stationTable);
stationTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
stationTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
stationBox.add(stationTablePane);
stationBox.add(Box.createRigidArea(new Dimension(10, 20)));
Box totalBox = Box.createHorizontalBox();
totalBox.add(Box.createHorizontalStrut(20));
totalBox.add(stationBox);
totalBox.add(Box.createHorizontalStrut(20));
setLayout(new BorderLayout());
add(totalBox, BorderLayout.CENTER);
}