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


Java LayerWidget.addChild方法代码示例

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


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

示例1: testLayerPreferredLocation

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
public void testLayerPreferredLocation () {
    Scene scene = new Scene ();

    scene.addChild (new LayerWidget (scene));

    LayerWidget layer = new LayerWidget (scene);
    layer.setPreferredLocation (new Point (100, 100));
    scene.addChild (layer);

    Widget widget = new Widget (scene);
    widget.setPreferredBounds (new Rectangle (-20, -10, 100, 50));
    widget.setOpaque (true);
    widget.setBackground (Color.RED);
    layer.addChild (widget);

    Color color = (Color) (new DefaultLookFeel()).getBackground();
    assertScene (scene, color, new Rectangle (80, 90, 100, 50));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:LayerWidget103528Test.java

示例2: testOffscreenRendering

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
public void testOffscreenRendering () {
    Scene scene = new Scene ();

    LayerWidget layer = new LayerWidget (scene);
    layer.setPreferredBounds (new Rectangle (0, 0, 80, 80));
    scene.addChild (layer);

    LabelWidget widget = new LabelWidget (scene, "Hi");
    widget.setVerticalAlignment (LabelWidget.VerticalAlignment.CENTER);
    widget.setAlignment (LabelWidget.Alignment.CENTER);
    widget.setBorder (BorderFactory.createLineBorder ());
    widget.setPreferredLocation (new Point (20, 20));
    widget.setPreferredBounds (new Rectangle (0, 0, 40, 40));
    layer.addChild (widget);

    BufferedImage image = dumpSceneOffscreenRendering (scene);
    Color backgroundColor = (Color) (new DefaultLookFeel()).getBackground();
    Color foregroundColor = (new DefaultLookFeel()).getForeground();
    assertCleaness (testCleaness (image, backgroundColor, foregroundColor), image, null);

    assertScene (scene, backgroundColor, new Rectangle (19, 19, 42, 42));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:OffscreenRenderingTest.java

示例3: showSliderImpl

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
private void showSliderImpl(LayerWidget constraintslayer, Point point) {

        ComponentWidget componentWidget = new ComponentWidget(scene, slider);

        componentWidget.getActions().addAction(ActionFactory.createMoveAction());

        CaratteristicheBarra caratteristicheBarra = new CaratteristicheBarra(componentWidget, Costanti.INTERMEDIE_BARRA);
        IconNodeWidget barra = new IconNodeWidget(scene);
        barra.setLayout(LayoutFactory.createHorizontalFlowLayout());
        barra.setImage(ImageUtilities.loadImage(Costanti.ICONA_MOVE));
        ComponentWidget labelConfidence = new ComponentWidget(scene, jLabelConfidenceLevel);
        labelConfidence.setPreferredSize(new Dimension(100, 10));
        barra.addChild(labelConfidence);
        Point pointBarra = new Point(point.x - Costanti.OFF_SET_X_WIDGET_BARRA, point.y - Costanti.OFF_SET_Y_WIDGET_BARRA);
        barra.setPreferredLocation(pointBarra);
        MyMoveProviderGeneric moveProvider = new MyMoveProviderGeneric();
        barra.getActions().addAction(ActionFactory.createMoveAction(moveProvider, moveProvider));

//        int x = myGraphScene.getBounds()
        componentWidget.setPreferredLocation(new Point(point.x, point.y));
        constraintslayer.addChild(componentWidget, barra);
        constraintslayer.addChild(barra, caratteristicheBarra);
        scene.validate();
        myGraphScene.updateUI();
    }
 
开发者ID:dbunibas,项目名称:spicy,代码行数:26,代码来源:MyPopupSceneMatcher.java

示例4: createConstantInterWidget

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
public Widget createConstantInterWidget(Scene scene, LayerWidget mainLayer, LayerWidget connectionLayer, JPanel pannelloPrincipale, Point point, GraphSceneGlassPane glassPane) {
    CaratteristicheWidgetInterConst caratteristicheWidget = new CaratteristicheWidgetInterConst();
    caratteristicheWidget.setTreeType(Costanti.INTERMEDIE);
    caratteristicheWidget.setFormValidation(new FormValidation(true));
    ConstantWidget rootWidget = new ConstantWidget(scene, point, caratteristicheWidget);
    rootWidget.getActions().addAction(ActionFactory.createEditAction(new MyEditProviderConst(caratteristicheWidget)));
    rootWidget.getActions().addAction(ActionFactory.createConnectAction(connectionLayer, new ActionConstantConnection(mainLayer, connectionLayer, caratteristicheWidget)));
    rootWidget.getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProviderDeleteConst(glassPane)));

    CaratteristicheBarra caratteristicheBarra = new CaratteristicheBarra(rootWidget, Costanti.INTERMEDIE_BARRA);
    IconNodeWidget barra = new IconNodeWidget(scene);
    barra.setImage(ImageUtilities.loadImage(Costanti.ICONA_MOVE));
    Point pointBarra = new Point(rootWidget.getPreferredLocation().x - Costanti.OFF_SET_X_WIDGET_BARRA, rootWidget.getPreferredLocation().y - Costanti.OFF_SET_Y_WIDGET_BARRA);
    barra.setPreferredLocation(pointBarra);
    IntermediateMoveProvider moveProvider = new IntermediateMoveProvider(pannelloPrincipale);
    barra.getActions().addAction(ActionFactory.createMoveAction(moveProvider, moveProvider));
    caratteristicheWidget.setWidgetBarra(barra);

    mainLayer.addChild(rootWidget, caratteristicheWidget);
    mainLayer.addChild(barra, caratteristicheBarra);

    glassPane.addConstant(rootWidget);
    glassPane.addConstant(barra);

    return rootWidget;
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:27,代码来源:WidgetCreator.java

示例5: createFunctionWidget

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
public Widget createFunctionWidget(Scene scene, LayerWidget mainLayer, LayerWidget connectionLayer, JPanel pannelloPrincipale, Point point, GraphSceneGlassPane glassPane) {
    FunctionWidget rootWidget = new FunctionWidget(scene, point);
    CaratteristicheWidgetInterFunction caratteristicheWidget = new CaratteristicheWidgetInterFunction();
    caratteristicheWidget.setTreeType(Costanti.INTERMEDIE);
    rootWidget.getActions().addAction(ActionFactory.createEditAction(new MyEditProviderFunction(caratteristicheWidget)));
    rootWidget.getActions().addAction(ActionFactory.createConnectAction(connectionLayer, new ActionFunctionConnection(connectionLayer, mainLayer, caratteristicheWidget)));
    rootWidget.getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProviderDeleteFunc(glassPane)));

    CaratteristicheBarra caratteristicheBarra = new CaratteristicheBarra(rootWidget, Costanti.INTERMEDIE_BARRA);
    IconNodeWidget barra = new IconNodeWidget(scene);
    barra.setImage(ImageUtilities.loadImage(Costanti.ICONA_MOVE));
    Point pointBarra = new Point(rootWidget.getPreferredLocation().x - Costanti.OFF_SET_X_WIDGET_BARRA, rootWidget.getPreferredLocation().y - Costanti.OFF_SET_Y_WIDGET_BARRA);
    barra.setPreferredLocation(pointBarra);
    IntermediateMoveProvider moveProvider = new IntermediateMoveProvider(pannelloPrincipale);
    barra.getActions().addAction(ActionFactory.createMoveAction(moveProvider, moveProvider));
    caratteristicheWidget.setWidgetBarra(barra);

    mainLayer.addChild(rootWidget, caratteristicheWidget);
    mainLayer.addChild(barra, caratteristicheBarra);

    glassPane.addFunction(rootWidget);
    glassPane.addFunction(barra);

    return rootWidget;
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:26,代码来源:WidgetCreator.java

