public InnerShadowSample() { Text sample = new Text(0,100,"Shadow"); sample.setFont(Font.font("Arial Black",80)); sample.setFill(Color.web("#BBBBBB")); final InnerShadow innerShadow = new InnerShadow(); innerShadow.setRadius(5d); innerShadow.setOffsetX(2); innerShadow.setOffsetY(2); sample.setEffect(innerShadow); getChildren().add(sample); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Text Fill", sample.fillProperty()), new SimplePropertySheet.PropDesc("Inner Shadow Radius", innerShadow.radiusProperty(), 0d,60d), new SimplePropertySheet.PropDesc("Inner Shadow Offset X", innerShadow.offsetXProperty(), -10d, 10d), new SimplePropertySheet.PropDesc("Inner Shadow Offset Y", innerShadow.offsetYProperty(), -10d, 10d), new SimplePropertySheet.PropDesc("Inner Shadow Color", innerShadow.colorProperty()) ); // END REMOVE ME }
private void initGraphics() { backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); backgroundCtx = backgroundCanvas.getGraphicsContext2D(); foregroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); foregroundCtx = foregroundCanvas.getGraphicsContext2D(); ledInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 0.2 * PREFERRED_WIDTH, 0, 0, 0); ledDropShadow = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getBarColor(), 0.3 * PREFERRED_WIDTH, 0, 0, 0); pane = new Pane(backgroundCanvas, foregroundCanvas); pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
/** * Updates all the chord cues (suggested chords and chord indicator). */ public void updateChordOutlines() { //Reset border and pressed. chordButtons.forEach((c, btn) -> { if (c == getChord()) btn.setEffect(new InnerShadow(10, Color.RED)); else btn.setEffect(null); btn.setBorder(new Color(0, 0, 0, 0), 3); }); //Outline the suggested chords ChordProgressionHelper.getPossibleChordProgressions(getChord()).forEach((c, strength) -> chordButtons.get(c).setBorder(new Color(1, 0.843, 0, strength / 3 + 0.5), strength * 2 + 2)); }
private void initGraphics() { frame = new Region(); frame.setOpacity(getSkinnable().isFrameVisible() ? 1 : 0); led = new Region(); led.setStyle("-led-color: " + Util.colorToCss((Color) getSkinnable().getLedColor()) + ";"); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0d, 0d, 0d); glow = new DropShadow(BlurType.TWO_PASS_BOX, (Color) getSkinnable().getLedColor(), 20, 0d, 0d, 0d); glow.setInput(innerShadow); highlight = new Region(); // Set the appropriate style classes changeStyle(); // Add all nodes getChildren().setAll(frame, led, highlight); }
public FocusBorder() { InnerShadow innerFocus = new InnerShadow(); innerFocus.setColor(Color.rgb(104, 155, 201, 0.8)); innerFocus.setBlurType(BlurType.ONE_PASS_BOX); innerFocus.setRadius(5.0); innerFocus.setChoke(0.8); innerFocus.setOffsetX(0.0); setSpread(0.6); setColor(Color.rgb(120, 171, 217)); setBlurType(BlurType.ONE_PASS_BOX); setRadius(6.5); setOffsetX(0.0); setOffsetY(0.0); setInput(innerFocus); }
private void setSelectedFocusBorder() { InnerShadow innerFocus = new InnerShadow(); innerFocus.setColor(Color.rgb(104, 155, 201, 0.7)); innerFocus.setBlurType(BlurType.ONE_PASS_BOX); innerFocus.setRadius(6.5); innerFocus.setChoke(0.7); innerFocus.setOffsetX(0.0); innerFocus.setOffsetY(0.0); DropShadow outerFocus = new DropShadow(); outerFocus.setColor(Color.rgb(104, 155, 201)); outerFocus.setBlurType(BlurType.ONE_PASS_BOX); outerFocus.setRadius(7.0); outerFocus.setSpread(0.7); outerFocus.setOffsetX(0.0); outerFocus.setOffsetY(0.0); outerFocus.setInput(innerFocus); for (Node child : getChildren()) { if (child instanceof StackPane) { child.setEffect(outerFocus); } } }
private void setFocusBorder() { InnerShadow innerFocus = new InnerShadow(); innerFocus.setColor(Color.rgb(104, 155, 201)); innerFocus.setBlurType(BlurType.ONE_PASS_BOX); innerFocus.setRadius(6.5); innerFocus.setChoke(0.7); innerFocus.setOffsetX(0.0); innerFocus.setOffsetY(0.0); DropShadow outerFocus = new DropShadow(); outerFocus.setColor(Color.rgb(104, 155, 201)); outerFocus.setBlurType(BlurType.ONE_PASS_BOX); outerFocus.setRadius(5.0); outerFocus.setSpread(0.6); outerFocus.setOffsetX(0.0); outerFocus.setOffsetY(0.0); outerFocus.setInput(innerFocus); for (Node child : getChildren()) { if (child instanceof StackPane) { child.setEffect(outerFocus); } } }
private void initGraphics() { frame = new Region(); frame.getStyleClass().setAll("frame"); frame.setOpacity(getSkinnable().isFrameVisible() ? 1 : 0); led = new Region(); led.getStyleClass().setAll("main"); led.setStyle("-led-color: " + (getSkinnable().getLedColor()).toString().replace("0x", "#") + ";"); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0d, 0d, 0d); glow = new DropShadow(BlurType.TWO_PASS_BOX, (Color) getSkinnable().getLedColor(), 20, 0d, 0d, 0d); glow.setInput(innerShadow); highlight = new Region(); highlight.getStyleClass().setAll("highlight"); getChildren().addAll(frame, led, highlight); }
private void initGraphics() { frame = new Region(); frame.getStyleClass().setAll("frame"); frame.setOpacity(isFrameVisible() ? 1 : 0); led = new Region(); led.getStyleClass().setAll("main"); led.setStyle("-led-color: " + (getLedColor()).toString().replace("0x", "#") + ";"); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0d, 0d, 0d); glow = new DropShadow(BlurType.TWO_PASS_BOX, getLedColor(), 20, 0d, 0d, 0d); glow.setInput(innerShadow); highlight = new Region(); highlight.getStyleClass().setAll("highlight"); // Add all nodes getChildren().addAll(frame, led, highlight); }
public Clock(Color onColor, Color offColor) { // create effect for on LEDs Glow onEffect = new Glow(1.7f); onEffect.setInput(new InnerShadow()); // create effect for on dot LEDs Glow onDotEffect = new Glow(1.7f); onDotEffect.setInput(new InnerShadow(5,Color.BLACK)); // create effect for off LEDs InnerShadow offEffect = new InnerShadow(); // create digits digits = new Digit[7]; for (int i = 0; i < 6; i++) { Digit digit = new Digit(onColor, offColor, onEffect, offEffect); digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20); digits[i] = digit; getChildren().add(digit); } // create dots Group dots = new Group( new Circle(80 + 54 + 20, 44, 6, onColor), new Circle(80 + 54 + 17, 64, 6, onColor), new Circle((80 * 3) + 54 + 20, 44, 6, onColor), new Circle((80 * 3) + 54 + 17, 64, 6, onColor)); dots.setEffect(onDotEffect); getChildren().add(dots); // update digits to current time and start timer to update every second refreshClocks(); play(); }
public Clock(Color onColor, Color offColor) { // create effect for on LEDs Glow onEffect = new Glow(1.7f); onEffect.setInput(new InnerShadow()); // create effect for on dot LEDs Glow onDotEffect = new Glow(1.7f); onDotEffect.setInput(new InnerShadow(5,Color.BLACK)); // create effect for off LEDs InnerShadow offEffect = new InnerShadow(); // create digits digits = new Digit[7]; for (int i = 0; i < 6; i++) { Digit digit = new Digit(onColor, offColor, onEffect, offEffect); digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20); digits[i] = digit; getChildren().add(digit); } // create dots Group dots = new Group( new Circle(80 + 54 + 20, 44, 6, onColor), new Circle(80 + 54 + 17, 64, 6, onColor), new Circle((80 * 3) + 54 + 20, 44, 6, onColor), new Circle((80 * 3) + 54 + 17, 64, 6, onColor)); dots.setEffect(onDotEffect); getChildren().add(dots); // update digits to current time and start timer to update every second refreshClocks(); }
public static Node createIconContent() { Text sample = new Text("FX"); sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80)); sample.setStyle("-fx-font-size: 80px;"); sample.setFill(Color.web("#aaaaaa")); final InnerShadow innerShadow = new InnerShadow(); innerShadow.setRadius(4); innerShadow.setOffsetX(1); innerShadow.setOffsetY(1); innerShadow.setColor(Color.web("#333333")); sample.setEffect(innerShadow); return sample; }
public static void addNumericValidation(TextField textField, int maxValue) { textField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (isOk(newValue, maxValue)) { textField.setStyle(null); // reset textField.setEffect(null); // reset } else { textField.setStyle("-fx-focus-color: #f25f29; -fx-faint-focus-color: #f25f2933;"); // Red focus textField.setEffect(new InnerShadow(3, new Color(1, 0, 0, 1))); // Red highlight } } }); }
public CurveCable() { super(); setId(UUID.randomUUID().toString()); // Modify the control points as the coordinate of the curve change startXProperty().addListener((observable, oldValue, newValue) -> { computeHangPoint(); }); startYProperty().addListener((observable, oldValue, newValue) -> { computeHangPoint(); }); endXProperty().addListener((observable, oldValue, newValue) -> { computeHangPoint(); }); endYProperty().addListener((observable, oldValue, newValue) -> { computeHangPoint(); }); // Add a context menu to the plug setOnMouseClicked(new ContextMenuHandler(this)); setStrokeWidth(7.5); setStrokeLineCap(StrokeLineCap.ROUND); setFill(null); setColor(Color.RED); setEffect(new InnerShadow()); autosize(); addEventFilter(MouseEvent.MOUSE_DRAGGED, mouseEvent -> moveCable(mouseEvent)); }
public void setStyle(Node control) { InnerShadow innerShadow = new InnerShadow(); innerShadow.setBlurType(BlurType.GAUSSIAN); innerShadow.setColor(Color.GREEN); innerShadow.setRadius(6); innerShadow.setChoke(0.5); innerShadow.setOffsetX(1); innerShadow.setOffsetY(2); control.setEffect(innerShadow); }
List<NamedEffect> getNamedEffectList() { List<NamedEffect> nes = new ArrayList<NamedEffect>(); nes.add(new NamedEffect("colored", new InnerShadow() {{ setColor(Color.GREEN);}})); nes.add(new NamedEffect("height: 40", new InnerShadow() {{ setHeight(40);}})); nes.add(new NamedEffect("width: 40", new InnerShadow() {{ setWidth(40);}})); nes.add(new NamedEffect("radius: 40", new InnerShadow() {{ setRadius(40);}})); for (final BlurType bt : BlurType.values()) { nes.add(new NamedEffect("bt:" + bt.name(), new InnerShadow() {{ setBlurType(bt);}})); } nes.add(new NamedEffect("choke: 0.7", new InnerShadow() {{ setChoke(0.7f);}})); nes.add(new NamedEffect("offset: 10, 20", new InnerShadow() {{ setOffsetX(10);setOffsetY(20);}})); return nes; }
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); }
private void initGraphics() { // Set initial size if (Double.compare(getWidth(), 0) <= 0 || Double.compare(getHeight(), 0) <= 0 || Double.compare(getPrefWidth(), 0) <= 0 || Double.compare(getPrefHeight(), 0) <= 0) { setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } // Apply the base CSS style class to the control getStyleClass().add("led"); // Create the needed nodes and apply their CSS style classes frame = new Region(); frame.getStyleClass().setAll("frame"); main = new Region(); main.getStyleClass().setAll("main"); // We handle effects in code because we have to chain them and // we need to calculate the shadow spread dependent of the size innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0, 0, 0); glow = new DropShadow(BlurType.TWO_PASS_BOX, getColor(), 20, 0, 0, 0); glow.setInput(innerShadow); highlight = new Region(); highlight.getStyleClass().setAll("highlight"); // Add all nodes getChildren().addAll(frame, main, highlight); }
private void initGraphics() { if (Double.compare(control.getPrefWidth(), 0.0) <= 0 || Double.compare(control.getPrefHeight(), 0.0) <= 0 || Double.compare(control.getWidth(), 0.0) <= 0 || Double.compare(control.getHeight(), 0.0) <= 0) { if (control.getPrefWidth() > 0 && control.getPrefHeight() > 0) { control.setPrefSize(control.getPrefWidth(), control.getPrefHeight()); } else { control.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } frame = new Region(); frame.getStyleClass().setAll("frame"); main = new Region(); main.getStyleClass().setAll("main"); main.setStyle(String.join("", "-color: ", control.getColor().toString().replace("0x", "#"), ";")); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0, 0, 0); glow = new DropShadow(BlurType.TWO_PASS_BOX, control.getColor(), 20, 0, 0, 0); glow.setInput(innerShadow); highlight = new Region(); highlight.getStyleClass().setAll("highlight"); getChildren().addAll(frame, main, highlight); }
public void setup(Stage stage) { this.stage = stage; initNetwork(); stage.setOnCloseRequest(event -> savePreferences()); team_name.textProperty().addListener((observable, oldValue, newValue) -> { if (! newValue.matches("[a-zA-Z_$][a-zA-Z\\d_$]*")) { team_name.setEffect(new InnerShadow(1000, Color.DARKRED)); feedback_team_name.setText("Plz match this -> [a-zA-Z_$][a-zA-Z\\d_$]*"); feedback_team_name.setTextFill(Color.DARKRED); } else { team_name.setEffect(new InnerShadow(0, Color.WHITE)); feedback_team_name.setText(""); feedback_team_name.setTextFill(Color.GREEN); } }); address.textProperty().addListener((observable, oldValue, newValue) -> { if (newValue.matches("^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$")) { feedback_connection.setText("Wow very address"); feedback_connection.setTextFill(Color.GREEN); } else { feedback_connection.setText("Nah, plz fex."); feedback_connection.setTextFill(Color.DARKRED); } }); team_name.setText(preferences.get("team_name", "default_name")); address.setText(preferences.get("address", "127.0.0.1")); port.setText(preferences.get("port", "7777")); }
private void initGraphics() { green = new Region(); green.getStyleClass().setAll("green"); yellow = new Region(); yellow.getStyleClass().setAll("yellow"); red = new Region(); red.getStyleClass().setAll("red"); rack = new Region(); rack.getStyleClass().setAll("rack"); bodyDropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.web("0x000000a6"), 0.0133333333 * PREFERRED_WIDTH, 1.0, 0d, 2d); bodyInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.web("0x000000a6"), 0.0133333333 * PREFERRED_WIDTH, 1.0, 1.4142135623730951, 1.4142135623730951); bodyInnerShadow.setInput(bodyDropShadow); body = new Region(); body.getStyleClass().setAll("body"); body.setEffect(bodyInnerShadow); roof = new Region(); roof.getStyleClass().setAll("roof"); pane = new Pane(); pane.getChildren().setAll(green, yellow, red, rack, body, roof); getChildren().setAll(pane); resize(); }
private void initGraphics() { size = getSkinnable().getPrefWidth() < getSkinnable().getPrefHeight() ? getSkinnable().getPrefWidth() : getSkinnable().getPrefHeight(); frame = new Circle(0.5 * size, 0.5 * size, 0.5 * size); frame.setStroke(null); frame.setVisible(getSkinnable().isFrameVisible()); main = new Circle(0.5 * size, 0.5 * size, 0.36 * size); main.setStroke(null); innerShadow = new InnerShadow(); innerShadow.setRadius(0.090 * main.getLayoutBounds().getWidth()); innerShadow.setColor(Color.BLACK); innerShadow.setBlurType(BlurType.GAUSSIAN); innerShadow.setInput(null); glow = new DropShadow(); glow.setRadius(0.45 * main.getLayoutBounds().getWidth()); glow.setColor((Color) getSkinnable().getLedColor()); glow.setBlurType(BlurType.GAUSSIAN); glow.setInput(innerShadow); highlight = new Circle(0.5 * size, 0.5 * size, 0.29 * size); highlight.setStroke(null); getChildren().setAll(frame, main, highlight); }
private void recalc() { double size = getWidth() < getHeight() ? getWidth() : getHeight(); ledOffShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0); ledOnShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0); ledOnShadow.setInput(new DropShadow(BlurType.TWO_PASS_BOX, ledColor.get(), 0.36 * size, 0, 0, 0)); frameGradient = new LinearGradient(0.14 * size, 0.14 * size, 0.84 * size, 0.84 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(20, 20, 20, 0.65)), new Stop(0.15, Color.rgb(20, 20, 20, 0.65)), new Stop(0.26, Color.rgb(41, 41, 41, 0.65)), new Stop(0.26, Color.rgb(41, 41, 41, 0.64)), new Stop(0.85, Color.rgb(200, 200, 200, 0.41)), new Stop(1.0, Color.rgb(200, 200, 200, 0.35))); ledOnGradient = new LinearGradient(0.25 * size, 0.25 * size, 0.74 * size, 0.74 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, ledColor.get().deriveColor(0d, 1d, 0.77, 1d)), new Stop(0.49, ledColor.get().deriveColor(0d, 1d, 0.5, 1d)), new Stop(1.0, ledColor.get())); ledOffGradient = new LinearGradient(0.25 * size, 0.25 * size, 0.74 * size, 0.74 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, ledColor.get().deriveColor(0d, 1d, 0.20, 1d)), new Stop(0.49, ledColor.get().deriveColor(0d, 1d, 0.13, 1d)), new Stop(1.0, ledColor.get().deriveColor(0d, 1d, 0.2, 1d))); highlightGradient = new RadialGradient(0, 0, 0.3 * size, 0.3 * size, 0.29 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.WHITE), new Stop(1.0, Color.TRANSPARENT)); draw(); }
public CodeBlock() { super(); p = new Polygon(); p.setStroke(Color.GRAY); // override rightCon.detouch(); rightCon.setWidth(BASIC_WIDTH - wLeft); rightCon.setHeight(10); AnchorPane.setTopAnchor(rightCon, hUpper); AnchorPane.setLeftAnchor(rightCon, wLeft); connector = new Connector(); connector.detouch(); connector.setWidth(200); connector.setHeight(50); connector.setHolder(myBlock); connector.setPosition(Connector.Position.CENTER); AnchorPane.setLeftAnchor(connector, 40.0); AnchorPane.setTopAnchor(connector, 20.0); Rectangle dip = new Rectangle(); dip.setWidth(198); dip.setHeight(48); dip.setFill(Color.web("FAFAFA")); AnchorPane.setLeftAnchor(dip, 41.0); AnchorPane.setTopAnchor(dip, 21.0); InnerShadow innerShadow = new InnerShadow(); innerShadow.setOffsetX(2); innerShadow.setOffsetY(2); innerShadow.setColor(Color.web("0x3b596d")); dip.setEffect(innerShadow); getChildren().addAll(connector, dip); }
@Override public void init() { setPrefWidth(210); setPrefHeight(210); // visible background for widget Rectangle bg = new Rectangle(); bg.setArcWidth(20); bg.setArcHeight(20); bg.setHeight(210); bg.setWidth(210); bg.setStroke(Color.BLACK); bg.setFill(Color.rgb(255, 255, 255, .70)); getChildren().add(bg); // hello world InnerShadow innerShadow = new InnerShadow(); innerShadow.setOffsetX(4.0f); innerShadow.setOffsetY(4.0f); Text t = new Text(); t.setEffect(innerShadow); t.setX(25); t.setY(110); t.setText("Hello World"); t.setFill(Color.GREEN); t.setFont(Font.font(null, FontWeight.BOLD, 30)); getChildren().add(t); Button button = new Button(); button.setText("Close widget"); button.setLayoutX(50); button.setLayoutY(50); button.setOnAction((ActionEvent actionEvent) -> { System.out.println("close window "); getParentStage().close(); }); getChildren().add(button); }
public MovieCell(MovieView movieView) { this.movieView = movieView; GridPane gridPane = new GridPane(); ColumnConstraints col1 = new ColumnConstraints(); ColumnConstraints col2 = new ColumnConstraints(); ColumnConstraints col3 = new ColumnConstraints(); ColumnConstraints col4 = new ColumnConstraints(); ColumnConstraints col5 = new ColumnConstraints(); col4.setHgrow(Priority.ALWAYS); gridPane.getColumnConstraints().setAll(col1, col2, col3, col4, col5); gridPane.setHgap(10); // director image directorImage = new ImageView(); directorImage.setFitWidth(60); directorImage.setFitHeight(60); directorImage.setEffect(new InnerShadow()); gridPane.add(directorImage, 0, 0); GridPane.setRowSpan(directorImage, 2); GridPane.setValignment(directorImage, VPos.TOP); // title and year titleLabel = new Label(); titleLabel.getStyleClass().add("title-label"); gridPane.add(titleLabel, 1, 0); GridPane.setColumnSpan(titleLabel, 2); GridPane.setValignment(titleLabel, VPos.TOP); // director label directorLabel = new Label(); directorLabel.getStyleClass().add("director-label"); gridPane.add(directorLabel, 1, 1); GridPane.setValignment(directorLabel, VPos.TOP); // genre label genreLabel = new Label(); genreLabel.getStyleClass().add("genre-label"); gridPane.add(genreLabel, 4, 0); // trailer label trailerLabel = FontAwesomeIconFactory.get().createIconLabel(FontAwesomeIcon.FILM, "", "14px", "14px", ContentDisplay.GRAPHIC_ONLY); trailerLabel.getStyleClass().add("trailer-label"); gridPane.add(trailerLabel, 3, 0); GridPane.setHalignment(trailerLabel, HPos.LEFT); GridPane.setValignment(trailerLabel, VPos.TOP); trailerLabel.setOnMouseClicked(evt -> { try { Movie movie = getItem(); movieView.setSelectedTrailer(MovieApp.class.getResource("/trailers/" + movie.getTrailer()).toExternalForm()); } catch (NullPointerException e) { movieView.setSelectedTrailer(MovieApp.class.getResource("/TrailerMissing.mp4").toExternalForm()); } }); setGraphic(gridPane); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); movieView.useClippingProperty().addListener(it -> updateClipping()); updateClipping(); }
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } ring = new Path(); ring.setFillRule(FillRule.EVEN_ODD); ring.setStroke(null); ring.setFill(Gauge.DARK_COLOR); ring.setEffect(new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), 1, 0, 0, 1)); sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsCtx = sectionsCanvas.getGraphicsContext2D(); mask = new Circle(); mask.setStroke(null); mask.setFill(gauge.getBackgroundPaint()); knob = new Circle(); knob.setStroke(null); knob.setFill(gauge.getKnobColor()); angleStep = ANGLE_RANGE / (gauge.getRange()); double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep; needleRotate = new Rotate(180 - START_ANGLE); needleRotate.setAngle(Helper.clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle)); needle = new Path(); needle.setFillRule(FillRule.EVEN_ODD); needle.setStroke(null); needle.getTransforms().setAll(needleRotate); valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getMinValue()) + gauge.getUnit()); valueText.setMouseTransparent(true); valueText.setTextOrigin(VPos.CENTER); valueText.setFill(gauge.getValueColor()); Helper.enableNode(valueText, gauge.isValueVisible()); titleText = new Text(gauge.getTitle()); titleText.setTextOrigin(VPos.CENTER); titleText.setFill(gauge.getTitleColor()); Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); // Add all nodes pane = new Pane(ring, sectionsCanvas, mask, knob, needle, valueText, titleText); getChildren().setAll(pane); }
private void initGraphics() { dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028); highlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); highlight.setInput(innerShadow); dropShadow.setInput(highlight); barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); barArc.setType(ArcType.OPEN); barArc.setStrokeLineCap(StrokeLineCap.ROUND); barArc.setFill(null); barArc.setStroke(barColor.get()); double center = PREFERRED_WIDTH * 0.5; ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42), new Circle(center, center, PREFERRED_WIDTH * 0.3)); ring.setFill(color.get()); ring.setEffect(dropShadow); mainCircle = new Circle(); mainCircle.setFill(color.get().darker().darker()); text = new Text(String.format(Locale.US, formatString, getTargetValue())); text.setFill(Color.WHITE); text.setTextOrigin(VPos.CENTER); indicatorRotate = new Rotate(-ANGLE_RANGE * 0.5, center, center); indicatorGlow = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0); indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); indicatorHighlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); indicatorHighlight.setInput(indicatorInnerShadow); indicator = new Circle(); indicator.setFill(color.get().darker()); indicator.setStroke(color.get().darker().darker()); indicator.setMouseTransparent(true); indicator.getTransforms().add(indicatorRotate); Group indicatorGroup = new Group(indicator); indicatorGroup.setEffect(indicatorHighlight); symbol = new Region(); symbol.getStyleClass().setAll("symbol"); symbol.setCacheHint(CacheHint.SPEED); icon = new FontIcon(); icon.setTextOrigin(VPos.CENTER); iconPane = new StackPane(symbol, icon); pane = new Pane(barArc, ring, mainCircle, text, indicatorGroup, iconPane); pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT); pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY))); pane.setEffect(highlight); getChildren().setAll(pane); }
private void initGraphics() { dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028); highlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.2), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); highlight.setInput(innerShadow); dropShadow.setInput(highlight); Stop[] stops = { new Stop(0.0, Color.rgb(135, 255, 190)), new Stop(0.125, Color.rgb(254, 190, 106)), new Stop(0.389, Color.rgb(252, 84, 68)), new Stop(0.611, Color.rgb(99, 195, 255)), new Stop(1.0, Color.rgb(125, 255, 190)) }; barGradient = new ConicalGradient(stops); barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); barArc.setType(ArcType.OPEN); barArc.setStrokeLineCap(StrokeLineCap.ROUND); barArc.setFill(null); barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT))); overlayBarArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0); overlayBarArc.setType(ArcType.OPEN); overlayBarArc.setStrokeLineCap(StrokeLineCap.ROUND); overlayBarArc.setFill(null); overlayBarArc.setStroke(Color.rgb(0, 0, 0, 0.3)); overlayBarArc.setVisible((int) targetValue.get() != (int) currentValue.get()); double center = PREFERRED_WIDTH * 0.5; ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42), new Circle(center, center, PREFERRED_WIDTH * 0.3)); ring.setFill(color.get()); ring.setEffect(dropShadow); mainCircle = new Circle(); mainCircle.setFill(color.get().darker().darker()); text = new Text(String.format(Locale.US, formatString, currentValue.get())); text.setFill(textColor.get()); text.setTextOrigin(VPos.CENTER); targetText = new Text(String.format(Locale.US, formatString, targetValue.get())); targetText.setFill(textColor.get().darker()); targetText.setTextOrigin(VPos.CENTER); targetText.setVisible((int) targetValue.get() != (int) currentValue.get()); indicatorRotate = new Rotate(-ANGLE_RANGE * 0.5, center, center); indicatorGlow = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.02, 0.0, 0, 0); indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.5), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008); indicatorHighlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008); indicatorHighlight.setInput(indicatorInnerShadow); indicator = new Circle(); indicator.setFill(color.get().darker()); indicator.setStroke(color.get().darker().darker()); indicator.setMouseTransparent(true); indicator.getTransforms().add(indicatorRotate); Group indicatorGroup = new Group(indicator); indicatorGroup.setEffect(indicatorHighlight); symbol = new Region(); symbol.getStyleClass().setAll("symbol"); symbol.setCacheHint(CacheHint.SPEED); icon = new FontIcon(); icon.setTextOrigin(VPos.CENTER); iconPane = new StackPane(symbol, icon); pane = new Pane(barArc, overlayBarArc, ring, mainCircle, text, targetText, indicatorGroup, iconPane); pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT); pane.setBackground(new Background(new BackgroundFill(color.get().darker(), new CornerRadii(1024), Insets.EMPTY))); pane.setEffect(highlight); getChildren().setAll(pane); }
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); }
private void initGraphics() { innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_HEIGHT * 0.1, 0, 0, 0); Color color = gradientLookup.getColorAt(getSkinnable().getValue() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue())); background = new Circle(0.5 * PREFERRED_WIDTH, 0.5 * PREFERRED_HEIGHT, 0.5 * PREFERRED_WIDTH); background.setFill(new LinearGradient(0, 0, 0, PREFERRED_HEIGHT, false, CycleMethod.NO_CYCLE, new Stop(0, color.deriveColor(0, 1, 0.8, 1)), new Stop(1, color.deriveColor(0, 1, 0.6, 1)))); background.setEffect(innerShadow); ticksCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); ticksCanvas.setMouseTransparent(true); ticks = ticksCanvas.getGraphicsContext2D(); targetIndicator = new Region(); targetIndicator.getStyleClass().setAll("target-indicator"); targetIndicatorRotate = new Rotate(180 - getSkinnable().getStartAngle() - getSkinnable().getMinValue() * angleStep); targetIndicator.getTransforms().setAll(targetIndicatorRotate); targetExceeded = false; targetIndicator.setVisible(getSkinnable().isTargetEnabled()); valueIndicator = new Region(); valueIndicator.getStyleClass().setAll("value-indicator"); valueIndicatorRotate = new Rotate(180 - getSkinnable().getStartAngle()); valueIndicatorRotate.setAngle(valueIndicatorRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue() - getSkinnable().getMinValue()) * angleStep); valueIndicator.getTransforms().setAll(valueIndicatorRotate); infoText = new Text(getSkinnable().getInfoText().toUpperCase()); infoText.setTextOrigin(VPos.CENTER); infoText.setFont(Fonts.opensansSemiBold(0.06 * PREFERRED_HEIGHT)); infoText.setMouseTransparent(true); infoText.getStyleClass().setAll("info-text"); value = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getValue())); value.setMouseTransparent(true); value.setTextOrigin(VPos.CENTER); value.setFont(Fonts.opensansBold(0.32 * PREFERRED_HEIGHT)); value.setMouseTransparent(true); value.getStyleClass().setAll("value"); // Add all nodes pane = new Pane(); pane.getChildren().setAll(background, ticksCanvas, valueIndicator, targetIndicator, infoText, value); getChildren().setAll(pane); }
private void draw() { double size = getWidth() < getHeight() ? getWidth() : getHeight(); canvas.setWidth(size); canvas.setHeight(size); ctx.clearRect(0, 0, size, size); if (isFrameVisible()) { //frame Paint frame = new LinearGradient(0.14 * size, 0.14 * size, 0.84 * size, 0.84 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(20, 20, 20, 0.65)), new Stop(0.15, Color.rgb(20, 20, 20, 0.65)), new Stop(0.26, Color.rgb(41, 41, 41, 0.65)), new Stop(0.26, Color.rgb(41, 41, 41, 0.64)), new Stop(0.85, Color.rgb(200, 200, 200, 0.41)), new Stop(1.0, Color.rgb(200, 200, 200, 0.35))); ctx.setFill(frame); ctx.fillOval(0, 0, size, size); } InnerShadow innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0); if (isOn()) { //on ctx.save(); Paint on = new LinearGradient(0.25 * size, 0.25 * size, 0.74 * size, 0.74 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.77, 1d)), new Stop(0.49, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.5, 1d)), new Stop(1.0, ((Color)ledColor.get()))); innerShadow.setInput(new DropShadow(BlurType.TWO_PASS_BOX, (Color)ledColor.get(), 0.36 * size, 0, 0, 0)); ctx.setEffect(innerShadow); ctx.setFill(on); ctx.fillOval(0.14 * size, 0.14 * size, 0.72 * size, 0.72 * size); ctx.restore(); } else { // off ctx.save(); Paint off = new LinearGradient(0.25 * size, 0.25 * size, 0.74 * size, 0.74 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.20, 1d)), new Stop(0.49, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.13, 1d)), new Stop(1.0, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.2, 1d))); ctx.setEffect(innerShadow); ctx.setFill(off); ctx.fillOval(0.14 * size, 0.14 * size, 0.72 * size, 0.72 * size); ctx.restore(); } //highlight Paint highlight = new RadialGradient(0, 0, 0.3 * size, 0.3 * size, 0.29 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.WHITE), new Stop(1.0, Color.TRANSPARENT)); ctx.setFill(highlight); ctx.fillOval(0.21 * size, 0.21 * size, 0.58 * size, 0.58 * size); }