本文整理汇总了Java中javax.swing.JComponent.getMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Java JComponent.getMinimumSize方法的具体用法?Java JComponent.getMinimumSize怎么用?Java JComponent.getMinimumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.getMinimumSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: minimumLayoutSize
import javax.swing.JComponent; //导入方法依赖的package包/类
public Dimension minimumLayoutSize(Container parent) {
JComponent filter = filterPanel;
if (filter != null && !filter.isVisible()) filter = null;
JComponent search = searchPanel;
if (search != null && !search.isVisible()) search = null;
Dimension dim = new Dimension();
if (filter != null && search != null) {
Dimension dim1 = filter.getMinimumSize();
Dimension dim2 = search.getMinimumSize();
dim.width = dim1.width + dim2.width + 1;
dim.height = Math.max(dim1.height, dim2.height);
} else if (filter != null) {
dim = filter.getMinimumSize();
} else if (search != null) {
dim = search.getMinimumSize();
}
if ((filter != null || search != null) && hasBottomFilterFindMargin())
dim.height += 1;
return dim;
}
示例2: setupGUI
import javax.swing.JComponent; //导入方法依赖的package包/类
private void setupGUI()
{
JComponent whoCanPanel = createWhoCanPanel();
JComponent modePanel = createModePanel();
container = new JPanel(new GridLayout(1, 1));
JSeparator separator = new JSeparator();
final int height1 = whoCanPanel.getPreferredSize().height;
final int height2 = modePanel.getMinimumSize().height;
final int height3 = separator.getPreferredSize().height;
final int[] rows = {height1, height2, height3, TableLayout.FILL,};
final int[] cols = {TableLayout.DOUBLE_FILL, TableLayout.FILL,};
setLayout(new TableLayout(rows, cols));
add(whoCanPanel, new Rectangle(0, 0, 1, 1));
add(modePanel, new Rectangle(0, 1, 2, 1));
add(separator, new Rectangle(0, 2, 2, 1));
add(container, new Rectangle(0, 3, 2, 1));
}
示例3: setupGUI
import javax.swing.JComponent; //导入方法依赖的package包/类
private void setupGUI()
{
JComponent serverList = createServerList();
JComponent configButtons = createConfigButtons();
JComponent connectExit = createConnectExit();
configButtonsHeight = configButtons.getPreferredSize().height;
final int height1 = serverList.getMinimumSize().height;
final int height2 = connectExit.getMinimumSize().height;
final int[] rows = {height1, 0, height2,};
final int[] cols = {WINDOW_WIDTH,};
layout = new TableLayout(rows, cols);
JPanel all = new JPanel(layout);
all.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
all.add(serverList, new Rectangle(0, 0, 1, 1));
all.add(configButtons, new Rectangle(0, 1, 1, 1));
all.add(connectExit, new Rectangle(0, 2, 1, 1));
updateButtons();
setTitle(WINDOW_TITLE);
setResizable(false);
getContentPane().add(all);
getRootPane().setDefaultButton(connect);
addWindowListener(this);
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
ComponentHelper.centreOnScreen(this);
}