Example usage for javafx.scene.paint Color TRANSPARENT

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

Introduction

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

Prototype

Color TRANSPARENT

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

Click Source Link

Document

A fully transparent color with an ARGB value of #00000000.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Arc arc = new Arc(0, 0, 50, 100, 0, 90);
    arc.setFill(Color.TRANSPARENT);
    arc.setStroke(Color.BLACK);/*from   ww w . j a v  a  2 s .c  o  m*/

    HBox box = new HBox(arc);

    Scene scene = new Scene(box);
    stage.setScene(scene);
    stage.setTitle("Test");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Arc arc = new Arc(0, 0, 50, 100, 0, 90);
    arc.setFill(Color.TRANSPARENT);
    arc.setStroke(Color.BLACK);/*  w  ww .  j  a v a2s .c om*/
    arc.setType(ArcType.ROUND);

    HBox box = new HBox(arc);

    Scene scene = new Scene(box);
    stage.setScene(scene);
    stage.setTitle("Test");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Arc arc = new Arc(0, 0, 50, 100, 0, 90);
    arc.setFill(Color.TRANSPARENT);
    arc.setStroke(Color.BLACK);//from   w w w  .j a  v a  2 s  .  c o  m
    arc.setType(ArcType.CHORD);

    HBox box = new HBox(arc);

    Scene scene = new Scene(box);
    stage.setScene(scene);
    stage.setTitle("Test");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Circle circle = new Circle(40);
    circle.setFill(Color.RED);//from w w w  . j  a v  a 2  s .co m
    circle.setStroke(Color.BLACK);
    circle.setStrokeWidth(2.0);

    Rectangle rect = new Rectangle(120, 75);
    rect.setFill(Color.RED);

    // Create a line
    Line line = new Line(0, 0, 150, 50);
    line.setStrokeWidth(5.0);
    line.setStroke(Color.GREEN);

    // Create a parallelogram
    Polygon parallelogram = new Polygon();
    parallelogram.getPoints().addAll(30.0, 0.0, 130.0, 0.0, 120.00, 50.0, 0.0, 50.0);
    parallelogram.setFill(Color.AZURE);
    parallelogram.setStroke(Color.BLACK);

    // Create a hexagon
    Polyline hexagon = new Polyline(100.0, 0.0, 120.0, 20.0, 110.0, 140.0, 100.0, 60.0, 80.0, 40.0, 80.0, 120.0,
            100.0, 0.0);
    hexagon.setFill(Color.WHITE);
    hexagon.setStroke(Color.BLACK);

    // A CHORD arc with no fill and a stroke
    Arc arc = new Arc(0, 0, 50, 100, 0, 90);
    arc.setFill(Color.TRANSPARENT);
    arc.setStroke(Color.BLACK);
    arc.setType(ArcType.CHORD);

    // Add all shapes to an HBox
    HBox root = new HBox(circle, rect, line, parallelogram, hexagon, arc);
    root.setSpacing(10);
    root.setStyle("-fx-padding: 10;" + "-fx-border-style: solid inside;" + "-fx-border-width: 2;"
            + "-fx-border-insets: 5;" + "-fx-border-radius: 5;" + "-fx-border-color: blue;");

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("2D Shapes");
    stage.show();
}

From source file:smarthome.FXMLDocumentController.java

