org.netbeans.api.visual.border.BorderFactory Java Examples

The following examples show how to use org.netbeans.api.visual.border.BorderFactory. 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: BlockWidget.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    if (previousState.isHovered() != state.isHovered()) {
        if (state.isHovered()) {
            this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
        } else {
            this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
        }
    }

    if (previousState.isSelected() != state.isSelected()) {
        if (state.isSelected()) {
            this.setFont(boldFont);
        } else {
            this.setFont(font);
        }
    }
}
 
Example #2
Source File: OpenSimObjectWidget.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
public OpenSimObjectWidget (Scene scene) {
    super (scene);
    setLayout (LayoutFactory.createVerticalFlowLayout ());
    setBorder (BorderFactory.createLineBorder ());
    setOpaque (true);
    setCheckClipping (true);
    
    Widget classWidget = new Widget (scene);
    classWidget.setLayout (LayoutFactory.createHorizontalFlowLayout ());
    classWidget.setBorder (BORDER_4);

    ImageWidget classImage = new ImageWidget (scene);
    classImage.setImage (IMAGE_CLASS);
    classWidget.addChild (classImage);

    className = new LabelWidget (scene);
    className.setFont (scene.getDefaultFont ().deriveFont (Font.BOLD));
    classWidget.addChild (className);
    addChild (classWidget);

}
 
Example #3
Source File: BlockWidget.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    if (previousState.isHovered() != state.isHovered()) {
        if (state.isHovered()) {
            this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
        } else {
            this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
        }
    }

    if (previousState.isSelected() != state.isSelected()) {
        if (state.isSelected()) {
            this.setFont(boldFont);
        } else {
            this.setFont(font);
        }
    }
}
 
Example #4
Source File: BlockWidget.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    if (previousState.isHovered() != state.isHovered()) {
        if (state.isHovered()) {
            this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
        } else {
            this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
        }
    }

    if (previousState.isSelected() != state.isSelected()) {
        if (state.isSelected()) {
            this.setFont(boldFont);
        } else {
            this.setFont(font);
        }
    }
}
 
Example #5
Source File: BlockWidget.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    if (previousState.isHovered() != state.isHovered()) {
        if (state.isHovered()) {
            this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
        } else {
            this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
        }
    }

    if (previousState.isSelected() != state.isSelected()) {
        if (state.isSelected()) {
            this.setFont(boldFont);
        } else {
            this.setFont(font);
        }
    }
}
 
Example #6
Source File: BlockWidget.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    if (previousState.isHovered() != state.isHovered()) {
        if (state.isHovered()) {
            this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
        } else {
            this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
        }
    }

    if (previousState.isSelected() != state.isSelected()) {
        if (state.isSelected()) {
            this.setFont(boldFont);
        } else {
            this.setFont(font);
        }
    }
}
 
Example #7
Source File: BlockWidget.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    if (previousState.isHovered() != state.isHovered()) {
        if (state.isHovered()) {
            this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
        } else {
            this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
        }
    }

    if (previousState.isSelected() != state.isSelected()) {
        if (state.isSelected()) {
            this.setFont(boldFont);
        } else {
            this.setFont(font);
        }
    }
}
 
Example #8
Source File: ParametersWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void createContent() {
    model = new ParametersTableModel(method, nameEditable);
    populateContentWidget(getContentWidget());
    getContentWidget().setBorder(BorderFactory.createEmptyBorder(0,1,1,1));
    headerLabelWidget = new ImageLabelWidget(getScene(), getIcon(), getTitle(), 
            "("+method.getParams().size()+")");
    headerLabelWidget.setLabelFont(getScene().getFont().deriveFont(Font.BOLD));
    getHeaderWidget().addChild(new Widget(getScene()),5);
    getHeaderWidget().addChild(headerLabelWidget);
    getHeaderWidget().addChild(new Widget(getScene()),4);

    buttons = new Widget(getScene());
    buttons.setLayout(LayoutFactory.createHorizontalFlowLayout(
            LayoutFactory.SerialAlignment.CENTER, 8));

    buttons.addChild(getExpanderWidget());
    buttons.setOpaque(true);
    buttons.setBackground(TITLE_COLOR_BRIGHT);

    getHeaderWidget().addChild(buttons);

}
 
