Java Code Examples for javafx.scene.Scene#setFill()

The following examples show how to use javafx.scene.Scene#setFill() . 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: ReceptionistController.java    From HealthPlus with Apache License 2.0 8 votes vote down vote up
@FXML
public void showAppointmentSuccessIndicator(String patientId, String consult, String appDate, String appId)
{
    Stage stage= new Stage();
    AppointmentSuccessController success = new AppointmentSuccessController();
    
    success.fillAppointmentData(patientId,consult,appDate,appId);
    
    Scene scene = new Scene(success);
    stage.setScene(scene);
    
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    //set Stage boundaries to visible bounds of the main screen
    stage.setX(primaryScreenBounds.getMinX());
    stage.setY(primaryScreenBounds.getMinY());
    stage.setWidth(primaryScreenBounds.getWidth());
    stage.setHeight(primaryScreenBounds.getHeight());
    
    stage.initStyle(StageStyle.UNDECORATED);
    scene.setFill(null);
    stage.initStyle(StageStyle.TRANSPARENT);
    stage.show();
}
 
Example 2
Source File: Demo.java    From Enzo with Apache License 2.0 7 votes vote down vote up
@Override public void start(Stage stage) {
    PushButton control = PushButtonBuilder.create()
                                          .prefWidth(81)
                                          .prefHeight(43)
                                          .build();

    ToggleButton button = new ToggleButton("Push");
    button.setPrefSize(81, 43);
    button.getStylesheets().add(getClass().getResource("demo.css").toExternalForm());

    VBox pane = new VBox();
    pane.setSpacing(5);
    pane.getChildren().setAll(control, button);

    Scene scene = new Scene(pane);
    scene.setFill(Color.rgb(208,69,28));

    stage.setTitle("JavaFX Custom Control");
    stage.setScene(scene);
    stage.show();
}
 
Example 3
Source File: DesktopNotification.java    From yfiton with Apache License 2.0 6 votes vote down vote up
@Override
public void start(Stage primaryStage) {
    Map<String, String> parameters = getParameters().getNamed();

    primaryStage.initStyle(StageStyle.TRANSPARENT);

    Scene scene = new Scene(new VBox(), 1, 1);
    scene.setFill(null);
    primaryStage.setScene(scene);
    primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("/yfiton-icon.png")));
    primaryStage.show();

    Notifications.create()
            .darkStyle()
            .graphic(new ImageView(Notifications.class.getResource("/" + parameters.get("type") + ".png").toExternalForm()))
            .hideAfter(Duration.seconds(Integer.parseInt(parameters.get("hideAfter"))))
            .onHideAction(event -> System.exit(0))
            .position(Pos.valueOf(parameters.get("position")))
            .text(parameters.get("message"))
            .show();
}
 
Example 4
Source File: AdminController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
@FXML
private void viewCashierAccounts()
{
    Stage stage = new Stage();
    UserAccountController userAccounts = new UserAccountController("cashier",admin);
    
    ArrayList<ArrayList<String>> data = admin.getUserInfo("cashier");
    System.out.println(data);
    userAccounts.fillUserDetail(data);
    
    Scene scene = new Scene(userAccounts);
    stage.setScene(scene);
    
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    //set Stage boundaries to visible bounds of the main screen
    stage.setX(primaryScreenBounds.getMinX());
    stage.setY(primaryScreenBounds.getMinY());
    stage.setWidth(primaryScreenBounds.getWidth());
    stage.setHeight(primaryScreenBounds.getHeight());
    
    stage.initStyle(StageStyle.UNDECORATED);
    scene.setFill(null);
    stage.initStyle(StageStyle.TRANSPARENT);
    stage.show(); 
}
 
