Example usage for javafx.scene.paint Color BLACK

List of usage examples for javafx.scene.paint Color BLACK

Introduction

In this page you can find the example usage for javafx.scene.paint Color BLACK.

Prototype

Color BLACK

To view the source code for javafx.scene.paint Color BLACK.

Click Source Link

Document

The color black with an RGB value of #000000

Usage

From source file:RemoveDuplicateFiles.java

public static void addActionHandlers(Stage primaryStage) {
    //Sort Files Button Pressed.
    sortFilesButton.setOnAction((ActionEvent event) -> {
        //Move to the SortFiles window
        new FileSort(primaryStage);
    });/*from   w  w  w. j a va2s .c  o  m*/

    //Batch Rename Button Pressed
    batchRenameButton.setOnAction((ActionEvent event) -> {
        //Move to the BatchRename window
        new BatchRename(primaryStage);
    });

    //Action Handler: remove the duplicate files in the directory.
    rmvButton.setOnAction((ActionEvent event) -> {
        //Clear the actionTarget
        actionTarget.setFill(Color.BLACK);
        actionTarget.setText("");

        //Make sure we have the right path
        selectedDirectory = new File(address.getText());

        if (selectedDirectory != null && selectedDirectory.isDirectory()) {
            //Grab the list of file types from the textbox
            String[] extensions = UtilFunctions.parseFileTypes(fileTypes.getText());

            //Grab the list of files in the selectedDirectory
            List<File> files = (List<File>) FileUtils.listFiles(selectedDirectory, extensions, true);
            HashSet<String> hashCodes = new HashSet<>();
            ArrayList<File> duplicates = new ArrayList<>();

            //Progress reporting values
            actionTarget.setFill(Color.BLACK);
            int totalFileCount = files.size();
            int filesProcessed = 0;

            //Find the duplicate files
            for (File f : files) {
                try {
                    //Update the status
                    filesProcessed++;
                    actionTarget.setText("Processing file " + filesProcessed + " of " + totalFileCount);

                    //Grab the file's hash code
                    String hash = UtilFunctions.makeHash(f);

                    //If we already have a file matching that hash code
                    if (hashCodes.contains(hash)) {
                        //Add the file to the list of files to be deleted
                        duplicates.add(f);
                    } else {
                        hashCodes.add(hash);
                    }

                } catch (Exception except) {
                }
            } //End for

            //Progress reporting
            filesProcessed = 0;
            totalFileCount = duplicates.size();
            Iterator<File> itr = duplicates.iterator();

            //Remove the duplicate files
            while (itr.hasNext()) {
                try {
                    //Update the status
                    filesProcessed++;
                    actionTarget.setText("Deleting file " + filesProcessed + " of " + totalFileCount);

                    //Grab the file
                    File file = itr.next();

                    if (!file.delete()) {
                        JOptionPane.showMessageDialog(null, file.getPath() + " not deleted.");
                    }

                } catch (Exception except) {
                }
            } //End while

            actionTarget.setText("Deleted: " + filesProcessed);

        } else {
            actionTarget.setFill(Color.FIREBRICK);
            actionTarget.setText("Invalid directory.");
        }
    });

}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group root = new Group();
    Scene scene = new Scene(root, 800, 600, Color.BLACK);
    primaryStage.setScene(scene);//  w w  w.j  a  va  2 s.  co m
    Group circles = new Group();
    for (int i = 0; i < 30; i++) {
        Circle circle = new Circle(150, Color.web("white", 0.05));
        circle.setStrokeType(StrokeType.OUTSIDE);
        circle.setStroke(Color.web("white", 0.16));
        circle.setStrokeWidth(4);
        circles.getChildren().add(circle);
    }
    Rectangle colors = new Rectangle(scene.getWidth(), scene.getHeight(),
            new LinearGradient(0f, 1f, 1f, 0f, true, CycleMethod.NO_CYCLE,
                    new Stop[] { new Stop(0, Color.web("#f8bd55")), new Stop(0.14, Color.web("#c0fe56")),
                            new Stop(0.28, Color.web("#5dfbc1")), new Stop(0.43, Color.web("#64c2f8")),
                            new Stop(0.57, Color.web("#be4af7")), new Stop(0.71, Color.web("#ed5fc2")),
                            new Stop(0.85, Color.web("#ef504c")), new Stop(1, Color.web("#f2660f")), }));
    Group blendModeGroup = new Group(
            new Group(new Rectangle(scene.getWidth(), scene.getHeight(), Color.BLACK), circles), colors);
    colors.setBlendMode(BlendMode.OVERLAY);
    root.getChildren().add(blendModeGroup);
    circles.setEffect(new BoxBlur(10, 10, 3));
    Timeline timeline = new Timeline();
    for (Node circle : circles.getChildren()) {
        timeline.getKeyFrames().addAll(new KeyFrame(Duration.ZERO, // set start position at 0
                new KeyValue(circle.translateXProperty(), random() * 800),
                new KeyValue(circle.translateYProperty(), random() * 600)),
                new KeyFrame(new Duration(40000), // set end position at 40s
                        new KeyValue(circle.translateXProperty(), random() * 800),
                        new KeyValue(circle.translateYProperty(), random() * 600)));
    }
    // play 40s of animation
    timeline.play();

    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    String workingDir = System.getProperty("user.dir");
    final File f = new File(workingDir, "../media/omgrobots.flv");

    final Media m = new Media(f.toURI().toString());
    final MediaPlayer mp = new MediaPlayer(m);
    final MediaView mv = new MediaView(mp);

    final DoubleProperty width = mv.fitWidthProperty();
    final DoubleProperty height = mv.fitHeightProperty();

    width.bind(Bindings.selectDouble(mv.sceneProperty(), "width"));
    height.bind(Bindings.selectDouble(mv.sceneProperty(), "height"));

    mv.setPreserveRatio(true);/* ww w.ja va  2  s  .c om*/

    StackPane root = new StackPane();
    root.getChildren().add(mv);

    final Scene scene = new Scene(root, 960, 540);
    scene.setFill(Color.BLACK);

    primaryStage.setScene(scene);
    primaryStage.setTitle("Full Screen Video Player");
    primaryStage.setFullScreen(true);
    primaryStage.show();

    mp.play();
}