Example #9
Source File: FaultsWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void createContent() {
    model = new FaultsTableModel(method);
    populateContentWidget(getContentWidget());
    getContentWidget().setBorder(BorderFactory.createEmptyBorder(0,1,1,1));
    headerLabelWidget = new ImageLabelWidget(getScene(), getIcon(), getTitle(), 
            "("+method.getFaults().size()+")");
    headerLabelWidget.setLabelFont(getScene().getFont().deriveFont(Font.BOLD));
    getHeaderWidget().addChild(new Widget(getScene()),5);
    getHeaderWidget().addChild(headerLabelWidget);
    getHeaderWidget().addChild(new Widget(getScene()),4);

    buttons = new Widget(getScene());
    buttons.setLayout(LayoutFactory.createHorizontalFlowLayout(
            LayoutFactory.SerialAlignment.CENTER, 8));

    buttons.addChild(getExpanderWidget());

    getHeaderWidget().addChild(buttons);
}
 
Example #10
Source File: OffscreenRenderingTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example #11
Source File: ListWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a list widget.
 * @param scene the scene
 */
public ListWidget (Scene scene) {
    super (scene);
    GeomUtil.LOG.warning ("org.netbeans.api.visual.widget.general.ListWidget class is deprecated. Use org.netbeans.modules.visual.experimental.widget.general.ListWidget class instead. Since it is an experimental class outside of public-API packages, you have to set an implementation dependency on the org.netbeans.api.visual module."); // NOI18N

    LookFeel lookFeel = scene.getLookFeel ();
    setOpaque (true);
    setBackground (lookFeel.getBackground ());
    setBorder (BorderFactory.createLineBorder ());
    setLayout (LayoutFactory.createVerticalFlowLayout ());

    header = new Widget (scene);
    header.setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, 0));
    header.addChild (imageWidget = new ImageWidget (scene));
    header.addChild (labelWidget = new LabelWidget (scene));
    addChild (header);

    addChild (new SeparatorWidget (scene, SeparatorWidget.Orientation.HORIZONTAL));

    setState (ObjectState.createNormal ());
}
 
Example #12
Source File: ListWidget.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a list widget.
 * @param scene the scene
 */
public ListWidget (Scene scene) {
    super (scene);

    LookFeel lookFeel = scene.getLookFeel ();
    setOpaque (true);
    setBackground (lookFeel.getBackground ());
    setBorder (BorderFactory.createLineBorder ());
    setLayout (LayoutFactory.createVerticalFlowLayout ());

    header = new Widget (scene);
    header.setLayout (LayoutFactory.createHorizontalFlowLayout (LayoutFactory.SerialAlignment.CENTER, 0));
    header.addChild (imageWidget = new ImageWidget (scene));
    header.addChild (labelWidget = new LabelWidget (scene));
    addChild (header);

    addChild (new SeparatorWidget (scene, SeparatorWidget.Orientation.HORIZONTAL));

    setState (ObjectState.createNormal ());
}
 
Example #13
Source File: BlockWidget.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    if (previousState.isHovered() != state.isHovered()) {
        if (state.isHovered()) {
            this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
        } else {
            this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
        }
    }

    if (previousState.isSelected() != state.isSelected()) {
        if (state.isSelected()) {
            this.setFont(boldFont);
        } else {
            this.setFont(font);
        }
    }
}
 
