Java Code Examples for org.netbeans.api.visual.widget.Widget#setBorder()

The following examples show how to use org.netbeans.api.visual.widget.Widget#setBorder() . 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: GraphColorScheme.java    From Llunatic with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void installUI(VMDNodeWidget widget) {
    widget.setBorder(VMDFactory.createVMDNodeBorder());
    widget.setOpaque(false);
    
    Widget header = widget.getHeader();
    header.setBorder(HEADER_BORDER_PIN);
    header.setBackground(COLOR_SELECTED);
    header.setOpaque(false);
    
    Widget minimize = widget.getMinimizeButton();
    minimize.setBorder(BORDER_MINIMIZE);
    
    Widget pinsSeparator = widget.getPinsSeparator();
    pinsSeparator.setForeground(BORDER_CATEGORY_BACKGROUND);
}
 
Example 2
Source File: DBColorScheme.java    From jeddict with Apache License 2.0 6 votes vote down vote up
@Override
public void installUI(IPNodeWidget widget) {
    widget.setBorder(WIDGET_BORDER);
    Widget header = widget.getHeader();
    Rectangle bound = widget.getHeader().getBounds();
    if (bound == null) {
        bound = HEADER_BOUND;
    }
    GradientPaint gp = new GradientPaint(bound.x + bound.width / 2, bound.y, WIDGET_LBACKGROUND, bound.x + bound.width / 2, bound.y + bound.height, WIDGET_BACKGROUND);
    header.setBackground(gp);
    header.setBorder(OPAQUE_BORDER);
    widget.getHeader().setOpaque(true);
    widget.getNodeNameWidget().setForeground(Color.WHITE);
    Font font = widget.getNodeNameWidget().getFont()!=null?widget.getNodeNameWidget().getFont():widget.getScene().getDefaultFont();
    widget.getNodeNameWidget().setFont(font.deriveFont(Font.BOLD, 12));
    Widget pinsSeparator = widget.getPinsSeparator();
    pinsSeparator.setForeground(PIN_SEPERATOR_WIDGET_BACKGROUND);
    widget.getMinimizeButton().setImage(this.getMinimizeWidgetImage(widget));
}
 
Example 3
Source File: GraphColorScheme.java    From Llunatic with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void updateUI(VMDNodeWidget widget, ObjectState previousState, ObjectState state) {
    if (!previousState.isSelected() && state.isSelected()) {
        widget.bringToFront();
    } else if (!previousState.isHovered() && state.isHovered()) {
        widget.bringToFront();
    }
    Widget header = widget.getHeader();
    header.setOpaque(state.isSelected());
    if (state.isFocused() || state.isHovered()) {
        header.setBorder(BORDER_PIN_HOVERED);
    } else {
        header.setBorder(HEADER_BORDER_PIN);
    }
    
}
 
Example 4
Source File: ControlFlowScene.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Widget createSelectionWidget() {
    Widget widget = new Widget(this);
    widget.setOpaque(false);
    widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
    widget.setForeground(Color.red);
    return widget;
}
 
Example 5
Source File: ControlFlowScene.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Widget createSelectionWidget() {
    Widget widget = new Widget(this);
    widget.setOpaque(false);
    widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
    widget.setForeground(Color.red);
    return widget;
}
 
Example 6
Source File: ControlFlowScene.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Widget createSelectionWidget() {
    Widget widget = new Widget(this);
    widget.setOpaque(false);
    widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
    widget.setForeground(Color.red);
    return widget;
}
 
Example 7
Source File: ControlFlowScene.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Widget createSelectionWidget() {
    Widget widget = new Widget(this);
    widget.setOpaque(false);
    widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
    widget.setForeground(Color.red);
    return widget;
}
 
Example 8
Source File: ControlFlowScene.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Widget createSelectionWidget() {
    Widget widget = new Widget(this);
    widget.setOpaque(false);
    widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
    widget.setForeground(Color.red);
    return widget;
}
 
Example 9
Source File: TabbedPaneWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param scene
 */
public TabbedPaneWidget(Scene scene) {
    super(scene);
    setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 1));
    tabs = new Widget(scene);
    addChild(tabs);
    contentWidget = new Widget(scene);
    contentWidget.setLayout(LayoutFactory.createOverlayLayout());
    contentWidget.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 1, 1, 1, TAB_BORDER_COLOR));
    addChild(contentWidget);
}
 