@FXML
private void pwdChangeButtonAction(ActionEvent event) {

    Stage stage = new Stage();
    //Fill stage with content
    stage.setTitle("New Window");

    stage.setTitle("Smart Home");
    Parent root;//from www  . ja  va 2  s. co m
    try {
        root = FXMLLoader.load(getClass().getResource("changeUserPasswd.fxml"));
        Undecorator undecorator = new Undecorator(stage, (Region) root);
        undecorator.getStylesheets().add("skin/undecorator.css");
        Scene scene = new Scene(undecorator);
        stage.setScene(scene);
        scene.setFill(Color.TRANSPARENT);
        stage.initStyle(StageStyle.TRANSPARENT);
        stage.setScene(scene);
        stage.setResizable(false);
        stage.show();

    } catch (IOException ex) {
        Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:ijfx.ui.previewToolbar.DefaultWidget.java

@Override
public Image getImage(PreviewService previewService, int size) {

    if (image != null)
        return image;

    if (previewService == null)
        return null;

    if (previewService.getImageDisplayService().getActiveDataset() == null) {
        return null;
    } else if (this.getIcon().equals("preview")) {
        try {/*from  w  w  w .  ja  va  2 s  .  co m*/
            previewService.setParameters(-1, -1, size, size);
            return previewService.getImageDisplay(action, this.getParameters());

        } catch (Exception e) {
            e.printStackTrace();
            FontAwesomeIconView fontAwesomeIconView = new FontAwesomeIconView(FontAwesomeIcon.AMBULANCE);
            return FontAwesomeIconUtils.FAItoImage(fontAwesomeIconView, size);
        }
    }

    else if (getIcon().startsWith("char:")) {
        Canvas canvas = new Canvas(size, size);
        GraphicsContext graphicsContext2D = canvas.getGraphicsContext2D();

        graphicsContext2D.setFill(Color.WHITE);
        graphicsContext2D.setFont(javafx.scene.text.Font.font("Arial", size));
        graphicsContext2D.fillText(getIcon().substring(5), size / 3, size * 0.8);

        final SnapshotParameters params = new SnapshotParameters();
        params.setFill(Color.TRANSPARENT);
        //            final WritableImage snapshot = canvas.snapshot(params, null);

        Task<WritableImage> getIcon = new CallbackTask<Canvas, WritableImage>(canvas)
                .run(input -> input.snapshot(params, null));

        Platform.runLater(getIcon);

        try {
            // Image image = new Ima

            image = getIcon.get();
            return image;
        } catch (InterruptedException ex) {
            Logger.getLogger(DefaultWidget.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ExecutionException ex) {
            Logger.getLogger(DefaultWidget.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

    //Check if icon exist in Enumeration
    else if (Arrays.stream(FontAwesomeIcon.values()).filter(e -> e.name().equals(icon)).count() > 0) {

        FontAwesomeIconView fontAwesomeIconView = new FontAwesomeIconView(FontAwesomeIcon.valueOf(icon));
        return FontAwesomeIconUtils.FAItoImage(fontAwesomeIconView, size);
    } else {
        image = new Image(getClass().getResource(icon).toExternalForm(), size, size, true, true);
        return image;
    }
}

From source file:de.mirkosertic.desktopsearch.DesktopSearch.java

@Override
public void start(Stage aStage) throws Exception {

    // This is our base directory
    File theBaseDirectory = new File(SystemUtils.getUserHome(), "FreeSearchIndexDir");
    theBaseDirectory.mkdirs();/*from  www  .  ja v  a2  s.co  m*/

    configurationManager = new ConfigurationManager(theBaseDirectory);

    Notifier theNotifier = new Notifier();

    stage = aStage;

    // Create the known preview processors
    PreviewProcessor thePreviewProcessor = new PreviewProcessor();

    try {
        // Boot the search backend and set it up for listening to configuration changes
        backend = new Backend(theNotifier, configurationManager.getConfiguration(), thePreviewProcessor);
        configurationManager.addChangeListener(backend);

        // Boot embedded JSP container
        embeddedWebServer = new FrontendEmbeddedWebServer(aStage, backend, thePreviewProcessor,
                configurationManager);

        embeddedWebServer.start();
    } catch (BindException | LockReleaseFailedException | LockObtainFailedException e) {
        // In this case, there is already an instance of DesktopSearch running
        // Inform the instance to bring it to front end terminate the current process.
        URL theURL = new URL(FrontendEmbeddedWebServer.getBringToFrontUrl());
        // Retrieve the content, but it can be safely ignored
        // There must only be the get request
        Object theContent = theURL.getContent();

        // Terminate the JVM. The window of the running instance is visible now.
        System.exit(0);
    }

    aStage.setTitle("Free Desktop Search");
    aStage.setWidth(800);
    aStage.setHeight(600);
    aStage.initStyle(StageStyle.TRANSPARENT);

    FXMLLoader theLoader = new FXMLLoader(getClass().getResource("/scenes/mainscreen.fxml"));
    AnchorPane theMainScene = theLoader.load();

    final DesktopSearchController theController = theLoader.getController();
    theController.configure(this, backend, FrontendEmbeddedWebServer.getSearchUrl(), stage.getOwner());

    Undecorator theUndecorator = new Undecorator(stage, theMainScene);
    theUndecorator.getStylesheets().add("/skin/undecorator.css");

    Scene theScene = new Scene(theUndecorator);

    // Hacky, but works...
    theUndecorator.setStyle("-fx-background-color: rgba(0, 0, 0, 0);");

    theScene.setFill(Color.TRANSPARENT);
    aStage.setScene(theScene);

    aStage.getIcons().add(new Image(getClass().getResourceAsStream("/fds.png")));

    if (SystemTray.isSupported()) {
        Platform.setImplicitExit(false);
        SystemTray theTray = SystemTray.getSystemTray();

        // We need to reformat the icon according to the current tray icon dimensions
        // this depends on the underlying OS
        java.awt.Image theTrayIconImage = Toolkit.getDefaultToolkit()
                .getImage(getClass().getResource("/fds_small.png"));
        int trayIconWidth = new TrayIcon(theTrayIconImage).getSize().width;
        TrayIcon theTrayIcon = new TrayIcon(
                theTrayIconImage.getScaledInstance(trayIconWidth, -1, java.awt.Image.SCALE_SMOOTH),
                "Free Desktop Search");
        theTrayIcon.setImageAutoSize(true);
        theTrayIcon.setToolTip("FXDesktopSearch");
        theTrayIcon.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 1) {
                    Platform.runLater(() -> {
                        if (stage.isIconified()) {
                            stage.setIconified(false);
                        }
                        stage.show();
                        stage.toFront();
                    });
                }
            }
        });
        theTray.add(theTrayIcon);

        aStage.setOnCloseRequest(aEvent -> stage.hide());
    } else {

        aStage.setOnCloseRequest(aEvent -> shutdown());
    }

    aStage.setMaximized(true);
    aStage.show();
}

From source file:de.chaosfisch.uploader.gui.GUIUploader.java

private void initApplication(final Stage primaryStage) {

    try {/* ww w. jav a2  s.c  om*/

        final Parent parent = fxmlLoader
                .load(getClass().getResource("/de/chaosfisch/uploader/view/SimpleJavaYoutubeUploader.fxml"),
                        resources)
                .getRoot();

        final Scene scene = SceneBuilder.create().root(parent).fill(Color.TRANSPARENT).build();

        try (InputStream iconInputStream = getClass()
                .getResourceAsStream("/de/chaosfisch/uploader/resources/images/film.png")) {
            StageBuilder.create().icons(new Image(iconInputStream)).minHeight(MIN_HEIGHT).height(MIN_HEIGHT)
                    .minWidth(MIN_WIDTH).width(MIN_WIDTH).scene(scene).resizable(true)
                    .onCloseRequest(new ApplicationClosePromptDialog()).applyTo(primaryStage);
        }
        parent.setOnMouseDragged(new EventHandler<MouseEvent>() {

            @Override
            public void handle(final MouseEvent me) {
                primaryStage.setX(me.getScreenX() - initX);
                primaryStage.setY(me.getScreenY() - initY);
            }
        });

        parent.setOnMousePressed(new EventHandler<MouseEvent>() {
            @Override
            public void handle(final MouseEvent me) {
                initX = me.getScreenX() - primaryStage.getX();
                initY = me.getScreenY() - primaryStage.getY();
            }
        });

        primaryStage.initStyle(StageStyle.TRANSPARENT);
        primaryStage.show();
    } catch (final IOException e) {
        LOGGER.error("FXML Load error", e);
        throw new RuntimeException(e);
    }
}

From source file:net.rptools.image.listeners.DrawHandler.java

/**
 * Convert the shape into an image for storage in the layer model.
 *///from w ww  .  java2s.  co m
@ThreadPolicy(ThreadPolicy.ThreadId.JFX)
private void finalizeDrawing() {
    final SnapshotParameters params = new SnapshotParameters();
    params.setFill(Color.TRANSPARENT);
    final WritableImage snapshot = currentShape.snapshot(params, null);
    final Bounds bounds = currentShape.getBoundsInParent();
    getLayer().addImage(snapshot, bounds.getMinX(), bounds.getMinY());
    getLayer().getDrawable().getChildren().remove(currentShape);
}

From source file:jp.co.heppokoact.autocapture.FXMLDocumentController.java

@FXML
private void areaButtonClicked(ActionEvent event) throws IOException {
    System.out.println("areaButtonClicked");

    // ??//from   w w  w  .jav a2  s  .  co m
    Stage transparentStage = createTransparentStage();

    // ?????
    Scene scene = transparentStage.getScene();
    scene.setOnMousePressed(e -> {
        // 
        dragStartX = (int) e.getScreenX();
        dragStartY = (int) e.getScreenY();
        // ??
        areaRect = new Rectangle(e.getX(), e.getY(), 0, 0);
        areaRect.setStroke(Color.RED);
        areaRect.setStrokeWidth(1.0);
        areaRect.setFill(Color.TRANSPARENT);
        ((Pane) scene.getRoot()).getChildren().add(areaRect);
    });

    // ?????
    scene.setOnMouseDragged(e -> {
        // ??????
        areaRect.setWidth(e.getScreenX() - dragStartX);
        areaRect.setHeight(e.getScreenY() - dragStartY);

    });

    // ?????
    scene.setOnMouseReleased(e -> {
        // ?
        areaStartX.set(dragStartX);
        areaStartY.set(dragStartY);
        areaEndX.set((int) e.getScreenX());
        areaEndY.set((int) e.getScreenY());
        // ??
        transparentStage.close();
    });

    // ??????
    transparentStage.setOnCloseRequest(e -> {
        // ?????
        dragStartX = 0;
        dragStartY = 0;
        areaRect = null;
    });

    transparentStage.show();
}