Example #14
Source File: BlockWidget.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    if (previousState.isHovered() != state.isHovered()) {
        if (state.isHovered()) {
            this.setBorder(BorderFactory.createLineBorder(1, HOVER_FOREGROUND_COLOR));
        } else {
            this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
        }
    }

    if (previousState.isSelected() != state.isSelected()) {
        if (state.isSelected()) {
            this.setFont(boldFont);
        } else {
            this.setFont(font);
        }
    }
}
 
Example #15
Source File: BlockWidget.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #16
Source File: SampleMessageWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** 
 * Creates a new instance of SampleMessageWidget 
 * @param scene 
 * @param operation 
 * @param type 
 */
public SampleMessageWidget(ObjectScene scene, MethodModel operation, Type type) {
    super(scene,0,12,0,TITLE_COLOR);
    this.operation = operation;
    this.type = type;

    headerLabelWidget = new ImageLabelWidget(scene, null, operation.getOperationName()+": ",type.getTitle());
    headerLabelWidget.setLabelFont(scene.getFont().deriveFont(Font.BOLD));
    headerLabelWidget.setPaintAsDisabled(false);
    headerLabelWidget.setLabelForeground(type.getBorderColor());
    getHeaderWidget().addChild(new Widget(getScene()),1);
    getHeaderWidget().addChild(headerLabelWidget);
    getHeaderWidget().addChild(new Widget(getScene()),1);

    buttons = new Widget(getScene());
    buttons.setLayout(LayoutFactory.createHorizontalFlowLayout(
            LayoutFactory.SerialAlignment.JUSTIFY, 8));
    getHeaderWidget().addChild(buttons);
    final ButtonWidget closeButton = new ButtonWidget(getScene(), (String)null);
    closeButton.setImage(new ExpanderImageWidget(scene,type.getBorderColor(),8));
    closeButton.setRoundedBorder(0, 4, 4,type.getBorderColor());
    closeButton.setAction(new AbstractAction() {
        public void actionPerformed(ActionEvent arg0) {
            SampleMessageWidget.this.removeFromParent();
        }
    });
    buttons.addChild(closeButton);

    paneWidget = new EditorPaneWidget(scene, 
            Utils.getFormatedDocument(type.getMessage(operation)),"text/xml");
    paneWidget.setEditable(false);
    getContentWidget().addChild(paneWidget);
    getContentWidget().setBorder(BorderFactory.createEmptyBorder(12, 6));
}
 
Example #17
Source File: DescriptionWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void populateContentWidget(Widget parentWidget) {
    EditorPaneWidget descPaneWidget = new EditorPaneWidget(getScene(),model.getText(),"text/java");
    descPaneWidget.setBorder(BorderFactory.createEmptyBorder(1));
    descPaneWidget.setEditable(true);
    descPaneWidget.addDocumentListener(listener);
    parentWidget.addChild(descPaneWidget);
}
 
Example #18
Source File: ImageLabelWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    if (previousState.isFocused() != state.isFocused()) {
        labelWidget.setBorder(state.isFocused()?BorderFactory.createDashedBorder
                (getForeground(), 2, 2, true):BorderFactory.createEmptyBorder());
        revalidate(true);
    }
}
 
Example #19
Source File: OperationsWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void createContent(ProjectService service) {
    if (serviceModel==null) {
        return;
    }
    
    headerLabelWidget = new ImageLabelWidget(getScene(), null,
            NbBundle.getMessage(OperationWidget.class, "LBL_Operations"));
    headerLabelWidget.setLabelFont(getScene().getFont().deriveFont(Font.BOLD));
    getHeaderWidget().addChild(headerLabelWidget);
    getHeaderWidget().addChild(new Widget(getScene()),1);
    updateHeaderLabel();
    
    buttons = new Widget(getScene());
    buttons.setLayout(LayoutFactory.createHorizontalFlowLayout(
            LayoutFactory.SerialAlignment.CENTER, 8));
    
    ButtonWidget addButton = new ButtonWidget(getScene(), addAction);
    addButton.setOpaque(true);
    addButton.setRoundedBorder(addButton.BORDER_RADIUS, 4, 0, null);
    
    removeAction = new RemoveOperationAction(service);
    ButtonWidget removeButton = new ButtonWidget(getScene(), removeAction);
    removeButton.setOpaque(true);
    removeButton.setRoundedBorder(removeButton.BORDER_RADIUS, 4, 0, null);
    
    buttons.addChild(addButton);
    buttons.addChild(removeButton);
    buttons.addChild(getExpanderWidget());
    
    getHeaderWidget().addChild(buttons);
    
    getContentWidget().setBorder(BorderFactory.createEmptyBorder(RADIUS));
    if(serviceModel.getOperations()!=null) {
        for(MethodModel operation:serviceModel.getOperations()) {
            OperationWidget operationWidget = new OperationWidget(getObjectScene(), 
                    serviceModel, service, operation);
            getContentWidget().addChild(operationWidget);
        }
    }
}
 