From source file:Main.java

static Node distantLight() {
    Light.Distant light = new Light.Distant();
    light.setAzimuth(-135.0f);//w  ww.  j  a  v  a 2 s .c o  m
    light.setElevation(30.0f);

    Lighting l = new Lighting();
    l.setLight(light);
    l.setSurfaceScale(5.0f);

    final Text t = new Text();
    t.setText("Distant Light");
    t.setFill(Color.RED);
    t.setFont(Font.font("null", FontWeight.BOLD, 70));
    t.setX(10.0f);
    t.setY(50.0f);
    t.setTextOrigin(VPos.TOP);

    t.setEffect(l);

    final Rectangle r = new Rectangle();
    r.setFill(Color.BLACK);

    Group g = new Group();
    g.getChildren().add(r);
    g.getChildren().add(t);

    g.setTranslateY(460);

    return g;
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group p = new Group();
    Scene scene = new Scene(p);
    stage.setScene(scene);/*from   ww  w .  j a  v  a2 s. c om*/
    stage.setWidth(500);
    stage.setHeight(500);
    p.setTranslateX(80);
    p.setTranslateY(80);

    //create a circle with effect
    final Circle circle = new Circle(20, Color.rgb(156, 216, 255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text(i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    p.getChildren().add(stack);
    stage.show();

    //create a timeline for moving the circle
    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //You can add a specific action when each frame is started.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }
    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.millis(2000);
    //one can add a specific action when the keyframe is reached
    EventHandler onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
            stack.setTranslateX(java.lang.Math.random() * 200 - 100);
            //reset counter
            i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished, keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    timeline.play();
    timer.start();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250);
    root.getChildren().addAll(source, target);

    source.setOnDragDetected(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent event) {
            /* drag was detected, start a drag-and-drop gesture*/
            /* allow any transfer mode */
            Dragboard db = source.startDragAndDrop(TransferMode.ANY);

            /* Put a string on a dragboard */
            ClipboardContent content = new ClipboardContent();
            content.putString(source.getText());
            db.setContent(content);/*from  ww w  .  j a  v  a2  s . c om*/

            event.consume();
        }
    });
    target.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 a string data */
            if (event.getGestureSource() != target && event.getDragboard().hasString()) {
                /* allow for moving */
                event.acceptTransferModes(TransferMode.MOVE);
            }

            event.consume();
        }
    });
    target.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 */
            if (event.getGestureSource() != target && event.getDragboard().hasString()) {
                target.setFill(Color.GREEN);
            }

            event.consume();
        }
    });
    target.setOnDragExited(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* mouse moved away, remove the graphical cues */
            target.setFill(Color.BLACK);

            event.consume();
        }
    });
    target.setOnDragDropped(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* data dropped */
            /* if there is a string data on dragboard, read it and use it */
            Dragboard db = event.getDragboard();
            boolean success = false;
            if (db.hasString()) {
                target.setText(db.getString());
                success = true;
            }
            /* let the source know whether the string was successfully 
             * transferred and used */
            event.setDropCompleted(success);

            event.consume();
        }
    });
    source.setOnDragDone(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* the drag and drop gesture ended */
            /* if the data was successfully moved, clear it */
            if (event.getTransferMode() == TransferMode.MOVE) {
                source.setText("");
            }
            event.consume();
        }
    });

    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("Hello Drag And Drop");

    Group root = new Group();
    Scene scene = new Scene(root, 400, 200);
    scene.setFill(Color.LIGHTGREEN);

    final Text source = new Text(50, 100, "DRAG ME");
    source.setScaleX(2.0);/*from w  w  w .  j  a va 2s .  co  m*/
    source.setScaleY(2.0);

    final Text target = new Text(250, 100, "DROP HERE");
    target.setScaleX(2.0);
    target.setScaleY(2.0);

    source.setOnDragDetected(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent event) {
            /* drag was detected, start drag-and-drop gesture*/
            System.out.println("onDragDetected");

            /* allow any transfer mode */
            Dragboard db = source.startDragAndDrop(TransferMode.ANY);

            /* put a string on dragboard */
            ClipboardContent content = new ClipboardContent();
            content.putString(source.getText());
            db.setContent(content);

            event.consume();
        }
    });

    target.setOnDragOver(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* data is dragged over the target */
            System.out.println("onDragOver");

            /* accept it only if it is  not dragged from the same node 
             * and if it has a string data */
            if (event.getGestureSource() != target && event.getDragboard().hasString()) {
                /* allow for both copying and moving, whatever user chooses */
                event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
            }

            event.consume();
        }
    });

    target.setOnDragEntered(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* the drag-and-drop gesture entered the target */
            System.out.println("onDragEntered");
            /* show to the user that it is an actual gesture target */
            if (event.getGestureSource() != target && event.getDragboard().hasString()) {
                target.setFill(Color.GREEN);
            }

            event.consume();
        }
    });

    target.setOnDragExited(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* mouse moved away, remove the graphical cues */
            target.setFill(Color.BLACK);

            event.consume();
        }
    });

    target.setOnDragDropped(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* data dropped */
            System.out.println("onDragDropped");
            /* if there is a string data on dragboard, read it and use it */
            Dragboard db = event.getDragboard();
            boolean success = false;
            if (db.hasString()) {
                target.setText(db.getString());
                success = true;
            }
            /* let the source know whether the string was successfully 
             * transferred and used */
            event.setDropCompleted(success);

            event.consume();
        }
    });

    source.setOnDragDone(new EventHandler<DragEvent>() {
        public void handle(DragEvent event) {
            /* the drag-and-drop gesture ended */
            System.out.println("onDragDone");
            /* if the data was successfully moved, clear it */
            if (event.getTransferMode() == TransferMode.MOVE) {
                source.setText("");
            }

            event.consume();
        }
    });

    root.getChildren().add(source);
    root.getChildren().add(target);
    stage.setScene(scene);
    stage.show();
}

