Example usage for javafx.scene.text FontWeight BOLD

List of usage examples for javafx.scene.text FontWeight BOLD

Introduction

In this page you can find the example usage for javafx.scene.text FontWeight BOLD.

Prototype

FontWeight BOLD

To view the source code for javafx.scene.text FontWeight BOLD.

Click Source Link

Document

represents Bold font weight (700).

Usage

From source file:Main.java

static Node displacementMap() {
    int w = 220;//  ww  w  .j av a 2  s.  c  om
    int h = 100;
    FloatMap map = new FloatMap();
    map.setWidth(w);
    map.setHeight(h);

    for (int i = 0; i < w; i++) {
        double v = (Math.sin(i / 50.0 * Math.PI) - 0.5) / 40.0;
        for (int j = 0; j < h; j++) {
            map.setSamples(i, j, 0.0f, (float) v);
        }
    }

    Group g = new Group();
    DisplacementMap dm = new DisplacementMap();
    dm.setMapData(map);

    Rectangle r = new Rectangle();
    r.setX(20.0f);
    r.setY(20.0f);
    r.setWidth(w);
    r.setHeight(h);
    r.setFill(Color.BLUE);

    g.getChildren().add(r);

    Text t = new Text();
    t.setX(40.0f);
    t.setY(80.0f);
    t.setText("Wavy Text");
    t.setFill(Color.YELLOW);
    t.setFont(Font.font("null", FontWeight.BOLD, 36));

    g.getChildren().add(t);

    g.setEffect(dm);
    g.setCache(true);

    g.setTranslateX(400);
    g.setTranslateY(200);

    return g;
}

From source file:Main.java

private GridPane addGridPane() {

    GridPane grid = new GridPane();
    grid.setHgap(10);/* w  ww. j  a  va2  s .  c  o  m*/
    grid.setVgap(10);
    grid.setPadding(new Insets(0, 10, 0, 10));

    // Category in column 2, row 1
    Text category = new Text("Sales:");
    category.setFont(Font.font("Arial", FontWeight.BOLD, 20));
    grid.add(category, 1, 0);

    // Title in column 3, row 1
    Text chartTitle = new Text("Current Year");
    chartTitle.setFont(Font.font("Arial", FontWeight.BOLD, 20));
    grid.add(chartTitle, 2, 0);

    // Subtitle in columns 2-3, row 2
    Text chartSubtitle = new Text("Goods and Services");
    grid.add(chartSubtitle, 1, 1, 2, 1);

    // House icon in column 1, rows 1-2
    ImageView imageHouse = new ImageView(new Image(Main.class.getResourceAsStream("graphics/house.png")));
    grid.add(imageHouse, 0, 0, 1, 2);

    // Left label in column 1 (bottom), row 3
    Text goodsPercent = new Text("Goods\n80%");
    GridPane.setValignment(goodsPercent, VPos.BOTTOM);
    grid.add(goodsPercent, 0, 2);

    // Chart in columns 2-3, row 3
    ImageView imageChart = new ImageView(new Image(Main.class.getResourceAsStream("graphics/piechart.png")));
    grid.add(imageChart, 1, 2, 2, 1);

    // Right label in column 4 (top), row 3
    Text servicesPercent = new Text("Services\n20%");
    GridPane.setValignment(servicesPercent, VPos.TOP);
    grid.add(servicesPercent, 3, 2);

    //        grid.setGridLinesVisible(true);
    return grid;
}

From source file:Main.java

static Node boxBlur() {
    Text t = new Text();
    t.setText("Blurry Text!");
    t.setFill(Color.RED);//from  w  w w  .  jav a  2  s .c  o  m
    t.setFont(Font.font("null", FontWeight.BOLD, 36));
    t.setX(10);
    t.setY(40);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(5);
    bb.setHeight(5);
    bb.setIterations(3);

    t.setEffect(bb);
    t.setTranslateX(300);
    t.setTranslateY(100);

    return t;
}

From source file:Main.java

static Node dropShadow() {
    Group g = new Group();
    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0f);//from  ww w. j ava  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