Example 5
Source File: AdminController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
@FXML
private void showSettings() throws IOException
{
    Stage stage = new Stage();
    SettingsController settings = new SettingsController(admin,this);
    settings.loadConfigFile();
    
    Scene scene = new Scene(settings);
    stage.setScene(scene);
    
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    //set Stage boundaries to visible bounds of the main screen
    stage.setX(primaryScreenBounds.getMinX());
    stage.setY(primaryScreenBounds.getMinY());
    stage.setWidth(primaryScreenBounds.getWidth());
    stage.setHeight(primaryScreenBounds.getHeight());
    stage.initStyle(StageStyle.UNDECORATED);
    scene.setFill(null);
    stage.initStyle(StageStyle.TRANSPARENT);
    stage.show(); 
}
 
Example 6
Source File: AdminController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
@FXML
private void viewOnlineAccounts()
{
    Stage stage = new Stage();
    UserAccountController userAccounts = new UserAccountController("",admin);
    
    ArrayList<ArrayList<String>> data = admin.getOnlineInfo();
    userAccounts.fillUserDetail(data);
    
    Scene scene = new Scene(userAccounts);
    stage.setScene(scene);
    
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    //set Stage boundaries to visible bounds of the main screen
    stage.setX(primaryScreenBounds.getMinX());
    stage.setY(primaryScreenBounds.getMinY());
    stage.setWidth(primaryScreenBounds.getWidth());
    stage.setHeight(primaryScreenBounds.getHeight());
    stage.initStyle(StageStyle.UNDECORATED);
    scene.setFill(null);
    stage.initStyle(StageStyle.TRANSPARENT);
    stage.show(); 
}
 
Example 7
Source File: CashierController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
@FXML
public void showSuccessIndicator()
{
    Stage stage= new Stage();
    SuccessIndicatorController success = new SuccessIndicatorController();
    Scene scene = new Scene(success);
    stage.setScene(scene);
    
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    //set Stage boundaries to visible bounds of the main screen
    stage.setX(primaryScreenBounds.getMinX());
    stage.setY(primaryScreenBounds.getMinY());
    stage.setWidth(primaryScreenBounds.getWidth());
    stage.setHeight(primaryScreenBounds.getHeight());
    
    stage.initStyle(StageStyle.UNDECORATED);
    scene.setFill(null);
    stage.initStyle(StageStyle.TRANSPARENT);
    stage.show();
}
 
Example 8
Source File: FillPatternStyleHelper.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
private static Image createDefaultHatch(final Paint color, final double strokeWidth) {
    WeakHashMap<Double, Image> checkCache = FillPatternStyleHelper.defaultHatchCacheWithStrokeWidth.get(color);
    if (checkCache != null) {
        final Image val = checkCache.get(Double.valueOf(strokeWidth));
        if (val != null) {
            // found existing Image with given parameter
            return val;
        }
    }
    // need to recompute hatch pattern image

    final Pane pane = new Pane();
    pane.setPrefSize(10, 10);
    final Line fw = new Line(-5, -5, 25, 25);
    final Line bw = new Line(-5, 25, 25, -5);
    fw.setSmooth(false);
    bw.setSmooth(false);
    fw.setStroke(color);
    bw.setStroke(color);
    fw.setStrokeWidth(strokeWidth);
    bw.setStrokeWidth(strokeWidth);
    pane.getChildren().addAll(fw, bw);

    pane.setStyle("-fx-background-color: rgba(0, 0, 0, 0.0)");
    final Scene scene = new Scene(pane);
    scene.setFill(Color.TRANSPARENT);
    final Image retVal = pane.snapshot(null, null);
    // add retVal to cache
    if (checkCache == null) {
        final WeakHashMap<Double, Image> temp = new WeakHashMap<>();
        temp.put(Double.valueOf(strokeWidth), retVal);
        FillPatternStyleHelper.defaultHatchCacheWithStrokeWidth.put(color, temp);
        // checkCache = new WeakHashMap<>();
    } else {
        checkCache.put(Double.valueOf(strokeWidth), retVal);
    }

    return retVal;
}
 