示例6: createAttributeGroupWidget

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
public Widget createAttributeGroupWidget(Scene scene, LayerWidget mainLayer, LayerWidget connectionLayer, JPanel pannelloPrincipale, Point point, GraphSceneGlassPane glassPane) {
        AttributeGroupWidget rootWidget = new AttributeGroupWidget(scene, point);
        CaratteristicheWidgetInterAttributeGroup caratteristicheWidget = new CaratteristicheWidgetInterAttributeGroup();
        caratteristicheWidget.setTreeType(Costanti.INTERMEDIE);
//        rootWidget.getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProviderDeleteAttributeGroup(glassPane)));

        CaratteristicheBarra caratteristicheBarra = new CaratteristicheBarra(rootWidget, Costanti.INTERMEDIE_BARRA);
        IconNodeWidget barra = new IconNodeWidget(scene);
        barra.setImage(ImageUtilities.loadImage(Costanti.ICONA_MOVE));
        Point pointBarra = new Point(rootWidget.getPreferredLocation().x - Costanti.OFF_SET_X_WIDGET_BARRA, rootWidget.getPreferredLocation().y - Costanti.OFF_SET_Y_WIDGET_BARRA);
        barra.setPreferredLocation(pointBarra);
        IntermediateMoveProvider moveProvider = new IntermediateMoveProvider(pannelloPrincipale);
        barra.getActions().addAction(ActionFactory.createMoveAction(moveProvider, moveProvider));
        caratteristicheWidget.setWidgetBarra(barra);

        mainLayer.addChild(rootWidget, caratteristicheWidget);
        mainLayer.addChild(barra, caratteristicheBarra);

//        glassPane.addAttributeGroup(rootWidget);
//        glassPane.addAttributeGroup(barra);

        return rootWidget;
    }
 
