Search in sources :

Example 6 with LayoutManager

use of java.awt.LayoutManager in project jdk8u_jdk by JetBrains.

the class NimbusLookAndFeel method resolveToolbarConstraint.

/**
     * Package private method which returns either BorderLayout.NORTH,
     * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending
     * on the location of the toolbar in its parent. The toolbar might be
     * in PAGE_START, PAGE_END, CENTER, or some other position, but will be
     * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar
     * actually IS, with CENTER being NORTH.
     *
     * This code is used to determine where the border line should be drawn
     * by the custom toolbar states, and also used by NimbusIcon to determine
     * whether the handle icon needs to be shifted to look correct.
     *
     * Toollbars are unfortunately odd in the way these things are handled,
     * and so this code exists to unify the logic related to toolbars so it can
     * be shared among the static files such as NimbusIcon and generated files
     * such as the ToolBar state classes.
     */
static Object resolveToolbarConstraint(JToolBar toolbar) {
    //NORTH/SOUTH/EAST/WEST.
    if (toolbar != null) {
        Container parent = toolbar.getParent();
        if (parent != null) {
            LayoutManager m = parent.getLayout();
            if (m instanceof BorderLayout) {
                BorderLayout b = (BorderLayout) m;
                Object con = b.getConstraints(toolbar);
                if (con == SOUTH || con == EAST || con == WEST) {
                    return con;
                }
                return NORTH;
            }
        }
    }
    return NORTH;
}
Also used : Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) LayoutManager(java.awt.LayoutManager)

Aggregations

LayoutManager (java.awt.LayoutManager)6 RadContainer (com.intellij.uiDesigner.radComponents.RadContainer)2 Insets (java.awt.Insets)2 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)1 GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)1 ComponentDragObject (com.intellij.uiDesigner.designSurface.ComponentDragObject)1 RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)1 XYLayoutManager (com.intellij.uiDesigner.shared.XYLayoutManager)1 IncorrectOperationException (com.intellij.util.IncorrectOperationException)1 BorderLayout (java.awt.BorderLayout)1 Container (java.awt.Container)1 Dimension (java.awt.Dimension)1 FontMetrics (java.awt.FontMetrics)1 Point (java.awt.Point)1 Field (java.lang.reflect.Field)1 Vector (java.util.Vector)1