javax.swing.JToolBar#getPreferredSize ( )源码实例Demo

下面列出了javax.swing.JToolBar#getPreferredSize ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ramus   文件: DockReader.java
/**
 * 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;
}
 
源代码2 项目: ramus   文件: DockWrapper.java
/**
 * 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;
}
 
源代码3 项目: ramus   文件: DockBoundary.java
/**
 * 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;
}
 
源代码4 项目: ramus   文件: DockBoundary.java
/**
 * 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;
}