开发者ID:dbunibas,项目名称:spicy,代码行数:24,代码来源:WidgetCreator.java

示例7: createFunctionalDependencyWidget

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
public Widget createFunctionalDependencyWidget(Scene scene, LayerWidget mainLayer, LayerWidget connectionLayer, JPanel pannelloPrincipale, Point point, GraphSceneGlassPane glassPane) {
    FunctionalDependencyWidget rootWidget = new FunctionalDependencyWidget(scene, point);
    CaratteristicheWidgetInterFunctionalDep caratteristicheWidget = new CaratteristicheWidgetInterFunctionalDep();
    caratteristicheWidget.setTreeType(Costanti.INTERMEDIE);

    rootWidget.getActions().addAction(ActionFactory.createConnectAction(connectionLayer, new ActionFunctionalDepConnection(connectionLayer, mainLayer, caratteristicheWidget)));
    rootWidget.getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProviderDeleteFunctionalDep(glassPane)));

    CaratteristicheBarra caratteristicheBarra = new CaratteristicheBarra(rootWidget, Costanti.INTERMEDIE_BARRA);
    IconNodeWidget barra = new IconNodeWidget(scene);
    barra.setImage(ImageUtilities.loadImage(Costanti.ICONA_MOVE));
    Point pointBarra = new Point(rootWidget.getPreferredLocation().x - Costanti.OFF_SET_X_WIDGET_BARRA, rootWidget.getPreferredLocation().y - Costanti.OFF_SET_Y_WIDGET_BARRA);
    barra.setPreferredLocation(pointBarra);
    IntermediateMoveProvider moveProvider = new IntermediateMoveProvider(pannelloPrincipale);
    barra.getActions().addAction(ActionFactory.createMoveAction(moveProvider, moveProvider));
    caratteristicheWidget.setWidgetBarra(barra);

    mainLayer.addChild(rootWidget, caratteristicheWidget);
    mainLayer.addChild(barra, caratteristicheBarra);

    glassPane.addFunctionalDependency(rootWidget);
    glassPane.addFunctionalDependency(barra);
    scene.validate();

    return rootWidget;
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:27,代码来源:WidgetCreator.java

示例8: createConnectionToTargetImpl

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
private ConnectionInfo createConnectionToTargetImpl(Widget sourceWidget, Widget targetWidget, LayerWidget mainLayer, LayerWidget connectionLayer, Stroke stroke) {

        ConnectionWidget connection = new ConnectionWidget(sourceWidget.getScene());
        connection.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);
        connection.setSourceAnchor(AnchorFactory.createRectangularAnchor(sourceWidget));
        connection.setTargetAnchor(AnchorFactory.createRectangularAnchor(targetWidget));
        connection.setStroke(stroke);

        CaratteristicheWidgetInterConst caratteristicheWidget = (CaratteristicheWidgetInterConst) mainLayer.getChildConstraint(sourceWidget);

        connection.getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProviderConnectionConst(sourceWidget.getScene(), caratteristicheWidget)));
        ConnectionInfo connectionInfo = new ConnectionInfo();
        connectionInfo.setTargetWidget(targetWidget);
        connectionInfo.setConnectionWidget(connection);
        caratteristicheWidget.addConnectionInfo(connectionInfo);

        connectionLayer.addChild(connection, connectionInfo);
        return connectionInfo;
    }
 
