本文整理匯總了Java中javax.swing.Box.setPreferredSize方法的典型用法代碼示例。如果您正苦於以下問題:Java Box.setPreferredSize方法的具體用法?Java Box.setPreferredSize怎麽用?Java Box.setPreferredSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.Box
的用法示例。
在下文中一共展示了Box.setPreferredSize方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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(20));
totalBox.add(hBox);
totalBox.add(Box.createVerticalStrut(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() {
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(20));
totalBox.add(hBox);
totalBox.add(Box.createVerticalStrut(20));
setLayout(new BorderLayout());
add(totalBox, BorderLayout.CENTER);
}
示例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;
}