Example 10
Source File: AbstractTitledWidget.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected final Widget createContentWidget() {
    Widget widget = new Widget(getScene());
    widget.setLayout(LayoutFactory.createVerticalFlowLayout(
            LayoutFactory.SerialAlignment.JUSTIFY, cgap));
    widget.setBorder(BorderFactory.createEmptyBorder(cgap));
    return widget;
}
 
Example 11
Source File: FlowLayoutWeightOverflow108052Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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));
}
 
Example 12
Source File: FlowLayout105400Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testFlowLayoutInsets () {
    Scene scene = new Scene ();
    Widget parent = new Widget (scene);
    parent.setBorder (BorderFactory.createResizeBorder (10));
    parent.setLayout (LayoutFactory.createVerticalFlowLayout ());
    scene.addChild (parent);

    Widget child = new Widget (scene);
    child.setBackground (Color.BLUE);
    child.setOpaque (true);
    child.setPreferredBounds (new Rectangle (-50, -30, 30, 20));
    parent.addChild (child);

    assertScene (scene, Color.WHITE, new Rectangle (-1, -1, 52, 42));
}
 
Example 13
Source File: VMDNetBeans60ColorScheme.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void installUI (VMDNodeWidget widget) {
    widget.setBorder (BORDER60);

    Widget header = widget.getHeader ();
    header.setBackground (COLOR60_HOVER_BACKGROUND);
    header.setBorder (VMDOriginalColorScheme.BORDER_PIN);

    Widget pinsSeparator = widget.getPinsSeparator ();
    pinsSeparator.setForeground (VMDOriginalColorScheme.BORDER_CATEGORY_BACKGROUND);
}
 
Example 14
Source File: VMDOriginalColorScheme.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void updateUI (VMDNodeWidget widget, ObjectState previousState, ObjectState state) {
    if (! previousState.isSelected ()  &&  state.isSelected ())
        widget.bringToFront ();
    else if (! previousState.isHovered ()  &&  state.isHovered ())
        widget.bringToFront ();

    Widget header = widget.getHeader ();
    header.setOpaque (state.isSelected ());
    header.setBorder (state.isFocused () || state.isHovered () ? BORDER_PIN_HOVERED : BORDER_PIN);
}
 
Example 15
Source File: VMDOriginalColorScheme.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void installUI (VMDNodeWidget widget) {
    widget.setBorder (VMDFactory.createVMDNodeBorder ());
    widget.setOpaque (false);

    Widget header = widget.getHeader ();
    header.setBorder (BORDER_PIN);
    header.setBackground (COLOR_SELECTED);
    header.setOpaque (false);

    Widget minimize = widget.getMinimizeButton ();
    minimize.setBorder (BORDER_MINIMIZE);

    Widget pinsSeparator = widget.getPinsSeparator ();
    pinsSeparator.setForeground (BORDER_CATEGORY_BACKGROUND);
}
 
Example 16
Source File: ControlFlowScene.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Widget createSelectionWidget() {
    Widget widget = new Widget(this);
    widget.setOpaque(false);
    widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
    widget.setForeground(Color.red);
    return widget;
}
 
Example 17
Source File: ControlFlowScene.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Widget createSelectionWidget() {
    Widget widget = new Widget(this);
    widget.setOpaque(false);
    widget.setBorder(BorderFactory.createLineBorder(Color.black, 2));
    widget.setForeground(Color.red);
    return widget;
}
 
Example 18
Source File: DesignView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new instance of GraphView.
 * @param service
 * @param implementationClass
 */
