本文整理汇总了Java中javax.swing.Box.createHorizontalBox方法的典型用法代码示例。如果您正苦于以下问题:Java Box.createHorizontalBox方法的具体用法?Java Box.createHorizontalBox怎么用?Java Box.createHorizontalBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.Box
的用法示例。
在下文中一共展示了Box.createHorizontalBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUnivariate
import javax.swing.Box; //导入方法依赖的package包/类
/**
* Sets up univariate statistics panel
*/
private void createUnivariate() {
Box mainBox = Box.createVerticalBox();
Box centralBox = Box.createHorizontalBox();
mainBox.add(Box.createVerticalStrut(10));
mainBox.add(centralBox);
mainBox.add(Box.createVerticalStrut(10));
uniStatsPanel.add(mainBox);
// Pannello dei componenti univariate statistics panel
JPanel componentsPanel = new JPanel(new BorderLayout(0, 5));
// Aggiuna label descrizione
componentsPanel.add(new JLabel(UNIV_DESCRITPION), BorderLayout.NORTH);
componentsPanel.add(transfGraphCreate(), BorderLayout.SOUTH);
componentsPanel.add(getScrollPaneTable(), BorderLayout.CENTER);
// Aggiuna pannello dei componenti al tabbed pane univariate
centralBox.add(componentsPanel);
}
示例2: getControls
import javax.swing.Box; //导入方法依赖的package包/类
public Component getControls() {
if (panel == null) {
panel = Box.createHorizontalBox();
panel.add(new JLabel(name));
box = new JComboBox(validValues);
box.setMaximumSize(new Dimension(box.getMaximumSize().width,box.getPreferredSize().height));
if (isValidValue(getValue())) {
box.setSelectedItem(getValue());
}
else if (validValues.length > 0) {
box.setSelectedIndex(0);
}
box.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
noUpdate = true;
setValue(box.getSelectedItem());
noUpdate = false;
}
});
panel.add(box);
}
return panel;
}
示例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: 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;
}
示例5: getObject
import javax.swing.Box; //导入方法依赖的package包/类
protected JPanel getObject() {
Box vBox = Box.createVerticalBox();
vBox.add(new JButton("button"));
vBox.add(Box.createVerticalStrut(10));
vBox.add(new JLabel("label"));
vBox.add(Box.createVerticalGlue());
vBox.add(new JButton("button"));
vBox.add(Box.createVerticalStrut(10));
vBox.add(new JLabel("label"));
Box hBox = Box.createHorizontalBox();
hBox.add(new JButton("button"));
hBox.add(Box.createHorizontalStrut(10));
hBox.add(new JLabel("label"));
hBox.add(Box.createHorizontalGlue());
hBox.add(new JButton("button"));
hBox.add(Box.createHorizontalStrut(10));
hBox.add(new JLabel("label"));
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(vBox);
panel.add(Box.createGlue());
panel.add(hBox);
return panel;
}
示例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: SimplePieceEditor
import javax.swing.Box; //导入方法依赖的package包/类
public SimplePieceEditor(GamePiece p) {
String type = null;
if (p instanceof Decorator) {
type = ((Decorator) p).myGetType();
}
else {
type = p.getType();
}
typeField = new JTextField(type);
typeField.setMaximumSize(new java.awt.Dimension(typeField.getMaximumSize().width, typeField.getPreferredSize().height));
String state = null;
if (p instanceof Decorator) {
state = ((Decorator) p).myGetState();
}
else {
state = p.getState();
}
stateField = new JTextField(state);
stateField.setMaximumSize(new java.awt.Dimension(stateField.getMaximumSize().width, stateField.getPreferredSize().height));
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
Box b = Box.createHorizontalBox();
b.add(new JLabel("Type: "));
b.add(typeField);
panel.add(b);
b = Box.createHorizontalBox();
b.add(new JLabel("State: "));
b.add(stateField);
panel.add(b);
}
示例8: initComponents
import javax.swing.Box; //导入方法依赖的package包/类
/**
* Set up the panel contents and layout
*/
private void initComponents() {
classSpinner.addChangeListener(spinnerListener);
help.addHelp(classSpinner, "Enter the number of classes for this system");
classTable = new ClassTable();
/* and now some Box black magic */
//DEK (Federico Granata) 26-09-2003
Box classSpinnerBox = Box.createHorizontalBox();
//OLD
//JLabel spinnerLabel = new JLabel("<html><font size=\"4\">Set the Number of classes (1-" + MAX_CLASSES + "):</font></html>");
//NEW
//@author Stefano
JLabel spinnerLabel = new JLabel(DESCRIPTION_CLASSES);
classSpinnerBox.add(spinnerLabel);
//END
//BEGIN Federico Dall'Orso 9/3/2005
//OLD
/*
classSpinnerBox.add(Box.createGlue());
*/
//NEW
classSpinnerBox.add(Box.createHorizontalStrut(10));
Box numberBox = Box.createVerticalBox();
JPanel spinnerPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
JLabel numberLabel = new JLabel("Number:");
classSpinner.setMaximumSize(new Dimension(600, 18));
spinnerPanel.add(numberLabel);
spinnerPanel.add(classSpinner);
numberBox.add(spinnerPanel);
numberBox.add(new JButton(addClass));
numberBox.setMaximumSize(new Dimension(150, 50));
classSpinnerBox.add(numberBox);
//END Federico Dall'Orso 9/3/2005
Box classBox = Box.createVerticalBox();
classBox.add(Box.createVerticalStrut(20));
classBox.add(classSpinnerBox);
classBox.add(Box.createVerticalStrut(10));
JScrollPane classTablePane = new JScrollPane(classTable);
classTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
classTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
classBox.add(classTablePane);
classBox.add(Box.createVerticalStrut(20));
Box totalBox = Box.createHorizontalBox();
totalBox.add(Box.createHorizontalStrut(20));
totalBox.add(classBox);
totalBox.add(Box.createHorizontalStrut(20));
setLayout(new BorderLayout());
add(totalBox, BorderLayout.CENTER);
}
示例9: initComponents
import javax.swing.Box; //导入方法依赖的package包/类
private void initComponents() {
Box vBox = Box.createVerticalBox();
Box hBox = Box.createHorizontalBox();
Box h2Box = Box.createHorizontalBox();
JLabel descrLabel = new JLabel(DESCRIPTION_PANEL);
button_save = new JButton(ACTION_SAVE);
button_save.setEnabled(false);
synView = new JTextPane();
synView.setContentType("text/html");
synView.setEditable(false);
synScroll = new JScrollPane(synView);
synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
vBox.add(Box.createVerticalStrut(30));
vBox.add(h2Box);
vBox.add(Box.createVerticalStrut(30));
vBox.add(synScroll);
vBox.add(Box.createVerticalStrut(30));
h2Box.add(descrLabel);
h2Box.add(button_save);
hBox.add(Box.createHorizontalStrut(20));
hBox.add(vBox);
hBox.add(Box.createHorizontalStrut(20));
this.setLayout(new GridLayout(1, 1));
this.add(hBox);
synView.setText("<html><body><center><font face=\"bold\" size=\"3\">Burstiness values will be here displayed once you solve the problem.</font></center></body></html>");
}
示例10: initComponents
import javax.swing.Box; //导入方法依赖的package包/类
private void initComponents() {
Box vBox = Box.createVerticalBox();
Box hBox = Box.createHorizontalBox();
Box h2Box = Box.createHorizontalBox();
JLabel descrLabel = new JLabel(DESCRIPTION_PANEL);
button_save = new JButton(ACTION_SAVE);
button_save.setEnabled(false);
synView = new JTextPane();
synView.setContentType("text/html");
synView.setEditable(false);
synScroll = new JScrollPane(synView);
synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
vBox.add(Box.createVerticalStrut(20));
vBox.add(h2Box);
vBox.add(Box.createVerticalStrut(20));
vBox.add(synScroll);
vBox.add(Box.createVerticalStrut(20));
//h2Box.add(Box.createHorizontalStrut(20));
h2Box.add(descrLabel);
h2Box.add(button_save);
hBox.add(Box.createHorizontalStrut(20));
hBox.add(vBox);
hBox.add(Box.createHorizontalStrut(20));
// h2Box.setMaximumSize(new Dimension(580,50));
this.setLayout(new GridLayout(1, 1));
this.add(hBox);
synView
.setText("<html><body><center><font face=\"bold\" size=\"3\">Burstiness values will be here displayed once you solve the problem.</font></center></body></html>");
}
示例11: ErrorDialog
import javax.swing.Box; //导入方法依赖的package包/类
/**
* Constructs a new error dialog, with the same top-level frame as the given
* component, a simple error message, and an exception giving more detail
* about the error. The dialog is not yet shown.
*/
public ErrorDialog(Component component, String message, Throwable exc) {
super(getParentFrame(component), ERROR_MESSAGE_TEXT, true);
setLocationRelativeTo(component);
this.exc = exc;
// setup cancel button
JComponent cancelPane = Box.createHorizontalBox();
this.cancelButton = new JButton(CANCEL_BUTTON_TEXT);
cancelPane.add(Box.createHorizontalGlue());
cancelPane.add(this.cancelButton);
cancelPane.add(Box.createHorizontalGlue());
this.cancelButton.setSelected(true);
// setup details pane
this.detailsButton = new JButton(NO_DETAILS_BUTTON_TEXT);
this.detailsButton.setEnabled(exc != null);
JComponent detailsButtonPane = Box.createHorizontalBox();
detailsButtonPane.add(this.cancelButton);
detailsButtonPane.add(Box.createHorizontalGlue());
detailsButtonPane.add(this.detailsButton);
this.detailsPane = new JPanel(new BorderLayout());
this.detailsPane.add(detailsButtonPane, BorderLayout.SOUTH);
// setup message pane
JPanel messagePane = new JPanel(new BorderLayout());
messagePane.setPreferredSize(new Dimension(300, 100));
messagePane.add(this.detailsPane, BorderLayout.CENTER);
// setup option pane
JOptionPane optionPane =
new JOptionPane(message, JOptionPane.ERROR_MESSAGE, JOptionPane.DEFAULT_OPTION, null,
new Object[] {messagePane});
optionPane.add(messagePane, BorderLayout.SOUTH);
// setup content pane
Container contentPane = getContentPane();
contentPane.add(optionPane);
// constrain size to maximum
setPreferredSize();
// setup text area
this.detailsArea = new JTextArea();
this.detailsArea.setEditable(false);
this.detailsTextPane = new JScrollPane(this.detailsArea);
this.detailsTextPane.setPreferredSize(new Dimension(300, 100));
this.detailsTextPane.setBorder(new EmptyBorder(5, 0, 5, 0));
setDetailsLevel(NO_DETAILS);
// setup button listener
ActionListener buttonListener = new ButtonListener();
this.cancelButton.addActionListener(buttonListener);
this.detailsButton.addActionListener(buttonListener);
pack();
}
示例12: 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;
}
示例13: initComponents
import javax.swing.Box; //导入方法依赖的package包/类
/**
* Set up the panel contents and layout
*/
private void initComponents() {
classSpinner.addChangeListener(spinnerListener);
help.addHelp(classSpinner, "Enter the number of classes for this system");
classTable = new ClassTable();
/* and now some Box black magic */
//DEK (Federico Granata) 26-09-2003
Box classSpinnerBox = Box.createHorizontalBox();
//OLD
//JLabel spinnerLabel = new JLabel("<html><font size=\"4\">Set the Number of classes (1-" + MAX_CLASSES + "):</font></html>");
//NEW
//@author Stefano
JLabel spinnerLabel = new JLabel(DESCRIPTION_CLASSES);
classSpinnerBox.add(spinnerLabel);
//END
//BEGIN Federico Dall'Orso 9/3/2005
//OLD
/*
classSpinnerBox.add(Box.createGlue());
*/
//NEW
classSpinnerBox.add(Box.createHorizontalStrut(10));
Box numberBox = Box.createVerticalBox();
JPanel spinnerPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
JLabel numberLabel = new JLabel("Number:");
classSpinner.setMaximumSize(new Dimension(600, 18));
spinnerPanel.add(numberLabel);
spinnerPanel.add(classSpinner);
numberBox.add(spinnerPanel);
numberBox.add(new JButton(addClass));
numberBox.setMaximumSize(new Dimension(300, 150));
classSpinnerBox.add(numberBox);
//END Federico Dall'Orso 9/3/2005
Box classBox = Box.createVerticalBox();
classBox.add(Box.createVerticalStrut(30));
classBox.add(classSpinnerBox);
classBox.add(Box.createVerticalStrut(10));
JScrollPane classTablePane = new JScrollPane(classTable);
classTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
classTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
classBox.add(classTablePane);
classBox.add(Box.createVerticalStrut(30));
Box totalBox = Box.createHorizontalBox();
totalBox.add(Box.createHorizontalStrut(20));
totalBox.add(classBox);
totalBox.add(Box.createHorizontalStrut(20));
setLayout(new BorderLayout());
add(totalBox, BorderLayout.CENTER);
}
示例14: VersionUpdaterPanel
import javax.swing.Box; //导入方法依赖的package包/类
@SuppressWarnings("OverridableMethodCallInConstructor")
private VersionUpdaterPanel(Pom pom) {
this.pom = pom;
setBorder(new TitledBorder(new BevelBorder(RAISED),
pom.getElementValue("name").getText(),
CENTER, TOP, new Font("SansSerif", BOLD, 18)));
setLayout(new GridBagLayout());
//
Box box = Box.createHorizontalBox();
box.add(elementDisplay(pom.getElementValue("groupId")));
box.add(display(SEPARATOR_TEXT, OK_COLOR));
box.add(elementDisplay(pom.getElementValue("artifactId")));
box.add(display(SEPARATOR_TEXT, OK_COLOR));
version = pom.getElementValue("version");
box.add(elementEditableDisplay(version));
insertLine("Coordinate", box);
//
if (pom.hasElement("parent")) {
ElementValue parentelement = pom.getElementValue("parent");
box = Box.createHorizontalBox();
box.add(elementDisplay(pom.findElementValue(parentelement, "groupId")));
box.add(display(SEPARATOR_TEXT, OK_COLOR));
box.add(elementDisplay(pom.findElementValue(parentelement, "artifactId")));
box.add(display(SEPARATOR_TEXT, OK_COLOR));
box.add(elementDisplay(pom.findElementValue(parentelement, "version")));
insertLine("Parent", box);
}
//
List<Pom> modulePoms = pom.getChildren();
if (modulePoms.size() > 0) {
referringPoms = modulePoms.stream().filter((modulepom) -> (modulepom.isParent(pom))).collect(Collectors.toList());
insertLine("Child Modules", new JLabel(
Integer.toString(referringPoms.size()) + " of " + Integer.toString(modulePoms.size())
+ " refer back to this module in their parent element"
));
}
modulePoms.forEach((modulepom) -> {
insertValue(new VersionUpdaterPanel(modulepom));
});
}
示例15: initComponents
import javax.swing.Box; //导入方法依赖的package包/类
private void initComponents() {
//create margins for this panel.
Box vBox = Box.createVerticalBox();
Box hBox = Box.createHorizontalBox();
vBox.add(Box.createVerticalStrut(20));
vBox.add(hBox);
vBox.add(Box.createVerticalStrut(20));
hBox.add(Box.createHorizontalStrut(20));
//build central panel
JPanel componentsPanel = new JPanel(new BorderLayout());
//new BoxLayout(componentsPanel, BoxLayout.Y_AXIS);
//build upper part of central panel
JPanel upperPanel = new JPanel(new BorderLayout());
JLabel descrLabel = new JLabel(STATIONS_DESCRIPTION);
//descrLabel.setMaximumSize(new Dimension(300, 1000));
upperPanel.add(descrLabel, BorderLayout.CENTER);
//build upper right corner of the main panel
JPanel upRightPanel = new JPanel(new BorderLayout());
addStation = new JButton(addNewStation);
addStation.setMinimumSize(DIM_BUTTON_S);
upRightPanel.add(addStation, BorderLayout.CENTER);
//build spinner panel
JPanel spinnerPanel = new JPanel();
JLabel spinnerDescrLabel = new JLabel("Stations:");
//stationNumSpinner = new JSpinner();
stationNumSpinner.setPreferredSize(DIM_BUTTON_XS);
spinnerPanel.add(spinnerDescrLabel);
spinnerPanel.add(stationNumSpinner);
//add all panels to the mail panel
upRightPanel.add(spinnerPanel, BorderLayout.SOUTH);
upperPanel.add(upRightPanel, BorderLayout.EAST);
componentsPanel.add(upperPanel, BorderLayout.NORTH);
componentsPanel.add(new JScrollPane(stationTable), BorderLayout.CENTER);
hBox.add(componentsPanel);
hBox.add(Box.createHorizontalStrut(20));
this.setLayout(new GridLayout(1, 1));
this.add(vBox);
}