Example usage for javafx.scene.effect DropShadow setColor

List of usage examples for javafx.scene.effect DropShadow setColor

Introduction

In this page you can find the example usage for javafx.scene.effect DropShadow setColor.

Prototype

public final void setColor(Color value) 

Source Link

Usage

From source file:Main.java

static Node dropShadow() {
    Group g = new Group();
    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0f);/*from www  .  j  a va  2  s  .c  o m*/
    ds.setColor(Color.color(0.4f, 0.4f, 0.4f));

    Text t = new Text();
    t.setEffect(ds);
    t.setCache(true);
    t.setX(10.0f);
    t.setY(270.0f);
    t.setFill(Color.RED);
    t.setText("JavaFX drop shadow...");
    t.setFont(Font.font("null", FontWeight.BOLD, 32));

    DropShadow ds1 = new DropShadow();
    ds1.setOffsetY(4.0f);

    Circle c = new Circle();
    c.setEffect(ds1);
    c.setCenterX(50.0f);
    c.setCenterY(325.0f);
    c.setRadius(30.0f);
    c.setFill(Color.ORANGE);
    c.setCache(true);

    g.getChildren().add(t);
    g.getChildren().add(c);
    return g;
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    Group g = new Group();

    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0);/*  w w w .  j a v  a2s . c om*/
    ds.setColor(Color.color(0.4, 0.4, 0.4));

    Ellipse ellipse = new Ellipse();
    ellipse.setCenterX(50.0f);
    ellipse.setCenterY(50.0f);
    ellipse.setRadiusX(50.0f);
    ellipse.setRadiusY(25.0f);
    ellipse.setEffect(ds);

    g.getChildren().add(ellipse);

    root.getChildren().add(g);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    Group g = new Group();

    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0);/*from  w  ww  .ja  v a  2s .co m*/
    ds.setColor(Color.color(0.4, 0.4, 0.4));

    Text t = new Text();
    t.setEffect(ds);
    t.setCache(true);
    t.setX(10.0);
    t.setY(70.0);
    t.setFill(Color.RED);
    t.setText("JavaFX drop shadow...");
    t.setFont(Font.font(null, FontWeight.BOLD, 32));
    g.getChildren().add(t);

    root.getChildren().add(g);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    Group g = new Group();

    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0);/* w ww  .  j  a  v a 2s  .c om*/
    ds.setColor(Color.color(0.4, 0.4, 0.4));

    Ellipse ellipse = new Ellipse();
    ellipse.setCenterX(50.0f);
    ellipse.setCenterY(50.0f);
    ellipse.setRadiusX(50.0f);
    ellipse.setRadiusY(25.0f);
    ellipse.setEffect(ds);

    FillTransition ft = new FillTransition(Duration.millis(3000), ellipse, Color.RED, Color.BLUE);
    ft.setAutoReverse(true);
    ft.play();

    g.getChildren().add(ellipse);

    root.getChildren().add(g);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    Group g = new Group();

    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0);/*from  w w  w. jav a2s  . c  o  m*/
    ds.setColor(Color.color(0.4, 0.4, 0.4));

    Ellipse ellipse = new Ellipse();
    ellipse.setCenterX(50.0f);
    ellipse.setCenterY(50.0f);
    ellipse.setRadiusX(50.0f);
    ellipse.setRadiusY(25.0f);
    ellipse.setEffect(ds);

    FadeTransition ft = new FadeTransition(Duration.millis(3000), ellipse);
    ft.setFromValue(1.0);
    ft.setToValue(0.3);
    ft.setAutoReverse(true);

    ft.play();

    g.getChildren().add(ellipse);

    root.getChildren().add(g);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:ExcelFx.InitalDataController.java

@FXML
protected void okButton(ActionEvent event) throws IOException {
    DropShadow ds = new DropShadow();
    ds.setColor(Color.RED);

    String err = "";
    if (initalField.getText().length() == 0) {
        err += "  ";
        initalField.setEffect(ds);//from  w w w  .j ava 2 s  .  c o  m

    }
    if (initalPage.getText().length() == 0) {
        err += " ?  excel  ";
        initalPage.setEffect(ds);

    }
    if (yStart.getText().length() == 0) {
        err += "   ? ";
        yStart.setEffect(ds);

    }
    if (yEnd.getText().length() == 0) {
        err += "   ? ";
        yEnd.setEffect(ds);

    }

    if (err.length() != 0) {
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.setTitle("");
        alert.setHeaderText("?  ?");
        alert.setContentText(err);
        alert.showAndWait();

    } else {
        Stage stage = (Stage) gridPane.getScene().getWindow();
        stage.close();
        this.codes.setPatch(this.initalField.getText());
        this.codes.setPage((this.initalPage.getText()).trim().toLowerCase());
        this.codes.setYStart(this.yStart.getText().trim().toLowerCase());
        this.codes.setYEnd(this.yEnd.getText().trim().toLowerCase());
        this.codes.jsonCreate("inital.json");

    }
    this.gridPane.setUserData(this.codes);

}

From source file:ExcelFx.XLSSettingController.java

