Java Code Examples for javafx.scene.shape.Rectangle#setEffect()

The following examples show how to use javafx.scene.shape.Rectangle#setEffect() . 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: StopWatchSample.java    From marathonv5 with Apache License 2.0 7 votes vote down vote up
private Rectangle createBackground(Color stroke, Color fill) {
    Rectangle background = new Rectangle(14, 17, fill);
    background.setStroke(stroke);
    background.setStrokeWidth(2);
    background.setEffect(new Lighting());
    background.setCache(true);
    return background;
}
 
Example 2
Source File: Undecorator.java    From DevToolBox with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Prepare Stage for dock feedback display
 */
void buildDockFeedbackStage() {
    dockFeedbackPopup = new Stage(StageStyle.TRANSPARENT);
    dockFeedback = new Rectangle(0, 0, 100, 100);
    dockFeedback.setArcHeight(10);
    dockFeedback.setArcWidth(10);
    dockFeedback.setFill(Color.TRANSPARENT);
    dockFeedback.setStroke(Color.BLACK);
    dockFeedback.setStrokeWidth(2);
    dockFeedback.setCache(true);
    dockFeedback.setCacheHint(CacheHint.SPEED);
    dockFeedback.setEffect(new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 10, 0.2, 3, 3));
    dockFeedback.setMouseTransparent(true);
    BorderPane borderpane = new BorderPane();
    borderpane.setStyle("-fx-background-color:transparent"); //J8
    borderpane.setCenter(dockFeedback);
    Scene scene = new Scene(borderpane);
    scene.setFill(Color.TRANSPARENT);
    dockFeedbackPopup.setScene(scene);
    dockFeedbackPopup.sizeToScene();
}
 
Example 3
Source File: RectangleSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    Rectangle rectangle = new Rectangle(40,40);
    rectangle.setStroke(Color.web("#b9c0c5"));
    rectangle.setStrokeWidth(5);
    rectangle.getStrokeDashArray().addAll(15d,15d);
    rectangle.setFill(null);
    javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
    effect.setOffsetX(1);
    effect.setOffsetY(1);
    effect.setRadius(3);
    effect.setColor(Color.rgb(0,0,0,0.6));
    rectangle.setEffect(effect);
    return rectangle;
}
 
Example 4
Source File: RectangleSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    Rectangle rectangle = new Rectangle(40,40);
    rectangle.setStroke(Color.web("#b9c0c5"));
    rectangle.setStrokeWidth(5);
    rectangle.getStrokeDashArray().addAll(15d,15d);
    rectangle.setFill(null);
    javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
    effect.setOffsetX(1);
    effect.setOffsetY(1);
    effect.setRadius(3);
    effect.setColor(Color.rgb(0,0,0,0.6));
    rectangle.setEffect(effect);
    return rectangle;
}
 
Example 5
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private Rectangle createBackground(Color stroke, Color fill) {
    Rectangle background = new Rectangle(14, 17, fill);
    background.setStroke(stroke);
    background.setStrokeWidth(2);
    background.setEffect(new Lighting());
    background.setCache(true);
    return background;
}
 
Example 6
Source File: StopWatch.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Rectangle createBackground(Color stroke, Color fill) {
    Rectangle background = new Rectangle(14, 17, fill);
    background.setStroke(stroke);
    background.setStrokeWidth(2);
    background.setEffect(new Lighting());
    background.setCache(true);
    return background;
}
 
Example 7
Source File: CoinHighlightViewComponent.java    From FXGLGames with MIT License 5 votes vote down vote up
public CoinHighlightViewComponent() {
    super(5, 5);

    Rectangle rect = new Rectangle(30, 30, Color.color(0.8, 0, 0, 0.9));
    rect.setArcWidth(15);
    rect.setArcHeight(15);
    rect.setEffect(new Bloom(0.9));

    getViewRoot().getChildren().add(rect);
}
 
Example 8
Source File: CoinHighlightViewComponent.java    From FXGLGames with MIT License 5 votes vote down vote up
public CoinHighlightViewComponent() {
    super(5, 5);

    Rectangle rect = new Rectangle(30, 30, Color.color(0.8, 0, 0, 0.9));
    rect.setArcWidth(15);
    rect.setArcHeight(15);
    rect.setEffect(new Bloom(0.9));

    getViewRoot().getChildren().add(rect);
}
 
Example 9
Source File: GameMenuDemo.java    From FXTutorials with MIT License 5 votes vote down vote up
public MenuButton(String name) {
    text = new Text(name);
    text.setFont(text.getFont().font(20));
    text.setFill(Color.WHITE);

    Rectangle bg = new Rectangle(250, 30);
    bg.setOpacity(0.6);
    bg.setFill(Color.BLACK);
    bg.setEffect(new GaussianBlur(3.5));

    setAlignment(Pos.CENTER_LEFT);
    setRotate(-0.5);
    getChildren().addAll(bg, text);

    setOnMouseEntered(event -> {
        bg.setTranslateX(10);
        text.setTranslateX(10);
        bg.setFill(Color.WHITE);
        text.setFill(Color.BLACK);
    });

    setOnMouseExited(event -> {
        bg.setTranslateX(0);
        text.setTranslateX(0);
        bg.setFill(Color.BLACK);
        text.setFill(Color.WHITE);
    });

    DropShadow drop = new DropShadow(50, Color.WHITE);
    drop.setInput(new Glow());

    setOnMousePressed(event -> setEffect(drop));
    setOnMouseReleased(event -> setEffect(null));
}
 
Example 10
Source File: MenuItem.java    From FXTutorials with MIT License 5 votes vote down vote up
public MenuItem(String name, int width) {
    setAlignment(Pos.CENTER_LEFT);

    text = new Text(name);
    text.setTranslateX(5);
    text.setFont(font);
    text.setFill(Colors.MENU_TEXT);
    text.setStroke(Color.BLACK);

    shadow = new DropShadow(5, Color.BLACK);
    text.setEffect(shadow);

    selection = new Rectangle(width - 45, 30);
    selection.setFill(Colors.MENU_ITEM_SELECTION);
    selection.setStroke(Color.BLACK);
    selection.setVisible(false);

    GaussianBlur blur = new GaussianBlur(8);
    selection.setEffect(blur);

    getChildren().addAll(selection, text);

    setOnMouseEntered(e -> {
        onSelect();
    });

    setOnMouseExited(e -> {
        onDeselect();
    });

    setOnMousePressed(e -> {
        text.setFill(Color.YELLOW);
    });
}