Example 9
Source File: TrapezoidTest.java    From FXyzLib with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
    shapeGroup.getChildren().clear();
    generateShapes();
    root.getChildren().add(shapeGroup);
            
    camera = new AdvancedCamera();
    controller = new FPSController();
    
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setFieldOfView(42);
    camera.setController(controller);
    
    Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
    scene.setCamera(camera);
    scene.setFill(Color.BLACK);
    
    controller.setScene(scene);
    scene.setOnKeyPressed(event -> {
        //What key did the user press?
        KeyCode keycode = event.getCode();
        if(keycode == KeyCode.SPACE) {
            shapeGroup.getChildren().clear();
            generateShapes();                
        }
    });
    
    stage.setTitle("Random Trapezoids!");
    stage.setScene(scene);
    stage.show();
    stage.setFullScreen(false);
    stage.setFullScreenExitHint("");
}
 
Example 10
Source File: TestTranparentApps.java    From oim-fx with MIT License 5 votes vote down vote up
public WebPage(Stage mainstage) {
	webview = new WebView();
	webengine = webview.getEngine();

	Scene scene = new Scene(webview);
	scene.setFill(null);

	mainstage.setScene(scene);
	mainstage.initStyle(StageStyle.TRANSPARENT);
	mainstage.setWidth(700);
	mainstage.setHeight(100);

	webengine.documentProperty().addListener(new DocListener());
	webengine.loadContent("<body style='background : rgba(0,0,0,0);font-size: 70px;text-align:center;'>Test Transparent</body>");
}
 
Example 11
Source File: CameraViewTest.java    From FXyzLib with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
    
    loadSubScene();
    root.setStyle("-fx-background-color: DEEPSKYBLUE;");
    Scene scene = new Scene(root, 810,610, true, SceneAntialiasing.BALANCED);
    scene.setFill(Color.TRANSPARENT);
           
    stage.setTitle("MiniMapTest");
    stage.setScene(scene);
    //stage.initStyle(StageStyle.TRANSPARENT);
    stage.show();
    stage.setMaximized(true);
    cameraView.startViewing();
}
 
Example 12
Source File: RefundController.java    From HealthPlus with Apache License 2.0 5 votes vote down vote up
@FXML private void getRefundInfo()
{
    
    Refund refund = (Refund)refundTable.getSelectionModel().getSelectedItem();
    
    TablePosition pos = refundTable.getFocusModel().getFocusedCell();
    int column = pos.getColumn();
    if (column == 5)
    {
        info.setText("refund " + refund.getPatientID());
        
        Stage stage = new Stage();
        PopupAskController popup = new PopupAskController(info,cashier,this);
        popup.message("  Make the Refund?");    

        Scene scene = new Scene(popup);
        stage.setScene( scene );

        Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
        //set Stage boundaries to visible bounds of the main screen
        stage.setX(primaryScreenBounds.getMinX());
        stage.setY(primaryScreenBounds.getMinY());
        stage.setWidth(primaryScreenBounds.getWidth());
        stage.setHeight(primaryScreenBounds.getHeight());

        stage.initStyle(StageStyle.UNDECORATED);
        scene.setFill(null);
        stage.initStyle(StageStyle.TRANSPARENT);
        stage.show();
    }    
    
    if (info.getText().equals("1"))
    {
        System.out.println("Yes!");
    }   
    System.out.println(info.getText());
    
}
 
Example 13
Source File: AdminController.java    From HealthPlus with Apache License 2.0 5 votes vote down vote up
@FXML private void showReports()
{
    Stage stage = new Stage();
    ReportsController reports = new ReportsController(admin);
    
    reports.fillPatientAttendence("All");
    reports.fillPieChart(12);
    reports.fillAppointmentChart("a");
    reports.fillCancelledAppointmentChart("a");
    
    
    reports.fillStockChart();
    reports.fillSupplierChart();
    
    LocalDate date = LocalDate.now();
    LocalDate date2 = date.minusMonths(12);
    DateTimeFormatter fomatter = DateTimeFormatter.ofPattern("yyyy-MMM-dd");
    
    reports.fillTotalIncomeBarGraph(fomatter.format(date2),fomatter.format(date));
    reports.fillIcome("a",fomatter.format(date2),fomatter.format(date));
    
    Scene scene = new Scene(reports);
    stage.setScene(scene);
    
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    //set Stage boundaries to visible bounds of the main screen
    stage.setX(primaryScreenBounds.getMinX());
    stage.setY(primaryScreenBounds.getMinY());
    stage.setWidth(primaryScreenBounds.getWidth());
    stage.setHeight(primaryScreenBounds.getHeight());
    stage.initStyle(StageStyle.UNDECORATED);
    scene.setFill(null);
    stage.initStyle(StageStyle.TRANSPARENT);
    stage.show(); 
}
 