@FXML
protected void okButton(ActionEvent event) throws IOException {

    DropShadow ds = new DropShadow();
    ds.setColor(Color.RED);

    String err = "";
    try {//w ww  . j  a va  2  s  .  c o m
        if (pageField.getText().length() == 0) {
            err += " ";
            pageField.setEffect(ds);

        }
    } catch (Exception ex) {
        err += " ";
        pageField.setEffect(ds);
    }
    try {
        if (eddWayField.getText().length() == 0) {
            err += "?  ";
            eddWayField.setEffect(ds);

        }
    } catch (Exception e) {
        err += "?  ";
        eddWayField.setEffect(ds);
    }
    try {
        if (proffField.getText().length() == 0) {
            err += "??? ";
            proffField.setEffect(ds);
        }
    } catch (Exception ex) {
        err += "??? ";
        proffField.setEffect(ds);
    }
    //        try {
    //            if (eddNameField.getText().length() == 0) {
    //                err += "? ?  ";
    //                eddNameField.setEffect(ds);
    //            }
    //        } catch (Exception ex) {
    //            err += "??? ";
    //            eddNameField.setEffect(ds);
    //        }

    if (err.length() != 0) {
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.setTitle("");
        alert.setHeaderText("? ?");
        alert.setContentText(err);
        alert.showAndWait();

    } else {

        json.setPage(pageField.getText().trim().toLowerCase());
        json.setEddWay(eddWayField.getText().trim().toLowerCase());
        json.setProffName(proffField.getText().trim().toLowerCase());
        //            json.setEddName(this.eddNameField.getText().trim().toLowerCase());
        gridPane.setUserData(json);
        Stage stage = (Stage) gridPane.getScene().getWindow();
        stage.close();

    }

    switch (type) {
    case "university": {
        json.jsonCreate("university.json");
        break;

    }
    case "college": {
        json.jsonCreate("college.json");
        break;

    }

    }

}

From source file:com.rockhoppertech.symchords.fx.SymChordsController.java

protected void setupDragonDrop() {
    Image image = new Image(getClass().getResourceAsStream("/images/rocky-32-trans.png"));
    dragImageView = new ImageView(image);
    dragImageView.setFitHeight(32);/*from   w  w w .ja  va  2 s  .c  om*/
    dragImageView.setFitWidth(32);

    grandStaff.setOnDragDetected(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent me) {

            if (!root.getChildren().contains(dragImageView)) {
                root.getChildren().add(dragImageView);
            }

            // dragImageView.setOpacity(0.5);
            dragImageView.toFront();
            dragImageView.setMouseTransparent(true);
            dragImageView.setVisible(true);
            dragImageView.relocate((int) (me.getSceneX() - dragImageView.getBoundsInLocal().getWidth() / 2),
                    (int) (me.getSceneY() - dragImageView.getBoundsInLocal().getHeight() / 2));

            Dragboard db = grandStaff.startDragAndDrop(TransferMode.ANY);

            // TODO remove the custom image nonsense in javafx 8
            // javafx 8
            // db.setDragView(dragImageView);

            ClipboardContent content = new ClipboardContent();
            // MIDITrack track = grandStaff.getMIDITrack();
            MIDITrack track = model.getMIDITrack();
            content.put(midiTrackDataFormat, track);
            db.setContent(content);
            me.consume();
        }
    });

    grandStaff.setOnDragDone(new EventHandler<DragEvent>() {
        public void handle(DragEvent e) {
            dragImageView.setVisible(false);
            e.consume();
        }
    });

    // Parent root = grandStaff.getScene().getRoot();
    // stage.getScene().getRoot();

    if (root != null) {
        root.setOnDragOver(new EventHandler<DragEvent>() {
            public void handle(DragEvent e) {
                Point2D localPoint = grandStaff.getScene().getRoot()
                        .sceneToLocal(new Point2D(e.getSceneX(), e.getSceneY()));
                dragImageView.relocate(
                        (int) (localPoint.getX() - dragImageView.getBoundsInLocal().getWidth() / 2),
                        (int) (localPoint.getY() - dragImageView.getBoundsInLocal().getHeight() / 2));
                e.consume();
            }
        });
    }

    trackList.setOnDragOver(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /*
             * data is dragged over the target; accept it only if it is not
             * dragged from the same node and if it has MIDITrack data
             */
            if (event.getGestureSource() != trackList && event.getDragboard().hasContent(midiTrackDataFormat)) {
                logger.debug("drag over");
                /* allow for both copying and moving, whatever user chooses */
                event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
            }

            // Don't consume the event. Let the layers below process the
            // DragOver event as well so that the
            // translucent container image will follow the cursor.
            // event.consume();
        }
    });

    trackList.setOnDragEntered(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* the drag-and-drop gesture entered the target */
            /* show to the user that it is an actual gesture target */
            logger.debug("drag entered");
            if (event.getGestureSource() != trackList && event.getDragboard().hasContent(midiTrackDataFormat)) {
                DropShadow dropShadow = new DropShadow();
                dropShadow.setRadius(5.0);
                dropShadow.setOffsetX(3.0);
                dropShadow.setOffsetY(3.0);
                dropShadow.setColor(Color.color(0.4, 0.5, 0.5));
                trackList.setEffect(dropShadow);
            }
            event.consume();
        }
    });

    trackList.setOnDragExited(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* mouse moved away, remove the graphical cues */
            trackList.setEffect(null);
            event.consume();
        }
    });

    trackList.setOnDragDropped(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {

            Dragboard db = event.getDragboard();
            boolean success = false;
            if (db.hasContent(midiTrackDataFormat)) {
                MIDITrack track = (MIDITrack) db.getContent(midiTrackDataFormat);
                trackList.getItems().add(track);
                success = true;

            }
            /*
             * let the source know whether the data was successfully
             * transferred and used
             */
            event.setDropCompleted(success);
            event.consume();
        }
    });

    logger.debug("jvm mime {}", DataFlavor.javaJVMLocalObjectMimeType);
}