当前位置: 首页>>代码示例>>Java>>正文


Java Component.getMaximumSize方法代码示例

本文整理汇总了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");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:DimensionEncapsulation.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:VerticalFlowLayout.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:SettingsPanel.java

示例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);
}
 
开发者ID:fgulan,项目名称:java-course,代码行数:18,代码来源:CalcLayout.java

示例5: getMaxWidth

import java.awt.Component; //导入方法依赖的package包/类
public float getMaxWidth (Component widget) {
	return widget.getMaximumSize().width;
}
 
开发者ID:emara-geek,项目名称:object-recognition-tensorflow,代码行数:4,代码来源:SwingToolkit.java

示例6: getMaxHeight

import java.awt.Component; //导入方法依赖的package包/类
public float getMaxHeight (Component widget) {
	return widget.getMaximumSize().height;
}
 
开发者ID:emara-geek,项目名称:object-recognition-tensorflow,代码行数:4,代码来源:SwingToolkit.java


注:本文中的java.awt.Component.getMaximumSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。