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

The following examples show how to use javax.swing.JComponent#getMinimumSize() . 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 File: DataView.java    From netbeans with 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
Source File: MemorySamplerViewSupport.java    From visualvm with 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 3
Source File: DataView.java    From visualvm with 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
Source File: ThreadsMemoryView.java    From visualvm with 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 5
Source File: MemoryView.java    From visualvm with 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 6
Source File: ThreadsCPUView.java    From visualvm with 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 7
Source File: MemoryView.java    From visualvm with 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 8
Source File: BERootPaneUI.java    From beautyeye with 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 File: SeaGlassRootPaneUI.java    From seaglass with 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);
}