static Node bloom() {
    Group g = new Group();

    Rectangle r = new Rectangle();
    r.setX(10);// ww  w . j  a  va2s.c o  m
    r.setY(10);
    r.setWidth(160);
    r.setHeight(80);
    r.setFill(Color.DARKBLUE);

    Text t = new Text();
    t.setText("Bloom!");
    t.setFill(Color.YELLOW);
    t.setFont(Font.font("null", FontWeight.BOLD, 36));
    t.setX(25);
    t.setY(65);

    g.setCache(true);
    //g.setEffect(new Bloom());
    Bloom bloom = new Bloom();
    bloom.setThreshold(1.0);
    g.setEffect(bloom);
    g.getChildren().add(r);
    g.getChildren().add(t);
    g.setTranslateX(350);
    return g;
}

From source file:com.virus.removal.javafxapplication.FXMLDocumentController.java

/**
 * @return// w  ww  .  j ava 2s. co  m
 */
private Task<Void> createWorker() {
    return new Task<Void>() {

        /* (non-Javadoc)
         * @see javafx.concurrent.Task#call()
         */
        @Override
        protected Void call() throws Exception {

            /* Start the scanning of viruses. */
            //            virusDetectedMap = handler.startScanning(progressBar, 
            //                                           textArea,
            //                                           textForThreatsFound,
            //                                           virusScanning,
            //                                           workerThread);

            javafx.application.Platform.runLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {
                    /* Set the status to Scanning in Dashboard */
                    if (statusValInDash.getStyle() != null) {
                        statusValInDash.setStyle("");
                    }
                    statusValInDash.setText(POTENTIALLY_UNPROTECTED);
                }
            });

            /* Start Scanning */
            int index = 1;
            boolean isNextVirus = false;
            isPageProtected = false;

            final Calendar c = Calendar.getInstance();
            timestamp = simpleDateFormat.format(c.getTime());

            if (isScanCancelled) {
                isScanCancelled = false;
            }

            final Map<String, String> virusDetectedMap = new HashMap<String, String>();
            final List<String> detectedViruses = new ArrayList<String>();

            /* Cancel the Scan */
            q.setOnMouseClicked(new EventHandler<Event>() {

                /**
                 * @param me
                 */
                @Override
                public void handle(Event me) {
                    isScanCancelled = true;
                }
            });

            if (isScanCancelled) {
                handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                setVirusScanHistoryIfScanIsStopped(handler);
                return null;
            }

            javafx.application.Platform.runLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {

                    if (textArea != null) {
                        textArea.setFont(Font.font("Verdana", FontWeight.BOLD, 10));
                        if (textArea.getText() != null && !textArea.getText().isEmpty()) {
                            textArea.clear();
                        }
                    }

                    if (StringUtils.equals(drop.getText(), "English")) {
                        virusScanning.setText("Scanning...");
                        timerTextForThreats.setText("Virus Timer: 15 seconds");
                    } else if (StringUtils.equals(drop.getText(), "Spanish")) {
                        virusScanning.setText("Exploracin...");
                        timerTextForThreats.setText("Timer Virus: 15 segundos");
                    } else if (drop.getText().equals("French")) {
                        virusScanning.setText("Balayage...");
                        timerTextForThreats.setText("Virus Timer: 15 secondes");
                    } else if (drop.getText().equals("Portuguese")) {
                        virusScanning.setText("Digitalizao...");
                        timerTextForThreats.setText("Temporizador Vrus: 15 segundos");
                    }

                    progressBar.setTooltip(new Tooltip("Virus scan in progress"));

                    if (textForThreatsFound != null && textForThreatsFound.getText() != null
                            && !textForThreatsFound.getText().isEmpty()) {
                        textForThreatsFound.setText("");
                    }
                    if (textForThreatsRemoved != null && textForThreatsRemoved.getText() != null
                            && !textForThreatsRemoved.getText().isEmpty()) {
                        textForThreatsRemoved.setText("");
                    }

                    if (isScanCancelled) {
                        isScanCancelled = false;
                    }
                }
            });

            System.out.println("Scan in progress..!!");
            System.out.println();

            /* Cancel the Scan */
            q.setOnMouseClicked(new EventHandler<Event>() {

                /**
                 * @param me
                 */
                @Override
                public void handle(Event me) {
                    isScanCancelled = true;
                }
            });

            if (isScanCancelled) {
                handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                setVirusScanHistoryIfScanIsStopped(handler);
                return null;
            }

            if (virusRegistry != null) {
                virusSearchList.clear();
                virusSearchList = virusRegistry.getVirusSearchList();
            }
            if (virusCache != null) {
                viruses = virusCache.getAllViruses();
            }
            if (rkm == null) {
                rkm = RegistryKeyManager.getInstance();
            }

            /* Wait for sometime */
            try {
                Thread.sleep(5000);
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }

            javafx.application.Platform.runLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {
                    textArea.appendText("Currently Scanning:");
                    textArea.appendText("\n");
                    textArea.appendText("----------------------");
                    textArea.appendText("\n");

                    /* Cancel the Scan */
                    q.setOnMouseClicked(new EventHandler<Event>() {

                        /**
                         * @param me
                         */
                        @Override
                        public void handle(Event me) {
                            isScanCancelled = true;
                        }
                    });
                }
            });

            if (isScanCancelled) {
                handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                setVirusScanHistoryIfScanIsStopped(handler);
                return null;
            }

            for (final String virus : viruses) {

                /* Cancel the Scan */
                q.setOnMouseClicked(new EventHandler<Event>() {

                    /**
                     * @param me
                     */
                    @Override
                    public void handle(Event me) {
                        isScanCancelled = true;
                    }
                });

                if (isScanCancelled) {
                    handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                    setVirusScanHistoryIfScanIsStopped(handler);
                    return null;
                }

                if (rkm == null) {
                    System.out.println("Scan is stopped due to: " + REGISTRY_KEY_MANEGER_EMPTY);
                    handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                    return null;
                }

                if (isNextVirus) {
                    javafx.application.Platform.runLater(new Runnable() {

                        /* (non-Javadoc)
                         * @see java.lang.Runnable#run()
                         */
                        @Override
                        public void run() {
                            textArea.appendText("\n\n");
                        }
                    });
                }

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        textArea.appendText(virus);
                        textArea.appendText("\n");
                    }
                });

                for (final String virusSearchUsingReg : virusSearchList) {

                    /* Cancel the Scan */
                    q.setOnMouseClicked(new EventHandler<Event>() {

                        /**
                         * @param me
                         */
                        @Override
                        public void handle(Event me) {
                            isScanCancelled = true;
                        }
                    });

                    if (isScanCancelled) {
                        handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                        setVirusScanHistoryIfScanIsStopped(handler);
                        return null;
                    }

                    javafx.application.Platform.runLater(new Runnable() {

                        /* (non-Javadoc)
                         * @see java.lang.Runnable#run()
                         */
                        @Override
                        public void run() {
                            textArea.appendText("\n");
                            textArea.appendText(virusSearchUsingReg);
                        }
                    });

                    try {
                        if (virus != null && !virus.isEmpty() && virusSearchUsingReg != null
                                && !virusSearchUsingReg.isEmpty()) {
                            if (rkm != null) {
                                rkm.query(virusSearchUsingReg, virus);
                                if (rkm.getKey() != null && !rkm.getKey().isEmpty()) {

                                    javafx.application.Platform.runLater(new Runnable() {

                                        /* (non-Javadoc)
                                         * @see java.lang.Runnable#run()
                                         */
                                        @Override
                                        public void run() {
                                            textArea.appendText("\n");
                                        }
                                    });

                                    detectedViruses.add(virusSearchUsingReg + "\\" + virus);
                                    System.out
                                            .println("Found the virus: " + virusSearchUsingReg + "\\" + virus);
                                    virusDetectedMap.put(String.valueOf(index++) + virusSearchUsingReg, virus);
                                }
                            } else {
                                System.out.println("Scan is stopped due to: " + REGISTRY_KEY_MANEGER_EMPTY);
                                handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                                return null;
                            }
                        }
                    } catch (final Exception e) {
                        System.out.println("Failed to scan due to: " + e.getMessage());
                        handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                        return null;
                    }
                    isNextVirus = true;
                }

            }

            System.out.println("Virus scanning is completed");
            handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_COMPLETED);

            javafx.application.Platform.runLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {
                    virusScanning.setText("");
                    timerTextForThreats.setText("");
                }
            });

            /* Cancel the Scan */
            q.setOnMouseClicked(new EventHandler<Event>() {

                /**
                 * @param me
                 */
                @Override
                public void handle(final Event me) {
                    isScanCancelled = true;
                }
            });

            if (isScanCancelled) {
                handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                setVirusScanHistoryIfScanIsStopped(handler);
                return null;
            }

            noOfThreats = virusDetectedMap.size();

            if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_SCAN_COMPLETED && virusDetectedMap != null
                    && virusDetectedMap.size() > 0) {

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        if (StringUtils.equals(drop.getText(), "English")) {
                            textForThreatsFound.setText("Found Threats: " + noOfThreats);
                        } else if (StringUtils.equals(drop.getText(), "Spanish")) {
                            textForThreatsFound.setText("Las amenazas que se encuentran: " + noOfThreats);
                        } else if (drop.getText().equals("French")) {
                            textForThreatsFound.setText("Menaces trouvs: " + noOfThreats);
                        } else if (drop.getText().equals("Portuguese")) {
                            textForThreatsFound.setText("Ameaas encontradas: " + noOfThreats);
                        }
                        textArea.appendText("\n\n");
                        textArea.appendText("Found one or more viruses:");
                        textArea.appendText("\n");
                        textArea.appendText("--------------------------------");
                        textArea.appendText("\n");
                        for (final String detectedVirus : detectedViruses) {
                            textArea.appendText(detectedVirus);
                            textArea.appendText("\n");
                        }
                    }
                });

                /* Wait for sometime */
                try {
                    Thread.sleep(1000);
                } catch (Exception e) {
                    System.out.println(e.getMessage());
                }
            } else {

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        if (StringUtils.equals(drop.getText(), "English")) {
                            textForThreatsFound.setText("Found Threats: " + noOfThreats);
                        } else if (StringUtils.equals(drop.getText(), "Spanish")) {
                            textForThreatsFound.setText("Las amenazas que se encuentran: " + noOfThreats);
                        } else if (drop.getText().equals("French")) {
                            textForThreatsFound.setText("Menaces trouvs: " + noOfThreats);
                        } else if (drop.getText().equals("Portuguese")) {
                            textForThreatsFound.setText("Ameaas encontradas: " + noOfThreats);
                        }
                        textArea.appendText("\n\n");
                        textArea.appendText("No viruses are found");
                    }
                });

                /* Update the progress */
                updateProgress(1, 1);

                VirusScanHistory virusScanHistory = new VirusScanHistory();
                virusScanHistory.setScanDate(timestamp);
                virusScanHistory.setScanStatus("SUCCESSFUL");
                virusScanHistory.setPcName(System.getenv("COMPUTERNAME"));
                virusScanHistory.setThreatsFound(0);

                virusScanHistoryList.add(virusScanHistory);

                /* Wait for sometime */
                try {
                    Thread.sleep(1000);
                } catch (Exception e) {
                    System.out.println(e.getMessage());
                }

            }

            if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_SCAN_COMPLETED && noOfThreats > 0) {

                /* Delete the viruses found in scanning. */
                //               final boolean virusesDeleted = handler.deleteViruses(progressBar, 
                //                                                       textArea,
                //                                                       textForThreatsFound,
                //                                                       virusScanning);

                /* Start killing viruses */

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        textArea.appendText("\n\n");
                        textArea.appendText("Killing:");
                        textArea.appendText("\n");
                        textArea.appendText("--------");
                        textArea.appendText("\n");
                    }
                });

                /* Cancel the Scan */
                q.setOnMouseClicked(new EventHandler<Event>() {

                    /**
                     * @param me
                     */
                    @Override
                    public void handle(Event me) {
                        isScanCancelled = true;
                    }
                });

                if (isScanCancelled) {
                    handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                    setVirusScanHistoryIfScanIsStopped(handler);
                    return null;
                }

                System.out.println("\n");

                removedThreats = 0;
                final Map<String, String> tempVirusDetectedMap = new HashMap<String, String>(virusDetectedMap);
                for (final Map.Entry<String, String> virusEntry : tempVirusDetectedMap.entrySet()) {
                    try {
                        if (rkm != null) {
                            rkm.deleteKey(virusEntry.getKey().substring(1), virusEntry.getValue());
                            javafx.application.Platform.runLater(new Runnable() {

                                /* (non-Javadoc)
                                 * @see java.lang.Runnable#run()
                                 */
                                @Override
                                public void run() {
                                    textArea.appendText("Removed the virus: " + virusEntry.getKey().substring(1)
                                            + "\\" + virusEntry.getValue());
                                    virusScanning.setText("");
                                    timerTextForThreats.setText("");
                                }
                            });
                            removedThreats++;
                            System.out.println("Removed the virus: " + virusEntry.getKey().substring(1) + "\\"
                                    + virusEntry.getValue());
                            virusDetectedMap.remove(virusEntry.getKey());
                        } else {
                            System.out.println("Scan is stopped due to: " + REGISTRY_KEY_MANEGER_EMPTY);
                            handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                            return null;
                        }
                    } catch (Exception e) {
                        System.out.println(e.getLocalizedMessage());
                    }

                    if (progressCount == tempVirusDetectedMap.size()) {
                        updateProgress(1, 1);
                    }

                    progressCount++;
                }

                if (StringUtils.equals(drop.getText(), "English")) {
                    textForThreatsRemoved.setText("Removed Threats: " + removedThreats);
                } else if (StringUtils.equals(drop.getText(), "Spanish")) {
                    textForThreatsFound.setText("Amenazas eliminados: " + noOfThreats);
                } else if (drop.getText().equals("French")) {
                    textForThreatsFound.setText("Menaces supprimes: " + noOfThreats);
                } else if (drop.getText().equals("Portuguese")) {
                    textForThreatsFound.setText("Ameaas removidos: " + noOfThreats);
                }

                /* Update the progress */
                updateProgress(1, 1);

                /* Wait for sometime */
                try {
                    Thread.sleep(1000);
                } catch (Exception e) {
                    System.out.println(e.getMessage());
                }

                System.out.println();
                System.out.println("Virus removal is completed");

                if (tempVirusDetectedMap != null) {
                    tempVirusDetectedMap.clear();
                }

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        if (textForScanInProgress.getText() != null) {
                            textForScanInProgress.clear();
                        }
                        textForScanInProgress.appendText("Virus scanning is completed");
                    }
                });

                if (virusDetectedMap.size() == 0) {

                    /* Display the protected screen. */
                    showTheProtectedPage();
                    isPageProtected = true;

                    javafx.application.Platform.runLater(new Runnable() {

                        /* (non-Javadoc)
                         * @see java.lang.Runnable#run()
                         */
                        @Override
                        public void run() {
                            /* Set the status */
                            statusValInDash.setStyle("-fx-text-fill: green;");

                            if (drop.getText().equals("English")) {
                                statusValInDash.setText("Potentially Protected");
                            } else if (drop.getText().equals("Spanish")
                                    || drop.getText().equals("Portuguese")) {
                                statusValInDash.setText("Potencialmente Protegido");
                            } else if (drop.getText().equals("French")) {
                                statusValInDash.setText("Potentiellement Protg");
                            }

                            VirusScanHistory virusScanHistory = new VirusScanHistory();
                            virusScanHistory.setScanDate(timestamp);
                            virusScanHistory.setScanStatus("SUCCESSFUL");
                            virusScanHistory.setPcName(System.getenv("COMPUTERNAME"));
                            virusScanHistory.setThreatsFound(noOfThreats);

                            virusScanHistoryList.add(virusScanHistory);
                        }
                    });
                } else {
                    c2.setStyle("-fx-background-color:#DF4444");
                    b1.setStyle("-fx-background-color:#373E48");
                    c1.setStyle("-fx-background-color:transparent");
                    b2.setStyle("-fx-background-color:transparent");
                    c3.setStyle("-fx-background-color:transparent");
                    b3.setStyle("-fx-background-color:transparent");
                    c4.setStyle("-fx-background-color:transparent");
                    b4.setStyle("-fx-background-color:transparent");
                    b5.setStyle("-fx-background-color:transparent");
                    b6.setStyle("-fx-background-color:transparent");

                    unprotected.setVisible(true);
                    unprotected.setManaged(true);

                    isProtected.setVisible(false);
                    isProtected.setManaged(false);

                    general.setVisible(false);
                    general.setManaged(false);

                    scann.setVisible(false);
                    scann.setManaged(false);

                    dash.setVisible(false);
                    dash.setManaged(false);

                    his.setVisible(false);
                    his.setManaged(false);

                    about.setVisible(false);
                    about.setManaged(false);

                    update.setVisible(false);
                    update.setManaged(false);

                    javafx.application.Platform.runLater(new Runnable() {

                        /* (non-Javadoc)
                         * @see java.lang.Runnable#run()
                         */
                        @Override
                        public void run() {
                            /* Set the text */
                            statusValInDash.setStyle("-fx-text-fill: red;");

                            if (drop.getText().equals("English")) {
                                statusValInDash.setText(POTENTIALLY_UNPROTECTED);
                            } else if (drop.getText().equals("Spanish")
                                    || drop.getText().equals("Portuguese")) {
                                statusValInDash.setText("Potencialmente Desprotegido");
                            } else if (drop.getText().equals("French")) {
                                statusValInDash.setText("Potentiellement non protg");
                            }

                            VirusScanHistory virusScanHistory = new VirusScanHistory();
                            virusScanHistory.setScanDate(timestamp);
                            virusScanHistory.setScanStatus("FAILED");
                            virusScanHistory.setPcName(System.getenv("COMPUTERNAME"));
                            virusScanHistory.setThreatsFound(noOfThreats);

                            virusScanHistoryList.add(virusScanHistory);
                        }
                    });
                }
                if (virusDetectedMap != null) {
                    virusDetectedMap.clear();
                }
            } else if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_SCAN_COMPLETED) {

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        if (textForScanInProgress.getText() != null) {
                            textForScanInProgress.clear();
                        }
                        textForScanInProgress.appendText("Virus scanning is completed");
                        statusValInDash.setStyle("-fx-text-fill: green;");
                        if (drop.getText().equals("English")) {
                            statusValInDash.setText("Potentially Protected");
                        } else if (drop.getText().equals("Spanish") || drop.getText().equals("Portuguese")) {
                            statusValInDash.setText("Potencialmente Protegido");
                        } else if (drop.getText().equals("French")) {
                            statusValInDash.setText("Potentiellement Protg");
                        }
                    }
                });

                showTheProtectedPage();
                isPageProtected = true;

                System.out.println("No viruses are found in scanning");
            }

            handler.setVirusScanStatus(VirusScanStatus.VIRUS_JOB_COMPLETED);

            javafx.application.Platform.runLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {

                    /* Set the values like last-scan, build in Dashboard based on the virus scan results. */
                    if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_JOB_COMPLETED) {

                        lastScanValInDash.setText(timestamp);
                        if (StringUtils.equals(drop.getText(), "English")) {
                            textForLastScanInHistory.setText("Last Scan: " + timestamp);
                        } else if (StringUtils.equals(drop.getText(), "Spanish")) {
                            textForLastScanInHistory.setText("ltimo escaneo: " + timestamp);
                        } else if (StringUtils.equals(drop.getText(), "French")) {
                            textForLastScanInHistory.setText("Dernier scan: " + timestamp);
                        } else if (StringUtils.equals(drop.getText(), "Portuguese")) {
                            textForLastScanInHistory.setText("ltima anlise: " + timestamp);
                        }

                    } else if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_SCAN_STOPPED) {

                        statusValInDash.setStyle("-fx-text-fill: red;");

                        if (drop.getText().equals("English")) {
                            statusValInDash.setText(POTENTIALLY_UNPROTECTED);
                        } else if (drop.getText().equals("Spanish") || drop.getText().equals("Portuguese")) {
                            statusValInDash.setText("Potencialmente Desprotegido");
                        } else if (drop.getText().equals("French")) {
                            statusValInDash.setText("Potentiellement non protg");
                        }

                        lastScanValInDash.setText(timestamp);

                    }
                }

            });

            /* Add the scan results to history. */
            processHistoryData();

            return null;
        }
    };
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractTimelineChart.java

