private void createTargetButton() { target = (StackPane) lookup("#targetAnchor"); Image image = IconFactory.getTargetIcon(); ImageView targetIcon = new ImageView(image); targetIcon.setClip(new ImageView(image)); ColorAdjust monochrome = new ColorAdjust(); monochrome.setSaturation(-1.0); Blend red = new Blend(BlendMode.MULTIPLY, monochrome, new ColorInput(0, 0, targetIcon.getImage().getWidth(), targetIcon.getImage().getHeight(), Color.RED)); Blend green = new Blend(BlendMode.MULTIPLY, monochrome, new ColorInput(0, 0, targetIcon.getImage().getWidth(), targetIcon.getImage().getHeight(), new Color(0, 1, 0, 0.5))); targetButton = targetIcon; targetIcon.effectProperty().bind(Bindings.when(targetButton.hoverProperty()).then((Effect) green).otherwise((Effect) red)); targetButton.setId("target_button"); hideTargetMarker(); target.getChildren().add(targetButton); }
public void decorate(BorderPane border, Button Neues_Projekt, Button Laden, Button Beenden, Blend blend){ GridPane root = new GridPane(); GridPane title = new GridPane(); GridPane empty_space = new GridPane(); GridPane empty_space2 = new GridPane(); GridPane empty_space3 = new GridPane(); border.setTop(title); border.setLeft(empty_space); border.setRight(empty_space2); border.setCenter(root); border.setBottom(empty_space3); border.setStyle("-fx-background-color: #E0E0E0"); root.setAlignment(Pos.TOP_CENTER); root.setPadding(new Insets(25, 25, 25, 25)); root.add(Neues_Projekt, 0, 0); root.setVgap(10); root.add(Laden, 0, 1); root.add(Beenden, 0, 2); Text text = new Text("Willkommen!"); text.setFont(Font.font("Verdana", FontPosture.ITALIC, 35)); text.setStyle("-fx-font-weight: bold;"); text.setFill(Color.BLACK); text.setEffect(blend); text.setCache(true); title.setAlignment(Pos.BOTTOM_CENTER); title.setPadding(new Insets(25, 25, 25, 25)); title.add(text, 0, 6); }
public void shadowandinner(Blend blend){ DropShadow shadow = new DropShadow(); shadow.setOffsetY(7.0f); shadow.setColor(Color.DARKGRAY); InnerShadow innerShadow = new InnerShadow(); innerShadow.setOffsetX(1.0f); innerShadow.setOffsetY(1.0f); innerShadow.setColor(Color.LIGHTGRAY); blend.setMode(BlendMode.MULTIPLY); blend.setBottomInput(shadow); blend.setTopInput(innerShadow); }
public static void textdesign(Text text,Blend blend){ text.setFont(Font.font("Verdana", 30)); text.setStyle("-fx-font-weight: bold; -fx-base: #FFFFFF"); text.setFill(Color.DARKGRAY); text.setEffect(blend); text.setCache(true); }
private static void applyFontColor(ImageView image, Color color) { ColorAdjust monochrome = new ColorAdjust(); monochrome.setSaturation(-1.0); Effect colorInput = new ColorInput(0, 0, image.getImage().getWidth(), image.getImage().getHeight(), color); Blend blend = new Blend(BlendMode.MULTIPLY, new ImageInput(image.getImage()), colorInput); image.setClip(new ImageView(image.getImage())); image.setEffect(blend); image.setCache(true); }
/** * {@inheritDoc} */ @Override protected Collection<Decoration> createRequiredDecorations(Control target) { ImageView imageView = new ImageView(REQUIRED_IMAGE); // The following code will transform REQUIRED_IMAGE from red to blue. ColorAdjust adjust = new ColorAdjust(); adjust.setSaturation(-1); Blend bluemaker = new Blend(BlendMode.SRC_ATOP, adjust, new ColorInput(0, 0, imageView.getImage().getWidth(), imageView.getImage().getHeight(), Color.DEEPSKYBLUE)); imageView.setEffect(bluemaker); return Arrays.asList(new GraphicDecoration(imageView, Pos.TOP_LEFT, REQUIRED_IMAGE.getWidth() / 2, REQUIRED_IMAGE.getHeight() / 2)); }
/** * Given a monochrome image, apply a color to it * * @param imageView A view to the target monochrome image * @param color Target new image color */ public static void colorize(final ImageView imageView, final Paint color) { final ColorAdjust monochrome = new ColorAdjust(); monochrome.setSaturation(-1.0); monochrome.setBrightness(0.75); final Blend selectionColorBlend = new Blend(BlendMode.SRC_ATOP, monochrome, new ColorInput(0, 0, imageView.getFitWidth(), imageView.getFitHeight(), color)); imageView.setEffect(selectionColorBlend); }
/** * Retrieve an overlay image. * * @param overlayType * The overlay type. * @param side * The side of the eye. * @param color * The overlay color. * * @return The overlay image. */ private static Image getOverlayImage(final int overlayType, final RightLeft side, final Color color) { URL imageUrl = ClassLoader.getSystemResource("overlay/" + getOverlayFileName(overlayType, side)); Image image = new Image(imageUrl.toExternalForm()); Canvas canvas = new Canvas(OVERLAY_SIZE, OVERLAY_SIZE); Color colorNoAlpha = new Color(color.getRed(), color.getGreen(), color.getBlue(), 1); Blend effect = new Blend( BlendMode.SRC_ATOP, null, new ColorInput( 0, 0, OVERLAY_SIZE, OVERLAY_SIZE, colorNoAlpha)); // Type 2 is not changed in color. if (overlayType != 2) { canvas.getGraphicsContext2D().setEffect(effect); } canvas.getGraphicsContext2D().setGlobalAlpha(color.getOpacity()); canvas.getGraphicsContext2D().drawImage(image, 0, 0, OVERLAY_SIZE, OVERLAY_SIZE); SnapshotParameters parameters = new SnapshotParameters(); parameters.setFill(Color.TRANSPARENT); return canvas.snapshot(parameters, null); }
public GeographicalFirmPortrait(final GeographicalFirm agent, Color firmColor, GoodType goodSold, MacroII model) { super(agent,agent.xLocationProperty(),agent.yLocationProperty()); color.setValue(firmColor); this.firm = agent; //add a glow effect Glow glow = new Glow(3); Blend blend = new Blend(BlendMode.SRC_OVER, glow,icon.effectProperty().getValue()); icon.setEffect(blend); //schedule yourself to update your text StackPane.setAlignment(priceText, Pos.CENTER); priceText.setFont(Font.font("Verdana", FontWeight.BOLD,10)); model.scheduleSoon(ActionOrder.GUI_PHASE,new Steppable() { @Override public void step(SimState state) { if(!active) return; long price = agent.getSalesDepartment(goodSold).getLastAskedPrice(); Platform.runLater(() -> priceText.setText(String.valueOf(price))); //reschedule model.scheduleTomorrow(ActionOrder.GUI_PHASE,this); } }); //register as deactivable with the model model.registerDeactivable(this); }
@Override public void start(Stage primaryStage) throws Exception{ Button Neues_Projekt = new Button("Neue Übung Auswählen"); List<Exercise> exercises = readExercise(); Neues_Projekt.setOnAction(e -> { try { Loader.ask(exercises);} catch (Exception ex) {} stage.close(); }); Button Laden = new Button("Zuletzt verwendete Übung laden"); Laden.setOnAction(e -> { try { Loader.ask(exercises); } catch (Exception e1) { e1.printStackTrace(); } stage.close(); }); Button Beenden = new Button("Beenden"); Beenden.setOnAction(e -> { stage.close(); }); Blend blend = new Blend(); shadowandinner(blend); design(Neues_Projekt,blend); design(Laden,blend); design(Beenden,blend); BorderPane border = new BorderPane(); decorate(border,Neues_Projekt,Laden,Beenden,blend); stage.setScene(new Scene(border, 440, 350)); stage.initStyle(StageStyle.UTILITY); stage.setTitle("Test-Driven-Development-Trainer"); stage.show(); }
public void design(Button button, Blend blend){ button.setPrefSize(250, 40); button.setEffect(blend); button.setStyle("-fx-font: 13 georgia;-fx-font-weight: bold; -fx-base: #FFFFFF"); }
public void createBlend() { blend = new Blend(); blend.setMode(BlendMode.MULTIPLY); DropShadow ds = new DropShadow(); ds.setColor(Color.rgb(254, 235, 66, 0.3)); ds.setOffsetX(5); ds.setOffsetY(5); ds.setRadius(5); ds.setSpread(0.2); blend.setBottomInput(ds); DropShadow ds1 = new DropShadow(); ds1.setColor(Color.web("#d68268")); // #d68268 is pinkish orange//f13a00")); ds1.setRadius(20); ds1.setSpread(0.2); Blend blend2 = new Blend(); blend2.setMode(BlendMode.MULTIPLY); InnerShadow is = new InnerShadow(); is.setColor(Color.web("#feeb42")); // #feeb42 is mid-pale yellow is.setRadius(9); is.setChoke(0.8); blend2.setBottomInput(is); InnerShadow is1 = new InnerShadow(); is1.setColor(Color.web("#278206")); // # f13a00 is bright red // 278206 is dark green is1.setRadius(5); is1.setChoke(0.4); blend2.setTopInput(is1); Blend blend1 = new Blend(); blend1.setMode(BlendMode.MULTIPLY); blend1.setBottomInput(ds1); blend1.setTopInput(blend2); blend.setTopInput(blend1); }
protected HasLocationPortrait(EconomicAgent agent, DoubleProperty xLocationProperty, DoubleProperty yLocationProperty) { this.agent =agent; this.xLocationProperty = xLocationProperty; this.yLocationProperty = yLocationProperty; nodeDelegate = new GUINodeSimple(); //load the image icon = new ImageView(); icon.setImage(initImage(agent)); this.getChildren().add(icon); //bind icon height to pref-height. The idea here is that when they resize this region, we resize the location portrait as well icon.fitWidthProperty().bind(prefWidthProperty()); icon.fitHeightProperty().bind(prefHeightProperty()); //this is to keep it with the right color ColorAdjust monochrome = new ColorAdjust(); //this is the first effect //monochrome.setBrightness(-1.0); //keep the color color= new SimpleObjectProperty<>(Color.BLACK); ColorInput input = new ColorInput(); //this is the second effect, the coloring proper input.setX(0); input.setY(0); input.widthProperty().bind(prefWidthProperty()); input.heightProperty().bind(prefHeightProperty()); input.paintProperty().bind(color); //bind the color adjust Blend coloring = new Blend(BlendMode.SRC_ATOP,monochrome,input); icon.effectProperty().setValue(coloring); setCache(true); setCacheHint(CacheHint.SPEED); //now set the text priceText = new Text(); this.getChildren().add(priceText ); priceText.setFont(Font.font("Verdana", 10)); priceText.setFill(Color.BLACK); }