本文整理汇总了Java中javax.swing.Box.setMaximumSize方法的典型用法代码示例。如果您正苦于以下问题:Java Box.setMaximumSize方法的具体用法?Java Box.setMaximumSize怎么用?Java Box.setMaximumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.Box
的用法示例。
在下文中一共展示了Box.setMaximumSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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(300, 150));
stationSpinnerBox.add(numberBox);
//END
Box stationBox = Box.createVerticalBox();
stationBox.add(Box.createVerticalStrut(30));
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);
}
示例4: 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 (Max=3):");
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);
}
示例5: 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 (Max=3):");
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);
}
示例6: 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);
}