本文整理汇总了Java中java.awt.Component.setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Java Component.setMinimumSize方法的具体用法?Java Component.setMinimumSize怎么用?Java Component.setMinimumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Component
的用法示例。
在下文中一共展示了Component.setMinimumSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAllSizes
import java.awt.Component; //导入方法依赖的package包/类
/**
* Set min max and preferred size for a component
* @param c
* @param d
*/
private static void setAllSizes(Component c, Dimension d) {
c.setPreferredSize(d);
c.setMaximumSize(d);
c.setMinimumSize(d);
c.setSize(d);
}
示例2: runTest
import java.awt.Component; //导入方法依赖的package包/类
public void runTest(final Component c) {
try {
test(c);
c.setMinimumSize(new Dimension(100, 10));
c.setMaximumSize(new Dimension(200, 20));
c.setPreferredSize(new Dimension(300, 30));
test(c);
} catch (final Throwable ignored) {
failures.add(c);
}
}
示例3: fixScrollPaneinSplitPaneJDKIssue
import java.awt.Component; //导入方法依赖的package包/类
private static void fixScrollPaneinSplitPaneJDKIssue(Component c) {
c.setMinimumSize(new Dimension(10, 10)); // Workaround for JSplitPane-containing-JScrollPane JDK bug
}
示例4: add
import java.awt.Component; //导入方法依赖的package包/类
public void add(Component comp, Object constraints) {
if (forceBackground && !UIUtils.isOracleLookAndFeel() && comp instanceof JComponent)
((JComponent)comp).setOpaque(false);
comp.setMinimumSize(comp.getPreferredSize());
super.add(comp, constraints);
}
示例5: updateComponent
import java.awt.Component; //导入方法依赖的package包/类
/**
* Updates the component in the specified cell.
*
* @param rowIndex
* @param columnIndex
*/
private void updateComponent(int rowIndex, int columnIndex) {
Pair<Integer, Integer> key = new Pair<>(rowIndex, columnIndex);
// remove old component
Component oldComponent = mapOfComponents.get(key);
if (oldComponent != null) {
innerPanel.remove(oldComponent);
}
// add updated component to panel instead
Component updatedComponent = createComponentForCell(rowIndex, columnIndex);
// add dimension constraint (if applicable)
if (isConstraintsUsed()) {
updatedComponent.setMinimumSize(constraints[columnIndex]);
updatedComponent.setMaximumSize(constraints[columnIndex]);
updatedComponent.setPreferredSize(constraints[columnIndex]);
}
if (isConstraintsUsed()) {
gbc.weightx = 0.0;
} else {
if (Collection.class.isAssignableFrom(model.getColumnClass(columnIndex))) {
gbc.weightx = 0.1;
} else {
gbc.weightx = 1.0 / model.getColumnCount();
}
}
gbc.weighty = 0.0;
if (isConstraintsUsed() && fillerMode == FillerMode.NONE) {
gbc.fill = GridBagConstraints.VERTICAL;
} else {
gbc.fill = GridBagConstraints.BOTH;
}
gbc.gridx = columnIndex;
gbc.gridy = rowIndex;
innerPanel.add(updatedComponent, gbc);
innerPanel.revalidate();
innerPanel.repaint();
mapOfComponents.put(key, updatedComponent);
}