Example 14
Source File: LabAssistantController.java    From HealthPlus with Apache License 2.0 4 votes vote down vote up
public void showReport(String reportID)
{

        String type = "";
        ArrayList<ArrayList<String>> data = null;
        
        if ( reportID.substring(0,2).equals("ur") ) {
        
            data = lab.getUrineFullReport(reportID);
            type = "ur";
            
        } else if ( reportID.substring(0,2).equals("li") ) {
            
            data = lab.getLipidTestReport(reportID);
            type = "li";
            
        } else if ( reportID.substring(0,2).equals("bg") ) {
        
            data = lab.getBloodGroupingRh(reportID);
            type = "bg";
            
        } else if ( reportID.substring(0,3).equals("cbc") ) {
        
            data = lab.getCompleteBloodCount(reportID);
            type = "cbc";
            
        } else if ( reportID.substring(0,2).equals("lv") ) {
        
            data = lab.getLiverFunctionTest(reportID);
            type = "lv";
            
        } else if ( reportID.substring(0,2).equals("re") ) {
        
            data = lab.getRenalFunctionTest(reportID);
            type = "re";
            
        } else if ( reportID.substring(0,4).equals("scpt") ) {
        
            data = lab.getSeriumCreatinePhosphokinaseTotal(reportID);
            type = "scpt";
            
        } else if ( reportID.substring(0,3).equals("scp") ) {
        
            data = lab.getSeriumCreatinePhosphokinase(reportID);
            type = "scp";
            
        }     
        
        if (data.size() > 1){
            LabReportPreviewController preview = new LabReportPreviewController(lab);
            preview.setData(data,type);

            Stage stage = new Stage();
            Scene scene = new Scene(preview);
            stage.setScene(scene);

            Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
            //set Stage boundaries to visible bounds of the main screen
            stage.setX(primaryScreenBounds.getMinX());
            stage.setY(primaryScreenBounds.getMinY());
            stage.setWidth(primaryScreenBounds.getWidth());
            stage.setHeight(primaryScreenBounds.getHeight());
            stage.initStyle(StageStyle.UNDECORATED);
            scene.setFill(null);
            stage.initStyle(StageStyle.TRANSPARENT);
            stage.show(); 
        } else {
            
            //showErrorPopup("No Report", appointmentIDtext);
        }

}
 
Example 15
Source File: CapsuleTest.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void start(Stage stage) {
    
    Group capsuleGroup = new Group();        
    for (int i = 0; i < 50; i++) {
        Random r = new Random();
        //A lot of magic numbers in here that just artificially constrain the math
        float randomRadius = (float) ((r.nextFloat() * 100) + 25);
        float randomHeight = (float) ((r.nextFloat() * 300) + 75);
        Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
        
        Capsule cap = new Capsule(randomRadius, randomHeight, randomColor);               
        cap.setEmissiveLightingColor(randomColor);
        cap.setEmissiveLightingOn(r.nextBoolean());
        cap.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);
        
        double translationX = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationX *= -1;
        }
        double translationY = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationY *= -1;
        }
        double translationZ = Math.random() * 1024 * 1.95;
        if (Math.random() >= 0.5) {
            translationZ *= -1;
        }
        Translate translate = new Translate(translationX, translationY, translationZ);
        Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
        Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
        Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);

        cap.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
        
        capsuleGroup.getChildren().add(cap);
    }
    
    root.getChildren().add(capsuleGroup);
            
    camera = new AdvancedCamera();
    controller = new FPSController();
    
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setFieldOfView(42);
    camera.setController(controller);
    
    Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
    scene.setCamera(camera);
    scene.setFill(Color.BLACK);
    
    controller.setScene(scene);
            
    stage.setTitle("Hello World!");
    stage.setScene(scene);
    stage.show();
    stage.setFullScreen(true);
    stage.setFullScreenExitHint("");
}
 
