Example usage for java.awt Component isMaximumSizeSet

List of usage examples for java.awt Component isMaximumSizeSet

Introduction

In this page you can find the example usage for java.awt Component isMaximumSizeSet.

Prototype

public boolean isMaximumSizeSet() 

Source Link

Document

Returns true if the maximum size has been set to a non- null value otherwise returns false.

Usage

From source file:org.jdal.swing.form.SimpleBoxFormBuilder.java

/**
 * Add a component to Form at position pointer by cursor, 
 * Increments cursor by one.//from w  w  w .  ja  v a  2  s  . c om
 * @param c Component to add
 */
public void add(Component c) {
    if (debug) {
        if (c instanceof JComponent)
            ((JComponent) c).setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
    }
    addBox(c);

    if (rowHeight < Short.MAX_VALUE) {
        Dimension d = c.getPreferredSize();
        d.height = rowHeight;
        c.setPreferredSize(d);

        c.setMinimumSize(d);

        if (!c.isMaximumSizeSet() || c.getMaximumSize().getHeight() > rowHeight) {
            c.setMaximumSize(new Dimension(Short.MAX_VALUE, rowHeight));
        }
    }

}