开发者ID:dbunibas,项目名称:spicy,代码行数:20,代码来源:ConnectionCreator.java

示例9: createConnectionFromFunctionalDependecyImpl

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
private ConnectionInfo createConnectionFromFunctionalDependecyImpl(Widget functionalDepWidget, Widget targetWidget, LayerWidget mainLayer, LayerWidget connectionLayer, Stroke stroke) {
        ConnectionWidget connection = new ConnectionWidget(functionalDepWidget.getScene());
        connection.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);
        connection.setSourceAnchor(AnchorFactory.createRectangularAnchor(functionalDepWidget));
        connection.setTargetAnchor(AnchorFactory.createRectangularAnchor(targetWidget));
        connection.setStroke(stroke);
        connection.setVisible(true);


        CaratteristicheWidgetInterFunctionalDep caratteristicheWidget = (CaratteristicheWidgetInterFunctionalDep) mainLayer.getChildConstraint(functionalDepWidget);

        connection.getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProviderConnectionFunctionalDep(functionalDepWidget.getScene(), mainLayer, caratteristicheWidget)));
        caratteristicheWidget.addTargetWidget((VMDPinWidget) targetWidget);

        ConnectionInfo connectionInfo = new ConnectionInfo();
//        connectionInfo.setTargetWidget(targetWidget);
//        connectionInfo.setConnectionWidget(connection);
        connectionLayer.addChild(connection, connectionInfo);
        return connectionInfo;
    }
 
开发者ID:dbunibas,项目名称:spicy,代码行数:21,代码来源:ConnectionCreator.java

示例10: createConnectionFromFunctionImpl

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
private ConnectionInfo createConnectionFromFunctionImpl(Widget functionWidget, Widget targetWidget, LayerWidget mainLayer, LayerWidget connectionLayer, Stroke stroke) {
    ConnectionWidget connection = new ConnectionWidget(functionWidget.getScene());
    connection.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);
    connection.setSourceAnchor(AnchorFactory.createRectangularAnchor(functionWidget));
    connection.setTargetAnchor(AnchorFactory.createRectangularAnchor(targetWidget));
    connection.setStroke(stroke);

    CaratteristicheWidgetInterFunction caratteristicheWidget = (CaratteristicheWidgetInterFunction) mainLayer.getChildConstraint(functionWidget);

    connection.getActions().addAction(ActionFactory.createPopupMenuAction(new MyPopupProviderConnectionFunc(functionWidget.getScene(), mainLayer, caratteristicheWidget)));
    ConnectionInfo connectionInfo = new ConnectionInfo();
    connectionInfo.setTargetWidget(targetWidget);
    connectionInfo.setConnectionWidget(connection);
    connectionLayer.addChild(connection, connectionInfo);
    return connectionInfo;
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:17,代码来源:ConnectionCreator.java