Example 16
Source File: ScatterPlotColorTest.java    From FXyzLib with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    Group sceneRoot = new Group();
    Scene scene = new Scene(sceneRoot, sceneWidth, sceneHeight, true, SceneAntialiasing.BALANCED);
    scene.setFill(Color.BLACK);
    camera = new PerspectiveCamera(true);        
    camera.setNearClip(0.1);
    camera.setFarClip(10000.0);
    camera.setTranslateZ(-1000);
    scene.setCamera(camera);
    
    scatterPlot = new ScatterPlot(1000, 1, true);
    sceneRoot.getChildren().addAll(scatterPlot);
    
    List<Double> dataX = new ArrayList<>();
    List<Double> dataY = new ArrayList<>();
    List<Double> dataZ = new ArrayList<>();
    List<Color> colors = new ArrayList<>();
    int k = 0;
    for(int i=-250;i<250;i++) {
        dataX.add(new Double(i));
        dataY.add(Math.sin(i)*50+i);
        dataZ.add(Math.cos(i)*50+i);
        colors.add(new Color(Math.abs(i) / 250D, Math.abs(dataY.get(k)) / 300D, Math.abs(dataZ.get(k) / 300D), 0.25));
        k++;
    }
        
    scatterPlot.setXYZData(dataX, dataY, dataZ, colors);

    scene.setOnKeyPressed(event -> {
        double change = 10.0;
        //Add shift modifier to simulate "Running Speed"
        if(event.isShiftDown()) { change = 50.0; }
        //What key did the user press?
        KeyCode keycode = event.getCode();
        //Step 2c: Add Zoom controls
        if(keycode == KeyCode.W) { camera.setTranslateZ(camera.getTranslateZ() + change); }
        if(keycode == KeyCode.S) { camera.setTranslateZ(camera.getTranslateZ() - change); }
        //Step 2d:  Add Strafe controls
        if(keycode == KeyCode.A) { camera.setTranslateX(camera.getTranslateX() - change); }
        if(keycode == KeyCode.D) { camera.setTranslateX(camera.getTranslateX() + change); }
    });        
    
    //Add a Mouse Handler for Rotations
    Rotate xRotate = new Rotate(0, Rotate.X_AXIS);
    Rotate yRotate = new Rotate(0, Rotate.Y_AXIS);
    Rotate zRotate = new Rotate(0, Rotate.Z_AXIS);
    
    scatterPlot.getTransforms().addAll(xRotate, yRotate);
    //Use Binding so your rotation doesn't have to be recreated
    xRotate.angleProperty().bind(angleX);
    yRotate.angleProperty().bind(angleY);
    zRotate.angleProperty().bind(angleZ);
    
    //Start Tracking mouse movements only when a button is pressed
    scene.setOnMousePressed(event -> {
        scenex = event.getSceneX();
        sceney = event.getSceneY();
        fixedXAngle = angleX.get();
        fixedYAngle = angleY.get();
        if(event.isMiddleButtonDown()) {
            scenez = event.getSceneX();
            fixedZAngle = angleZ.get();
        }
        
    });
    //Angle calculation will only change when the button has been pressed
    scene.setOnMouseDragged(event -> {
        if(event.isMiddleButtonDown()) 
            angleZ.set(fixedZAngle - (scenez - event.getSceneY()));
        else
            angleX.set(fixedXAngle - (scenex - event.getSceneY()));
            
        
        angleY.set(fixedYAngle + sceney - event.getSceneX());
    });        
    
    primaryStage.setTitle("F(X)yz ScatterPlotColorTest");
    primaryStage.setScene(scene);
    primaryStage.show();        
}
 