From source file:com.github.vatbub.tictactoe.view.Main.java

private void addWinLineOnLoose(Board.WinnerInfo winnerInfo) {
    final double strokeWidth = 2;

    Line originLine = new Line(0, 0, 0, 0);
    winLineGroup.getChildren().add(originLine);

    WinLine winLine = new WinLine(winnerInfo);
    winLine.startArc.setFill(Color.TRANSPARENT);
    winLine.startArc.setStroke(Color.BLACK);
    winLine.startArc.setStrokeWidth(strokeWidth);
    winLine.endArc.setFill(Color.TRANSPARENT);
    winLine.endArc.setStroke(Color.BLACK);
    winLine.endArc.setStrokeWidth(strokeWidth);
    winLine.rightLine.setStrokeWidth(strokeWidth);
    winLine.leftLine.setStrokeWidth(strokeWidth);

    winLine.centerLine.setStrokeWidth(0);
    winLineGroup.getChildren().addAll(winLine.getAll());

    winLineGroup.setOpacity(0);/* ww  w  . ja va2s . c o  m*/
    GaussianBlur blur = new GaussianBlur(7);
    winLineGroup.setEffect(blur);
    winLineGroup.setVisible(true);
    KeyValue keyValue1 = new KeyValue(winLineGroup.opacityProperty(), 0);
    KeyFrame keyFrame1 = new KeyFrame(Duration.millis(900), keyValue1);
    KeyValue keyValue2 = new KeyValue(winLineGroup.opacityProperty(), 1);
    KeyFrame keyFrame2 = new KeyFrame(Duration.millis(950), keyValue2);

    Timeline timeline = new Timeline();
    timeline.getKeyFrames().addAll(keyFrame1, keyFrame2);
    timeline.play();
}