示例11: testFlowLayoutWeightOverflow

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
public void testFlowLayoutWeightOverflow () {
    Scene scene = new Scene ();
    LayerWidget layer = new LayerWidget (scene);
    layer.setMinimumSize (new Dimension (300, 200));
    scene.addChild (layer);

    Widget vbox = new Widget (scene);
    vbox.setBorder (BorderFactory.createLineBorder (1, Color.BLACK));
    vbox.setLayout (LayoutFactory.createVerticalFlowLayout (LayoutFactory.SerialAlignment.JUSTIFY, 0));
    layer.addChild (vbox);

    Widget hbox1 = new Widget (scene);
    hbox1.setBorder (BorderFactory.createLineBorder (1, Color.BLUE));
    hbox1.setLayout (LayoutFactory.createHorizontalFlowLayout ());
    vbox.addChild (hbox1);

    Widget item1 = new LabelWidget (scene, "Item1");
    item1.setBorder (BorderFactory.createLineBorder (1, Color.GREEN));
    hbox1.addChild (item1);

    Widget item2 = new LabelWidget (scene, "Item2");
    item2.setBorder (BorderFactory.createLineBorder (1, Color.YELLOW));
    hbox1.addChild (item2, 1000);

    Widget item3 = new LabelWidget (scene, "Item3");
    item3.setBorder (BorderFactory.createLineBorder (1, Color.RED));
    hbox1.addChild (item3);

    Widget hbox2 = new Widget (scene);
    hbox2.setBorder (BorderFactory.createLineBorder (1, Color.BLUE));
    hbox2.setPreferredSize (new Dimension (200, 20));
    vbox.addChild (hbox2);
    
    Color color = (Color) (new DefaultLookFeel()).getBackground();
    assertScene (scene, color, new Rectangle (-5, -5, 210, 100));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:FlowLayoutWeightOverflow108052Test.java

示例12: testShow

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
public void testShow () {
    Scene scene = new Scene ();
    
    LayerWidget mainLayer = new LayerWidget (scene);
    scene.addChild(mainLayer);
    
    Widget w1 = new Widget (scene);
    w1.setBorder (BorderFactory.createLineBorder ());
    w1.setPreferredLocation (new Point (100, 100));
    w1.setPreferredSize (new Dimension (40, 20));
    mainLayer.addChild(w1);
    
    Widget w2 = new Widget (scene);
    w2.setBorder (BorderFactory.createLineBorder ());
    w2.setPreferredLocation (new Point (200, 100));
    w2.setPreferredSize (new Dimension (40, 20));
    mainLayer.addChild(w2);
    
    LayerWidget connLayer = new LayerWidget (scene);
    scene.addChild(connLayer);
    
    ConnectionWidget conn = new ConnectionWidget(scene);
    conn.setSourceAnchor(AnchorFactory.createRectangularAnchor(w1));
    conn.setTargetAnchor(AnchorFactory.createRectangularAnchor(w2));
    connLayer.addChild(conn);
    
    Color color = (Color) (new DefaultLookFeel()).getBackground();
    assertScene (scene, color,
            new Rectangle (99, 99, 42, 22),
            new Rectangle (199, 99, 42, 22),
            new Rectangle (138, 108, 64, 4)
    );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:BasicTest.java

示例13: testLabelOrientations

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
public void testLabelOrientations () {
    Scene scene = new Scene ();
    LayerWidget layer = new LayerWidget (scene);
    scene.addChild(layer);
    layer.addChild (new Widget (scene));

    createLabel (layer, "N O R M A L", 100, 100, LabelWidget.Orientation.NORMAL, LabelWidget.Alignment.LEFT, LabelWidget.VerticalAlignment.BASELINE).setPreferredBounds (null);
    createLabel (layer, "R O T A T E 9 0", 100, 100, LabelWidget.Orientation.ROTATE_90, LabelWidget.Alignment.LEFT, LabelWidget.VerticalAlignment.BASELINE).setPreferredBounds (null);

    createLabel (layer, "NORMAL BASELINE", 200, 100, LabelWidget.Orientation.NORMAL, LabelWidget.Alignment.BASELINE, LabelWidget.VerticalAlignment.BASELINE);
    createLabel (layer, "ROTATE90 BASELINE", 200, 300, LabelWidget.Orientation.ROTATE_90, LabelWidget.Alignment.BASELINE, LabelWidget.VerticalAlignment.BASELINE);

    createLabel (layer, "NORMAL LEFT,TOP", 400, 100, LabelWidget.Orientation.NORMAL, LabelWidget.Alignment.LEFT, LabelWidget.VerticalAlignment.TOP);
    createLabel (layer, "ROTATE90 LEFT,TOP", 400, 300, LabelWidget.Orientation.ROTATE_90, LabelWidget.Alignment.LEFT, LabelWidget.VerticalAlignment.TOP);

    createLabel (layer, "NORMAL CENTER", 600, 100, LabelWidget.Orientation.NORMAL, LabelWidget.Alignment.CENTER, LabelWidget.VerticalAlignment.CENTER);
    createLabel (layer, "ROTATE90 CENTER", 600, 300, LabelWidget.Orientation.ROTATE_90, LabelWidget.Alignment.CENTER, LabelWidget.VerticalAlignment.CENTER);

    createLabel (layer, "NORMAL RIGHT,BOTTOM", 800, 100, LabelWidget.Orientation.NORMAL, LabelWidget.Alignment.RIGHT, LabelWidget.VerticalAlignment.BOTTOM);
    createLabel (layer, "ROTATE90 RIGHT,BOTTOM", 800, 300, LabelWidget.Orientation.ROTATE_90, LabelWidget.Alignment.RIGHT, LabelWidget.VerticalAlignment.BOTTOM);

    BufferedImage snapshot = takeOneTimeSnapshot (scene);
    BufferedImage clean = clearRegions (snapshot, Color.RED,
            new Rectangle (100, 80, 100, 30),
            new Rectangle (80, 0, 30, 110),

            new Rectangle (190, 90, 130, 30),
            new Rectangle (380, 70, 110, 30),
            new Rectangle (610, 150, 120, 30),
            new Rectangle (810, 230, 150, 30),

            new Rectangle (180, 270, 30, 130),
            new Rectangle (380, 270, 30, 160),
            new Rectangle (650, 290, 30, 150),
            new Rectangle (945, 275, 30, 190)

    );
    Color color = (Color) (new DefaultLookFeel()).getBackground();
    assertCleaness (testCleaness (clean, color, Color.YELLOW, Color.RED), snapshot, clean);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:LabelOrientationTest.java

示例14: createLabel

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
private static LabelWidget createLabel (LayerWidget layer, String label, int x, int y, LabelWidget.Orientation orientation, LabelWidget.Alignment alignment, LabelWidget.VerticalAlignment verticalAlignment) {
    LabelWidget widget = new LabelWidget (layer.getScene (), label);
    widget.setOpaque (true);
    widget.setBackground (Color.YELLOW);
    widget.setPreferredLocation (new Point (x, y));
    widget.setPreferredBounds (new Rectangle (-20, -30, 180, 180));
    widget.setOrientation (orientation);
    widget.setAlignment (alignment);
    widget.setVerticalAlignment (verticalAlignment);
    layer.addChild (widget);
    return widget;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:LabelOrientationTest.java

示例15: ShedScene

import org.netbeans.api.visual.widget.LayerWidget; //导入方法依赖的package包/类
/**
 * Create initial visual configuration and set the presenter. This does not
 * draw the plan! Making sure that view (the scene) is correctly displaying
 * the model is responsibility of presenter.
 *
 * @param plan initial.
 */
public ShedScene(PoshPlan plan) {
    backgroundLayer = createBackground();
    addChild(backgroundLayer);
    widgetLayer = new LayerWidget(this);
    addChild(widgetLayer);
    connectionLayer = new LayerWidget(this);
    addChild(connectionLayer);
    dragAndDropLayer = new LayerWidget(this);
    addChild(dragAndDropLayer);

    widgetLayer.setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.LEFT_TOP, 0));
    
    dcPadding = new Widget(this);
    dcPadding.setMinimumSize(new Dimension(ShedWidgetFactory.HORIZONTAL_GAP, 1));
    widgetLayer.addChild(dcPadding);
    dcAnchor = new FixedWidgetAnchor(dcPadding, new Point(0, 0), Anchor.Direction.BOTTOM);
    
    dcEnvelope = new Widget(this);
    dcEnvelope.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.LEFT_TOP, ShedWidgetFactory.VERTICAL_GAP));
    widgetLayer.addChild(dcEnvelope);

    goalEnvelope = new ShedTriggerEnvelope(this, dcAnchor);
    dcEnvelope.addChild(goalEnvelope);
    drivesEnvelope = new ShedDrivesEnvelope(this);
    dcEnvelope.addChild(drivesEnvelope);

    presenter = new ShedPresenter(this, plan);

    getActions().addAction(ActionFactory.createWheelPanAction());
    getActions().addAction(ActionFactory.createPanAction());
    getActions().addAction(ActionFactory.createZoomAction(1.25, false));
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:40,代码来源:ShedScene.java


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