Example 17
Source File: TransparentStage.java    From mcaselector with MIT License 4 votes vote down vote up
public TransparentStage(javafx.stage.Window parent) {
	//create ONE Pane that contains all the elements
	initStyle(StageStyle.TRANSPARENT);
	setResizable(false);
	initModality(Modality.APPLICATION_MODAL);
	initOwner(parent);

	Pane shadow = new Pane();
	shadow.getStyleClass().add("transparent-stage-shadow");

	Rectangle innerRect = new Rectangle();
	Rectangle outerRect = new Rectangle();
	shadow.layoutBoundsProperty().addListener(
			(observable, oldBounds, newBounds) -> {
				innerRect.relocate(
						newBounds.getMinX() + shadowSize,
						newBounds.getMinY() + shadowSize
				);
				innerRect.setWidth(newBounds.getWidth() - shadowSize * 2);
				innerRect.setHeight(newBounds.getHeight() - shadowSize * 2);

				outerRect.setWidth(newBounds.getWidth());
				outerRect.setHeight(newBounds.getHeight());

				Shape clip = Shape.subtract(outerRect, innerRect);
				shadow.setClip(clip);
			}
	);

	content = new StackPane(shadow);
	content.getStyleClass().add("transparent-stage-content-root");

	content.setOnMousePressed(e -> {
		xOffset = e.getSceneX();
		yOffset = e.getSceneY();
	});

	content.setOnMouseDragged(e -> {
		setX(e.getScreenX() - xOffset);
		setY(e.getScreenY() - yOffset);
	});

	Scene scene = new Scene(content);
	scene.setFill(Color.TRANSPARENT);
	scene.getStylesheets().addAll(parent.getScene().getStylesheets());
	setScene(scene);
}
 
Example 18
Source File: DisplayStage.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Create a new display window positioned to fill the given rectangle.
 * <p/>
 * @param area the area in which the window should be drawn.
 * @param stageView true if the display stage is a stage view, false if it's
 * a normal projection view.
 */
public DisplayStage(Bounds area, boolean stageView) {
    final boolean playVideo = !stageView;
    initStyle(StageStyle.TRANSPARENT);
    Utils.addIconsToStage(this);
    setTitle(LabelGrabber.INSTANCE.getLabel("projection.window.title"));
    setAreaImmediate(area);
    StackPane scenePane = new StackPane();
    scenePane.setStyle("-fx-background-color: transparent;");
    canvas = new DisplayCanvas(true, stageView, playVideo, null, stageView ? Priority.HIGH : Priority.MID);
    canvas.setCursor(BLANK_CURSOR);
    scenePane.getChildren().add(canvas);
    if (stageView) {
        final Clock clock = new Clock();
        ChangeListener<Number> cl = new ChangeListener<Number>() {

            @Override
            public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
                double size = getWidth();
                if (getHeight() < size) {
                    size = getHeight();
                }
                clock.setFontSize(size / 24);
            }
        };
        widthProperty().addListener(cl);
        heightProperty().addListener(cl);
        StackPane.setAlignment(clock, Pos.BOTTOM_RIGHT);
        scenePane.getChildren().add(clock);
        clock.toFront();
    }
    testImage = new TestImage();
    testImage.getImageView().setPreserveRatio(true);
    testImage.getImageView().fitWidthProperty().bind(widthProperty());
    testImage.getImageView().fitHeightProperty().bind(heightProperty());
    scenePane.getChildren().add(testImage);
    testImage.setVisible(false);
    testImage.toFront();
    Scene scene = new Scene(scenePane);
    if (!stageView) {
        scene.setFill(null);
    }
    setScene(scene);
    if (playVideo) {
        addVLCListeners();
    }
}
 
