当前位置: 首页>>代码示例>>Java>>正文


Java BoxLayout.LINE_AXIS属性代码示例

本文整理汇总了Java中javax.swing.BoxLayout.LINE_AXIS属性的典型用法代码示例。如果您正苦于以下问题:Java BoxLayout.LINE_AXIS属性的具体用法?Java BoxLayout.LINE_AXIS怎么用?Java BoxLayout.LINE_AXIS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.swing.BoxLayout的用法示例。


在下文中一共展示了BoxLayout.LINE_AXIS属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addLine

private void addLine(List<Segment> line) {
    if (line.size() == 1) {
        addSegment(this, line.get(0));
    } else {
        Box lineBox = new Box(BoxLayout.LINE_AXIS);
        if (lineBox.getComponentOrientation().isLeftToRight()) {
            lineBox.setAlignmentX(LEFT_ALIGNMENT);
        } else {
            lineBox.setAlignmentX(RIGHT_ALIGNMENT);
        }
        for (Segment s : line) {
            addSegment(lineBox, s);
        }
        add(lineBox);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ConnectionErrorDlg.java

示例2: getObject

protected BoxLayout getObject() {
    return new BoxLayout(new JLabel("TEST"), BoxLayout.LINE_AXIS);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:3,代码来源:javax_swing_BoxLayout.java

示例3: getNewIndex

/** This method calculates position (index) for a component dragged
 * over a container (or just for mouse cursor being moved over container,
 * without any component).
 * @param container instance of a real container over/in which the
 *        component is dragged
 * @param containerDelegate effective container delegate of the container
 *        (for layout managers we always use container delegate instead of
 *        the container)
 * @param component the real component being dragged; not needed here
 * @param index position (index) of the component in its current container;
 *        not needed here
 * @param posInCont position of mouse in the container delegate
 * @param posInComp position of mouse in the dragged component;
 *        not needed here
 * @return index corresponding to the position of the component in the
 *         container
 */
@Override
public int getNewIndex(Container container,
                       Container containerDelegate,
                       Component component,
                       int index,
                       Point posInCont,
                       Point posInComp)
{
    if (!(containerDelegate.getLayout() instanceof BoxLayout))
        return -1;
    
    assistantParams = 0;
    Component[] components = containerDelegate.getComponents();
    for (int i = 0; i < components.length; i++) {
        if (components[i] == component) {
            assistantParams--;
            continue;
        }
        Rectangle b = components[i].getBounds();
        if ((axis == BoxLayout.X_AXIS) || (axis == BoxLayout.LINE_AXIS)) {
            if (posInCont.x < b.x + b.width / 2) {
                assistantParams += i;
                return i;
            }
        }
        else {
            if (posInCont.y < b.y + b.height / 2) {
                assistantParams += i;
                return i;
            }
        }
    }
    
    assistantParams += components.length;
    return components.length;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:53,代码来源:BoxLayoutSupport.java

示例4: tweak

private void tweak() {
    if (UIUtils.isGTKLookAndFeel() || UIUtils.isNimbusLookAndFeel()) {
        int axis = getOrientation() == VERTICAL ? BoxLayout.PAGE_AXIS :
                                                  BoxLayout.LINE_AXIS;
        setLayout(new BoxLayout(this, axis));
    }
    
    if (UIUtils.isNimbusLookAndFeel())
        setBorder(BorderFactory.createEmptyBorder(-2, 0, -2, 0));
    else if (UIUtils.isAquaLookAndFeel())
        setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 1));
    
    if (UIUtils.isWindowsClassicLookAndFeel()) setRollover(true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:GenericToolbar.java

示例5: getProperties

/** Since BoxLayout is not a bean, we must specify its properties
     * explicitly. This method is called from getPropertySets() implementation
     * to obtain the default property set for the layout (assuming there's only
     * one property set). So it woul be also possible to override (more
     * generally) getPropertySets() instead.
     * @return array of properties of the layout manager
     */
    @Override
    protected FormProperty[] getProperties() {
        if (properties == null) {
            // we cannot use RADProperty because "axis" is not a real
            // bean property - we must create a special FormProperty
            properties = new FormProperty[1];

            properties[0] = new FormProperty(
                                PROP_AXIS,
                                Integer.TYPE,
                                getBundle().getString("PROP_axis"), // NOI18N
                                getBundle().getString("HINT_axis")) // NOI18N
            {
                @Override
                public Object getTargetValue() {
                    return new Integer(axis);
                }

                @Override
                public void setTargetValue(Object value) {
                    int ax = ((Integer)value).intValue();
                    if (ax == BoxLayout.X_AXIS || ax == BoxLayout.Y_AXIS
                            || ax == BoxLayout.LINE_AXIS || ax == BoxLayout.PAGE_AXIS) {
                        axis = ax;
                    }
                }

                @Override
                public boolean supportsDefaultValue() {
                    return true;
                }

                @Override
                public Object getDefaultValue() {
                    return new Integer(BoxLayout.LINE_AXIS);
                }

                @Override
                public PropertyEditor getExpliciteEditor() {
                    return new BoxAxisEditor();
                }
            };
            // [!!]
//            properties[0].setPropertyContext(
//                new FormPropertyContext.DefaultImpl(getContainer().getFormModel()));
        }

        return properties;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:56,代码来源:BoxLayoutSupport.java

示例6: getObject

protected Box getObject() {
    return new Box(BoxLayout.LINE_AXIS);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:3,代码来源:javax_swing_Box.java

示例7: createDefaultLayoutInstance

/** Creates a default instance of LayoutManager (for internal use).
 * This method must override AbstractLayoutSupport because BoxLayout is not
 * a bean (so it cannot be created automatically).
 * @return new instance of BoxLayout
 */
@Override
protected LayoutManager createDefaultLayoutInstance() {
    return new BoxLayout(new JPanel(), BoxLayout.LINE_AXIS);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:BoxLayoutSupport.java


注:本文中的javax.swing.BoxLayout.LINE_AXIS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。