Java Code Examples for org.netbeans.api.visual.model.ObjectState#isHovered()

The following examples show how to use org.netbeans.api.visual.model.ObjectState#isHovered() . 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: MultiConnectionWidget.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void paintWidget() {
    Graphics2D g = getScene().getGraphics();
    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    g.setColor(this.color);
    ObjectState state = this.getState();
    float width = 1.0f;
    if (state.isHovered() || this.popupVisible) {
        width = HOVER_STROKE_WIDTH;
    }

    Stroke oldStroke = g.getStroke();
    g.setStroke(new BasicStroke(width));
    for (Route r : routeList) {
        g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y);
    }
    g.setStroke(oldStroke);
}
 
Example 2
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 3
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 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: MultiConnectionWidget.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void paintWidget() {
    Graphics2D g = getScene().getGraphics();
    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    g.setColor(this.color);
    ObjectState state = this.getState();
    float width = 1.0f;
    if (state.isHovered() || this.popupVisible) {
        width = HOVER_STROKE_WIDTH;
    }

    Stroke oldStroke = g.getStroke();
    g.setStroke(new BasicStroke(width));
    for (Route r : routeList) {
        g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y);
    }
    g.setStroke(oldStroke);
}
 
Example 6
Source File: MultiConnectionWidget.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void paintWidget() {
    Graphics2D g = getScene().getGraphics();
    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    g.setColor(this.color);
    ObjectState state = this.getState();
    float width = 1.0f;
    if (state.isHovered() || this.popupVisible) {
        width = HOVER_STROKE_WIDTH;
    }

    Stroke oldStroke = g.getStroke();
    g.setStroke(new BasicStroke(width));
    for (Route r : routeList) {
        g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y);
    }
    g.setStroke(oldStroke);
}
 
Example 7
Source File: MultiConnectionWidget.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void paintWidget() {
    Graphics2D g = getScene().getGraphics();
    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    g.setColor(this.color);
    ObjectState state = this.getState();
    float width = 1.0f;
    if (state.isHovered() || this.popupVisible) {
        width = HOVER_STROKE_WIDTH;
    }

    Stroke oldStroke = g.getStroke();
    g.setStroke(new BasicStroke(width));
    for (Route r : routeList) {
        g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y);
    }
    g.setStroke(oldStroke);
}
 
Example 8
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 9
Source File: MultiConnectionWidget.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void paintWidget() {
    Graphics2D g = getScene().getGraphics();
    //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    g.setColor(this.color);
    ObjectState state = this.getState();
    float width = 1.0f;
    if (state.isHovered() || this.popupVisible) {
        width = HOVER_STROKE_WIDTH;
    }

    Stroke oldStroke = g.getStroke();
    g.setStroke(new BasicStroke(width));
    for (Route r : routeList) {
        g.drawLine(r.from.x, r.from.y, r.to.x, r.to.y);
    }
    g.setStroke(oldStroke);
}
 
Example 10
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 11
Source File: MultiConnectionWidget.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {

    boolean repaint = false;

    if (state.isHovered() != previousState.isHovered()) {
        repaint = true;
    }

    repaint();
}
 
Example 12
Source File: MultiConnectionWidget.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {

    boolean repaint = false;

    if (state.isHovered() != previousState.isHovered()) {
        repaint = true;
    }

    repaint();
}
 
Example 13
Source File: DefaultLookFeel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Border getMiniBorder (ObjectState state) {
    if (state.isHovered ())
        return MINI_BORDER_HOVERED;
    if (state.isSelected ())
        return MINI_BORDER_SELECTED;
    if (state.isFocused ())
        return MINI_BORDER_HOVERED;
    return MINI_BORDER_NORMAL;
}
 
Example 14
Source File: FigureWidget.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    Color borderColor = Color.BLACK;
    int thickness = 1;
    boolean repaint = false;
    Font f = font;
    if (state.isSelected()) {
        thickness = 1;
        f = boldFont;
    }

    if (state.isHovered()) {
        borderColor = Color.BLUE;
    }

    if (state.isHovered() != previousState.isHovered()) {
        repaint = true;
    }

    if (state.isSelected() != previousState.isSelected()) {
        repaint = true;
    }

    if (repaint) {
        middleWidget.setBorder(BorderFactory.createLineBorder(borderColor, thickness));
        for (LabelWidget labelWidget : labelWidgets) {
            labelWidget.setFont(f);
        }
        repaint();
    }
}
 
Example 15
Source File: MultiConnectionWidget.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {

    boolean repaint = false;

    if (state.isHovered() != previousState.isHovered()) {
        repaint = true;
    }

    repaint();
}
 
Example 16
Source File: FigureWidget.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    super.notifyStateChanged(previousState, state);

    Color borderColor = Color.BLACK;
    int thickness = 1;
    boolean repaint = false;
    Font f = font;
    if (state.isSelected()) {
        thickness = 1;
        f = boldFont;
    }

    if (state.isHovered()) {
        borderColor = Color.BLUE;
    }

    if (state.isHovered() != previousState.isHovered()) {
        repaint = true;
    }

    if (state.isSelected() != previousState.isSelected()) {
        repaint = true;
    }

    if (repaint) {
        middleWidget.setBorder(BorderFactory.createLineBorder(borderColor, thickness));
        for (LabelWidget labelWidget : labelWidgets) {
            labelWidget.setFont(f);
        }
        repaint();
    }
}
 
Example 17
Source File: LineWidget.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    if (previousState.isHovered() != state.isHovered()) {
        setRecursiveHighlighted(state.isHovered());
    }
}
 
Example 18
Source File: LineWidget.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    if (previousState.isHovered() != state.isHovered()) {
        setRecursiveHighlighted(state.isHovered());
    }
}
 
Example 19
Source File: LineWidget.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    if (previousState.isHovered() != state.isHovered()) {
        setRecursiveHighlighted(state.isHovered());
    }
}
 
Example 20
Source File: LineWidget.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void notifyStateChanged(ObjectState previousState, ObjectState state) {
    if (previousState.isHovered() != state.isHovered()) {
        setRecursiveHighlighted(state.isHovered());
    }
}