Java Code Examples for javax.swing.JComponent#getMinimumSize()

The following examples show how to use javax.swing.JComponent#getMinimumSize() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans   File: DataView.java    License: Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
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;
}
 
Example 3
Source Project: visualvm   File: DataView.java    License: GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 4
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;
}
 
Example 5
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;
}
 
Example 6
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;
}
 
Example 7
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;
}
 
Example 8
Source Project: beautyeye   File: BERootPaneUI.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Returns the minimum amount of space the layout needs.
 *
 * @param parent the parent
 * @return a Dimension object containing the layout's minimum size
 */ 
public Dimension minimumLayoutSize(Container parent) 
{
	Dimension cpd, mbd, tpd;
	int cpWidth = 0;
	int cpHeight = 0;
	int mbWidth = 0;
	int mbHeight = 0;
	int tpWidth = 0;
	int tpHeight = 0;
	Insets i = parent.getInsets();
	JRootPane root = (JRootPane) parent;

	if(root.getContentPane() != null) 
	{
		cpd = root.getContentPane().getMinimumSize();
	} 
	else 
	{
		cpd = root.getSize();
	}
	if (cpd != null) 
	{
		cpWidth = cpd.width;
		cpHeight = cpd.height;
	}

	if(root.getMenuBar() != null) 
	{
		mbd = root.getMenuBar().getMinimumSize();
		if (mbd != null) {
			mbWidth = mbd.width;
			mbHeight = mbd.height;
		}
	}            
	if (root.getWindowDecorationStyle() != JRootPane.NONE &&
			(root.getUI() instanceof BERootPaneUI)) {
		JComponent titlePane = ((BERootPaneUI)root.getUI()).
		getTitlePane();
		if (titlePane != null) 
		{
			tpd = titlePane.getMinimumSize();
			if (tpd != null) 
			{
				tpWidth = tpd.width;
				tpHeight = tpd.height;
			}
		}
	}

	return new Dimension(Math.max(Math.max(cpWidth, mbWidth), tpWidth) + i.left + i.right, 
			cpHeight + mbHeight + tpWidth + i.top + i.bottom);
}
 
Example 9
Source Project: seaglass   File: SeaGlassRootPaneUI.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Returns the minimum amount of space the layout needs.
 *
 * @param  parent the Container for which this layout manager is being
 *                used
 *
 * @return a Dimension object containing the layout's minimum size
 */
public Dimension minimumLayoutSize(Container parent) {
    Dimension cpd;
    Dimension mbd;
    Dimension tpd;
    int       cpWidth  = 0;
    int       cpHeight = 0;
    int       mbWidth  = 0;
    int       mbHeight = 0;
    int       tpWidth  = 0;
    int       tpHeight = 0;
    Insets    i        = parent.getInsets();
    JRootPane root     = (JRootPane) parent;

    if (root.getContentPane() != null) {
        cpd = root.getContentPane().getMinimumSize();
    } else {
        cpd = root.getSize();
    }

    if (cpd != null) {
        cpWidth  = cpd.width;
        cpHeight = cpd.height;
    }

    if (root.getJMenuBar() != null) {
        mbd = root.getJMenuBar().getMinimumSize();
        if (mbd != null) {
            mbWidth  = mbd.width;
            mbHeight = mbd.height;
        }
    }

    if (root.getWindowDecorationStyle() != JRootPane.NONE && (root.getUI() instanceof SeaGlassRootPaneUI)) {
        JComponent titlePane = ((SeaGlassRootPaneUI) root.getUI()).getTitlePane();

        if (titlePane != null) {
            tpd = titlePane.getMinimumSize();
            if (tpd != null) {
                tpWidth  = tpd.width;
                tpHeight = tpd.height;
            }
        }
    }

    return new Dimension(Math.max(Math.max(cpWidth, mbWidth), tpWidth) + i.left + i.right,
                         cpHeight + mbHeight + tpHeight + i.top + i.bottom);
}