From source file:com.github.vatbub.tictactoe.view.Main.java

public void flashOpponentsTurnHBox() {
    KeyValue keyValue1Color = new KeyValue(((DropShadow) opponentsTurnAnchorPane.getEffect()).colorProperty(),
            Color.RED);// ww w  .ja  v  a2  s.  co  m
    KeyValue keyValue1Width = new KeyValue(((DropShadow) opponentsTurnAnchorPane.getEffect()).widthProperty(),
            30);
    KeyValue keyValue1Height = new KeyValue(((DropShadow) opponentsTurnAnchorPane.getEffect()).heightProperty(),
            30);
    KeyFrame keyFrame1 = new KeyFrame(Duration.seconds(animationSpeed / 2), keyValue1Color, keyValue1Width,
            keyValue1Height);

    KeyValue keyValue2Color = new KeyValue(((DropShadow) opponentsTurnAnchorPane.getEffect()).colorProperty(),
            Color.BLACK);
    KeyValue keyValue2Width = new KeyValue(((DropShadow) opponentsTurnAnchorPane.getEffect()).widthProperty(),
            12);
    KeyValue keyValue2Height = new KeyValue(((DropShadow) opponentsTurnAnchorPane.getEffect()).heightProperty(),
            12);
    KeyFrame keyFrame2 = new KeyFrame(Duration.seconds(animationSpeed), keyValue2Color, keyValue2Width,
            keyValue2Height);

    Timeline timeline = new Timeline(keyFrame1, keyFrame2);
    // play it twice
    timeline.setOnFinished((event -> new Timeline(keyFrame1, keyFrame2).play()));
    timeline.play();
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 *///from   w  w  w .  j a v  a  2s .  co  m
private static void creeLoupe() {
    apLoupe.getChildren().clear();
    if (strPositLoupe.equals("gauche")) {
        apLoupe.setLayoutX(35);
    }
    if (strPositLoupe.equals("droite")) {
        apLoupe.setLayoutX(ivImagePanoramique.getFitWidth() - getiTailleLoupe() + 5);
    }
    apLoupe.setLayoutY(35);

    Line lig1 = new Line(getiTailleLoupe() / 2 + 10, 10, getiTailleLoupe() / 2 + 10, getiTailleLoupe() + 10);
    lig1.setStroke(Color.GOLD);
    Line lig2 = new Line(10, getiTailleLoupe() / 2 + 10, getiTailleLoupe() + 10, getiTailleLoupe() / 2 + 10);
    lig2.setStroke(Color.GOLD);
    Circle circ1 = new Circle(getiTailleLoupe() / 2 + 10, getiTailleLoupe() / 2 + 10,
            getiTailleLoupe() / 2 + 6);
    circ1.setStroke(Color.GOLDENROD);
    circ1.setFill(Color.GOLDENROD);
    Circle circ2 = new Circle(getiTailleLoupe() / 2 + 10, getiTailleLoupe() / 2 + 10,
            getiTailleLoupe() / 2 + 5);
    circ2.setStroke(Color.GOLD);
    circ2.setFill(Color.GOLD);
    Circle circ3 = new Circle(getiTailleLoupe() / 2 + 10, getiTailleLoupe() / 2 + 10,
            getiTailleLoupe() / 2 + 2);
    circ3.setStroke(Color.GOLDENROD);
    circ3.setFill(Color.GOLDENROD);
    Circle circ4 = new Circle(getiTailleLoupe() / 2 + 10, getiTailleLoupe() / 2 + 10, getiTailleLoupe() / 2);
    circ4.setStroke(Color.BLACK);
    circ4.setFill(Color.BLACK);
    apLoupe.getChildren().addAll(circ1, circ2, circ3, circ4, ivLoupe, lig1, lig2);
    apLoupe.setOnMouseMoved((me) -> {
        if (strPositLoupe.equals("gauche")) {
            apLoupe.setLayoutX(ivImagePanoramique.getFitWidth() - getiTailleLoupe() + 5);
            strPositLoupe = "droite";
        }
        if (strPositLoupe.equals("droite")) {
            apLoupe.setLayoutX(35);
            strPositLoupe = "gauche";
        }
    });
    apLoupe.setOnMouseEntered((me) -> {
        if (strPositLoupe.equals("gauche")) {
            apLoupe.setLayoutX(ivImagePanoramique.getFitWidth() - getiTailleLoupe() + 5);
            strPositLoupe = "droite";
        }
        if (strPositLoupe.equals("droite")) {
            apLoupe.setLayoutX(35);
            strPositLoupe = "gauche";
        }
    });
}