Java Code Examples for javax.swing.JToolBar#getPreferredSize()

The following examples show how to use javax.swing.JToolBar#getPreferredSize() . 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: DockReader.java    From ramus with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the largest preferred height or width (depending on orientation)
 * of all of the associated toolbars.
 */
private int getPreferredDepth() {
    int depth = 0;

    final JToolBar[] toolbars = super.getToolBars();

    for (final JToolBar toolbar : toolbars) {
        final Dimension d = toolbar.getPreferredSize();
        if (getOrientation() == ToolBarLayout.HORIZONTAL)
            depth = Math.max(depth, d.height);
        else
            depth = Math.max(depth, d.width);
    }

    return depth;
}
 
Example 2
Source File: DockWrapper.java    From ramus with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the largest preferred height or width (depending on orientation)
 * of all of the associated toolbars.
 */
private int getPreferredDepth() {
    int depth = 0;

    final JToolBar[] toolbars = super.getToolBars();

    for (final JToolBar toolbar : toolbars) {
        final Dimension d = toolbar.getPreferredSize();
        if (getOrientation() == ToolBarLayout.HORIZONTAL)
            depth = Math.max(depth, d.height);
        else
            depth = Math.max(depth, d.width);
    }

    return depth;
}
 
Example 3
Source File: DockBoundary.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the "length" (width or height) of the provided toolbar depending
 * on this boundary's orientation.
 */
protected int getPreferredToolBarLength(final JToolBar toolbar) {
    final Dimension d = toolbar.getPreferredSize();
    if (ourOrientation == ToolBarLayout.HORIZONTAL)
        return d.width;
    else
        return d.height;
}
 
Example 4
Source File: DockBoundary.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the "depth" (height or width) of the provided toolbar depending
 * on this boundary's orientation.
 */
protected int getPreferredToolBarDepth(final JToolBar toolbar) {
    final Dimension d = toolbar.getPreferredSize();
    if (ourOrientation == ToolBarLayout.HORIZONTAL)
        return d.height;
    else
        return d.width;
}