Example 19
Source File: AttributeEditorDialog.java    From constellation with Apache License 2.0 4 votes vote down vote up
public AttributeEditorDialog(final boolean restoreDefaultButton, final AbstractEditor<?> editor) {
    final VBox root = new VBox();
    root.setPadding(new Insets(10));
    root.setAlignment(Pos.CENTER);
    root.setFillWidth(true);

    errorLabel = new Label("");
    errorLabel.setId("error");

    okButton = new Button("Ok");
    cancelButton = new Button("Cancel");
    defaultButton = new Button("Restore Default");

    okButton.setOnAction(e -> {
        editor.performEdit();
        hideDialog();
    });

    cancelButton.setOnAction(e -> {
        hideDialog();
    });

    defaultButton.setOnAction(e -> {
        editor.setDefaultValue();
    });

    okCancelHBox = new HBox(20);
    okCancelHBox.setPadding(new Insets(10));
    okCancelHBox.setAlignment(Pos.CENTER);
    if (restoreDefaultButton) {
        okCancelHBox.getChildren().addAll(okButton, cancelButton, defaultButton);
    } else {
        okCancelHBox.getChildren().addAll(okButton, cancelButton);
    }

    okButton.disableProperty().bind(editor.getEditDisabledProperty());
    errorLabel.visibleProperty().bind(editor.getEditDisabledProperty());
    errorLabel.textProperty().bind(editor.getErrorMessageProperty());
    final Node ec = editor.getEditorControls();
    VBox.setVgrow(ec, Priority.ALWAYS);
    root.getChildren().addAll(editor.getEditorHeading(), ec, errorLabel, okCancelHBox);

    final Scene scene = new Scene(root);
    scene.setFill(Color.rgb(0, 0, 0, 0));
    scene.getStylesheets().add(AttributeEditorDialog.class.getResource(DARK_THEME).toExternalForm());
    fxPanel.setScene(scene);
}
 
Example 20
Source File: Toast.java    From mapper-generator-javafx with Apache License 2.0 4 votes vote down vote up
public static void makeText(Stage stage, String message, final int displayTime, int fadeInDelay, final int fadeOutDelay, double size, double opacity) {
    final Stage toastStage = new Stage();
    toastStage.initOwner(stage);
    toastStage.setResizable(false);
    toastStage.initStyle(StageStyle.TRANSPARENT);
    Text text = new Text(message);
    text.setFont(Font.font("Verdana", size));
    text.setFill(Color.RED);
    StackPane root = new StackPane((Node) text);
    root.setStyle("-fx-background-radius: 20; -fx-background-color: rgba(0, 0, 0, 0.2); -fx-padding: 50px;");
    root.setOpacity(opacity);
    Scene scene = new Scene(root);
    scene.setFill(Color.TRANSPARENT);
    toastStage.setScene(scene);
    toastStage.show();
    Timeline fadeInTimeline = new Timeline();
    Duration var10002 = Duration.millis((double) fadeInDelay);
    KeyValue[] var10003 = new KeyValue[1];
    Scene var10008 = toastStage.getScene();
    var10003[0] = new KeyValue(var10008.getRoot().opacityProperty(), 1);
    KeyFrame fadeInKey1 = new KeyFrame(var10002, var10003);
    fadeInTimeline.getKeyFrames().add(fadeInKey1);
    fadeInTimeline.setOnFinished(event -> (new Thread((() -> {
        try {
            Thread.sleep((long) displayTime);
        } catch (InterruptedException var3) {
            var3.printStackTrace();
        }

        Timeline fadeOutTimeline = new Timeline();
        Duration var100021 = Duration.millis((double) fadeOutDelay);
        KeyValue[] var100031 = new KeyValue[1];
        Scene var100081 = toastStage.getScene();
        var100031[0] = new KeyValue(var100081.getRoot().opacityProperty(), 0);
        KeyFrame fadeOutKey1 = new KeyFrame(var100021, var100031);
        fadeOutTimeline.getKeyFrames().add(fadeOutKey1);
        fadeOutTimeline.setOnFinished(event1 -> {
            toastStage.close();
        });
        fadeOutTimeline.play();
    }))).start());
    fadeInTimeline.play();
}