/**
 * Add a Text Node to the specific label container for the decluttered axis
 * labels.//from www  .ja  v a2 s.  c  o m
 *
 * @param labelText  The String to add.
 * @param labelWidth The width, in pixels, of the space available for the
 *                   text.
 * @param labelX     The horizontal position, in pixels, in the specificPane
 *                   of the text.
 * @param bold       True if the text should be bold, false otherwise.
 */
private synchronized void addSpecificLabel(String labelText, double labelWidth, double labelX, boolean bold) {
    Text label = new Text(" " + labelText + " "); //NON-NLS
    label.setTextAlignment(TextAlignment.CENTER);
    label.setFont(Font.font(null, bold ? FontWeight.BOLD : FontWeight.NORMAL, 10));
    //position label accounting for width
    label.relocate(labelX + labelWidth / 2 - label.getBoundsInLocal().getWidth() / 2, 0);
    label.autosize();

    if (specificLabelPane.getChildren().isEmpty()) {
        //just add first label
        specificLabelPane.getChildren().add(label);
    } else {
        //otherwise don't actually add the label if it would intersect with previous label

        final Node lastLabel = specificLabelPane.getChildren().get(specificLabelPane.getChildren().size() - 1);

        if (false == lastLabel.getBoundsInParent().intersects(label.getBoundsInParent())) {
            specificLabelPane.getChildren().add(label);
        }
    }
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualization.java

/** add a {@link Text} node to the leaf container for the decluttered axis
 * labels//from  www  .j  a v a  2  s. co  m
 *
 * @param labelText  the string to add
 * @param labelWidth the width of the space available for the text
 * @param labelX     the horizontal position in the partPane of the text
 * @param bold       true if the text should be bold, false otherwise
 */
private synchronized void assignLeafLabel(String labelText, double labelWidth, double labelX, boolean bold) {

    Text label = new Text(" " + labelText + " ");
    label.setTextAlignment(TextAlignment.CENTER);
    label.setFont(Font.font(null, bold ? FontWeight.BOLD : FontWeight.NORMAL, 10));
    //position label accounting for width
    label.relocate(labelX + labelWidth / 2 - label.getBoundsInLocal().getWidth() / 2, 0);
    label.autosize();

    if (leafPane.getChildren().isEmpty()) {
        //just add first label
        leafPane.getChildren().add(label);
    } else {
        //otherwise don't actually add the label if it would intersect with previous label
        final Text lastLabel = (Text) leafPane.getChildren().get(leafPane.getChildren().size() - 1);

        if (!lastLabel.getBoundsInParent().intersects(label.getBoundsInParent())) {
            leafPane.getChildren().add(label);
        }
    }
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualizationPane.java

/**
 * add a {@link Text} node to the leaf container for the decluttered axis
 * labels//from w  ww  .jav a 2  s.c o m
 *
 * @param labelText  the string to add
 * @param labelWidth the width of the space available for the text
 * @param labelX     the horizontal position in the partPane of the text
 * @param bold       true if the text should be bold, false otherwise
 */
private synchronized void assignLeafLabel(String labelText, double labelWidth, double labelX, boolean bold) {

    Text label = new Text(" " + labelText + " "); //NOI18N
    label.setTextAlignment(TextAlignment.CENTER);
    label.setFont(Font.font(null, bold ? FontWeight.BOLD : FontWeight.NORMAL, 10));
    //position label accounting for width
    label.relocate(labelX + labelWidth / 2 - label.getBoundsInLocal().getWidth() / 2, 0);
    label.autosize();

    if (leafPane.getChildren().isEmpty()) {
        //just add first label
        leafPane.getChildren().add(label);
    } else {
        //otherwise don't actually add the label if it would intersect with previous label
        final Text lastLabel = (Text) leafPane.getChildren().get(leafPane.getChildren().size() - 1);

        if (!lastLabel.getBoundsInParent().intersects(label.getBoundsInParent())) {
            leafPane.getChildren().add(label);
        }
    }
}