本文整理汇总了Java中java.awt.Component.getMaximumSize方法的典型用法代码示例。如果您正苦于以下问题:Java Component.getMaximumSize方法的具体用法?Java Component.getMaximumSize怎么用?Java Component.getMaximumSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Component
的用法示例。
在下文中一共展示了Component.getMaximumSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import java.awt.Component; //导入方法依赖的package包/类
public void test(final Component component) {
final Dimension psize = component.getPreferredSize();
psize.width += 200;
if (Objects.equals(psize, component.getPreferredSize())) {
throw new RuntimeException("PreferredSize is wrong");
}
final Dimension msize = component.getMaximumSize();
msize.width += 200;
if (Objects.equals(msize, component.getMaximumSize())) {
throw new RuntimeException("MaximumSize is wrong");
}
final Dimension misize = component.getMinimumSize();
misize.width += 200;
if (Objects.equals(misize, component.getMinimumSize())) {
throw new RuntimeException("MinimumSize is wrong");
}
}
示例2: computeDimension
import java.awt.Component; //导入方法依赖的package包/类
private Dimension computeDimension(Container parent, int type) {
Insets insets = parent.getInsets();
int x = insets.left;
int y = insets.top;
int columnWidth = 0;
// int limitHeight = parent.getHeight() - insets.bottom;
int maxY = 0;
for (Component c : this.components) {
if (c.isVisible()) {
Dimension d;
switch (type) {
case 0:
d = c.getPreferredSize();
break;
case 1:
d = c.getMinimumSize();
break;
default:
d = c.getMaximumSize();
break;
}
columnWidth = Math.max(columnWidth, d.width);
/*
if (limitHeight != 0 && y + d.height >= limitHeight) {
x += columnWidth + this.hgap;
y = insets.top;
columnWidth = d.width;
}
*/
y += d.height;
maxY = Math.max(y, maxY);
y += this.vgap;
}
}
x += columnWidth;
return new Dimension(x, maxY);
}
示例3: defaultHeight
import java.awt.Component; //导入方法依赖的package包/类
private static int defaultHeight() {
if (DEFAULT_HEIGHT == -1) {
JPanel ref = new JPanel(null);
ref.setLayout(new BoxLayout(ref, BoxLayout.LINE_AXIS));
ref.setOpaque(false);
ref.add(new JLabel("XXX")); // NOI18N
ref.add(new JButton("XXX")); // NOI18N
ref.add(new PopupButton("XXX")); // NOI18N
ref.add(new JCheckBox("XXX")); // NOI18N
ref.add(new JRadioButton("XXX")); // NOI18N
ref.add(new JTextField("XXX")); // NOI18N
ref.add(new JExtendedSpinner(new SpinnerNumberModel(1, 1, 655535, 1)));
Component separator = Box.createHorizontalStrut(1);
Dimension d = separator.getMaximumSize(); d.height = 20;
separator.setMaximumSize(d);
ref.add(separator);
DEFAULT_HEIGHT = ref.getPreferredSize().height;
}
return DEFAULT_HEIGHT;
}
示例4: maximumLayoutSize
import java.awt.Component; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public Dimension maximumLayoutSize(Container parent) {
int width = 0;
int height = 0;
for (Component comp : parent.getComponents()) {
Dimension size = comp.getMaximumSize();
if (size != null) {
width = Math.max(width, size.width);
height = Math.max(height, size.height);
}
}
return new Dimension(MAX_COLUMNS * (width + gap) + gap, MAX_ROWS
* (height + gap) + gap);
}
示例5: getMaxWidth
import java.awt.Component; //导入方法依赖的package包/类
public float getMaxWidth (Component widget) {
return widget.getMaximumSize().width;
}
示例6: getMaxHeight
import java.awt.Component; //导入方法依赖的package包/类
public float getMaxHeight (Component widget) {
return widget.getMaximumSize().height;
}