Example #20
Source File: BlockWidget.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #21
Source File: BlockWidget.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(MIN_SIZE);

    this.setFont(font);
    this.setAlignment(Alignment.CENTER);

    final BlockWidget widget = this;
    inputSlot = new Port() {
        public Point getRelativePosition() {
            return new Point((int) (getSize().getWidth() / 2), (int) (getSize().getHeight() / 2));
        }
        public Vertex getVertex() {
            return widget;
        }
    };
    outputSlot = new Port() {
        public Point getRelativePosition() {
            return new Point((int) (getSize().getWidth() / 2), (int) (getSize().getHeight() / 2));
        }
        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #22
Source File: OperationWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public TabImageWidget(Scene scene, int size) {
    super(scene, Color.LIGHT_GRAY, size, size);
    setBorder(BorderFactory.createLineBorder(0, Color.LIGHT_GRAY));
    setBackground(Color.WHITE);
    setOpaque(true);
    setToolTipText(NbBundle.getMessage(OperationWidget.class, "Hint_TabbedView"));
}
 
Example #23
Source File: BlockWidget.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #24
Source File: BlockWidget.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #25
Source File: BlockWidget.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #26
Source File: BlockWidget.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #27
Source File: DB_VMDGraph.java    From BART with MIT License 5 votes vote down vote up
public DB_VMDGraph(IDatabase db,String topCompName) {
    scene = new VMDGraphScene();
    this.db=db;
    this.topCompName = topCompName;
    highlighterErrorBorderAttr = BorderFactory.createLineBorder(3, Color.MAGENTA);
    emptyBorder = BorderFactory.createEmptyBorder();
    graphLayout = new GridGraphLayout<String, String> ();
    sceneGraphLayout = LayoutFactory.createSceneGraphLayout(scene, graphLayout);
    createTables();
    createEdges();
}
 
Example #28
Source File: RuleScene.java    From jlibs with Apache License 2.0 5 votes vote down vote up
private LabelWidget createEdgeLabel(Edge edge){
    LabelWidget label = new LabelWidget(this, edge.toString());
    label.setFont(Util.FIXED_WIDTH_FONT);
    label.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));

    label.getActions().addAction(hoverAction);
    label.getActions().addAction(editAction);
    label.getActions().addAction(moveAction);
    label.getActions().addAction(edgePopupAction);
    return label;
}
 
Example #29
Source File: BlockWidget.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #30
Source File: TableWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    if (previousState.isSelected() != state.isSelected() ||
            previousState.isFocused() != state.isFocused()) {
        setBorder(state.isSelected() ? state.isFocused()?
            BorderFactory.createDashedBorder(SELECTED_BORDER_COLOR, 2, 2, true):
            BorderFactory.createLineBorder(1,SELECTED_BORDER_COLOR) : 
            state.isFocused() ? BorderFactory.createDashedBorder
            (BORDER_COLOR, 2, 2, true):new LineBorder(1,0,0,0,BORDER_COLOR));
        revalidate(true);
    }
}