/** * @param sepiaToneLevel */ @SuppressWarnings("unused") public void setSepiaTone(double sepiaToneLevel) { // For some reason in some computers setting the SepiaTone effect hide the pane. if(true) { return; } Effect effect = getEffect(); if(effect == null) { setEffect(new SepiaTone(sepiaToneLevel)); } else if(effect instanceof SepiaTone) { ((SepiaTone) effect).setLevel(sepiaToneLevel); } }
public SepiaToneSample() { ImageView sample = new ImageView(BOAT); final SepiaTone sepiaTone = new SepiaTone(); sepiaTone.setLevel(0.5d); sample.setEffect(sepiaTone); getChildren().add(sample); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("SepiaTone Level", sepiaTone.levelProperty(), 0d, 1d) ); // END REMOVE ME }
public static Node createIconContent() { ImageView iv = new ImageView(BOAT); iv.setFitWidth(80); iv.setFitHeight(80); iv.setViewport(new Rectangle2D(90,0,332,332)); final SepiaTone SepiaTone = new SepiaTone(); SepiaTone.setLevel(1); iv.setEffect(SepiaTone); return iv; }
/** render the application on a stage */ public StackPane createGUI() { SwingUtilities.invokeLater(() -> { //Simulation.instance().getJConsole().write(ADDRESS,Color.ORANGE,Color.BLACK); }); // place the address content in a bordered title pane. Pane titledContent = new BorderedTitledPane(TITLE, getContent()); titledContent.getStyleClass().add("titled-address"); titledContent.setPrefSize(800, 745); // make some crumpled paper as a background. final Image paper = new Image(PAPER); final ImageView paperView = new ImageView(paper); ColorAdjust colorAdjust = new ColorAdjust(0, -.2, .2, 0); paperView.setEffect(colorAdjust); // place the address content over the top of the paper. StackPane stackedContent = new StackPane(); stackedContent.getChildren().addAll(paperView, titledContent); // manage the viewport of the paper background, to size it to the content. paperView.setViewport(new Rectangle2D(0, 0, titledContent.getPrefWidth(), titledContent.getPrefHeight())); stackedContent.layoutBoundsProperty().addListener(new ChangeListener<Bounds>() { @Override public void changed(ObservableValue<? extends Bounds> observableValue, Bounds oldValue, Bounds newValue) { paperView.setViewport(new Rectangle2D( newValue.getMinX(), newValue.getMinY(), Math.min(newValue.getWidth(), paper.getWidth()), Math.min(newValue.getHeight(), paper.getHeight()) )); } }); // blend the content into the paper and make it look old. titledContent.setMaxWidth(paper.getWidth()); titledContent.setEffect(new SepiaTone()); titledContent.setBlendMode(BlendMode.MULTIPLY); // configure and display the scene and stage. //Scene scene = new Scene(stackedContent); //scene.getStylesheets().add(getClass().getResource("/css/gettysburg.css").toExternalForm()); /* stage.setTitle(TITLE); stage.getIcons().add(new Image(ICON)); stage.setScene(scene); stage.setMinWidth(600); stage.setMinHeight(500); stage.show(); */ // make the scrollbar in the address scroll pane hide when it is not needed. makeScrollFadeable(titledContent.lookup(".address > .scroll-pane")); return stackedContent; }
private Parent createContent() { Pane root = new Pane(); ImageView imageView = new ImageView(new Image(getClass() .getResource("res/Fallout4_bg.jpg").toExternalForm())); imageView.setFitWidth(1280); imageView.setFitHeight(720); SepiaTone tone = new SepiaTone(0.85); imageView.setEffect(tone); Rectangle masker = new Rectangle(1280, 720); masker.setOpacity(0); masker.setMouseTransparent(true); MenuBox menuBox = new MenuBox(250, 350); menuBox.setTranslateX(250); menuBox.setTranslateY(230); MenuBox menuBox2 = new MenuBox(510, 350); menuBox2.setTranslateX(250 + 20 + 250); menuBox2.setTranslateY(230); menuBox.addItem(new MenuItem("CONTINUE", 250)); MenuItem itemNew = new MenuItem("NEW", 250); itemNew.setOnAction(() -> { FadeTransition ft = new FadeTransition(Duration.seconds(1.5), masker); ft.setToValue(1); ft.setOnFinished(e -> { root.getChildren().setAll(new LoadingScreen(1280, 720, () -> { masker.setOpacity(0); root.getChildren().setAll(imageView, menuBox, menuBox2, masker); })); }); ft.play(); }); menuBox.addItem(itemNew); menuBox.addItem(new MenuItem("LOAD", 250)); MenuItem itemSettings = new MenuItem("SETTINGS", 250); itemSettings.setOnAction(() -> { menuBox2.addItems( new MenuItem("GAMEPLAY", 510), new MenuItem("CONTROLS", 510), new MenuItem("DISPLAY", 510), new MenuItem("AUDIO", 510)); }); menuBox.addItem(itemSettings); menuBox.addItem(new MenuItem("CREW", 250)); MenuItem itemExit = new MenuItem("EXIT", 250); itemExit.setOnAction(() -> System.exit(0)); menuBox.addItem(itemExit); root.getChildren().addAll(imageView, menuBox, menuBox2, masker); return root; }