public DesignView(ProjectService service, FileObject implementationClass) {
    super(new BorderLayout());
    
    this.service = service;
    this.implementationClass = implementationClass;
    
    scene = new ObjectScene() {
        @Override
        /**
         * Use our own traversal policy
         */
        public Comparable<DesignerWidgetIdentityCode> getIdentityCode(Object object) {
            return new DesignerWidgetIdentityCode(scene,object);
        }
    };
    zoomer = new ZoomManager(scene);

    scene.getActions().addAction(ActionFactory.createCycleObjectSceneFocusAction());
    scene.setKeyEventProcessingType (EventProcessingType.FOCUSED_WIDGET_AND_ITS_PARENTS);

    mainLayer = new LayerWidget(scene);
    mainLayer.setPreferredLocation(new Point(0, 0));
    mainLayer.setLayout(LayoutFactory.createVerticalFlowLayout(
            LayoutFactory.SerialAlignment.JUSTIFY, 12));
    scene.addChild(mainLayer);
    
    mainWidget = new Widget(scene);
    mainWidget.setLayout(LayoutFactory.createVerticalFlowLayout(
            LayoutFactory.SerialAlignment.JUSTIFY, 12));
    
    headerWidget = new LabelWidget(scene);
    headerWidget.setFont(scene.getFont().deriveFont(Font.BOLD));
    headerWidget.setForeground(Color.GRAY);
    headerWidget.setBorder(BorderFactory.createEmptyBorder(6,28,0,0));
    mainWidget.addChild(headerWidget);
    
    separatorWidget = new SeparatorWidget(scene,
            SeparatorWidget.Orientation.HORIZONTAL);
    separatorWidget.setForeground(Color.ORANGE);
    mainWidget.addChild(separatorWidget);
    
    contentWidget = new Widget(scene);
    contentWidget.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
    contentWidget.setLayout(LayoutFactory.createVerticalFlowLayout(
            LayoutFactory.SerialAlignment.JUSTIFY, 16));
    mainWidget.addChild(contentWidget);
    
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER){
        /* (non-Javadoc)
         * @see java.awt.FlowLayout#layoutContainer(java.awt.Container)
         */
        @Override
        public void layoutContainer( Container target ) {
            super.layoutContainer(target);
            Component[] components = target.getComponents();
            double height = target.getSize().getHeight()/2;
            for (Component component : components) {
                Point location = component.getLocation();
                component.setLocation( (int)location.getX(), (int)height );
            }
        }
    });
    panel.add(new JLabel(NbBundle.getMessage( DesignView.class, "LBL_Wait")));
    add( panel,BorderLayout.CENTER);
    
    mainLayer.addChild(mainWidget);

    messageWidget = new Widget(scene);
    messageWidget.setLayout(LayoutFactory.createVerticalFlowLayout(
            LayoutFactory.SerialAlignment.JUSTIFY, 4));
    mainLayer.addChild(messageWidget);
    scene.addObject(messageLayerKey, messageWidget);
    
    initServiceModel();
}
 
Example 19
Source File: DefaultRectangularSelectDecorator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Widget createSelectionWidget () {
    Widget widget = new Widget (scene);
    widget.setBorder (scene.getLookFeel ().getMiniBorder (ObjectState.createNormal ().deriveSelected (true)));
    return widget;
}
 
Example 20
Source File: topologyEditorTopComponent.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
private void populateDefault() {
        currentModel = OpenSimDB.getInstance().getCurrentModel();
        if (currentModel == null) return;
        scene.addNode("ground");
        GraphLayoutSupport.setTreeGraphLayoutRootNode (graphLayout, "ground");
        final SceneLayout sceneGraphLayout = LayoutFactory.createSceneGraphLayout (scene, graphLayout);
        WidgetAction editAction = ActionFactory.createEditAction (new MyEditProvider (sceneGraphLayout));
        scene.getActions().addAction (editAction);
        JointSet jnts = currentModel.getJointSet();
        int numJoints = jnts.getSize();
        for (int j=0; j<numJoints; j++ ){
            Joint jnt = jnts.get(j);
            String childFrameName = jnt.getChildFrame().findBaseFrame().getName();
            String parentFrameName = jnt.getParentFrame().findBaseFrame().getName();
            //LabelWidget bodyWidget= new LabelWidget(scene, "Body:"+bod.getName());
            Widget bodyWidget = scene.addNode(childFrameName);
            //bodyWidget.setPreferredLocation (new Point (b*30, b*50));
            bodyWidget.getActions().addAction (editAction);
            Widget jntWidget = scene.addNode(jnt.getName());
            jntWidget.setBorder(ModelGraphScene.getBORDER_0());
            //String edgeID = bod.getJoint().getName();
            String jntToParent = parentFrameName+ "_"+jnt.getName();
            scene.addEdge(jntToParent);
            scene.setEdgeSource (jntToParent, parentFrameName);
            scene.setEdgeTarget (jntToParent, jnt.getName());
            String jntToChild = childFrameName+ "_"+jnt.getName();
            scene.addEdge(jntToChild);
            scene.setEdgeSource (jntToChild, jnt.getName());
            scene.setEdgeTarget (jntToChild, childFrameName);
    }
        scene.validate();
        
        
        //add(scene.createSatelliteView(), BorderLayout.EAST); 
        sceneGraphLayout.invokeLayoutImmediately ();
        scene.validate();
        scene.getActions ().addAction (ActionFactory.createEditAction (new EditProvider() {
            public void edit (Widget widget) {
                // new implementation
                sceneGraphLayout.invokeLayoutImmediately ();
                // old implementation
//                new TreeGraphLayout<String, String> (TreeGraphLayoutTest.this, 100, 100, 50, 50, true).layout ("root");
            }
        }));

    }