Java Code Examples for javafx.scene.effect.DropShadow#setColor()
The following examples show how to use
javafx.scene.effect.DropShadow#setColor() .
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: IconText.java From helloiot with GNU General Public License v3.0 | 6 votes |
@Override public Node buildIcon(StringFormat format, byte[] value) { Text t = new Text(format.format(format.value(value))); t.setFont(Font.font(ExternalFonts.SOURCESANSPRO_BLACK, FontWeight.BOLD, 32.0)); t.setFill(Color.WHITE); DropShadow dropShadow = new DropShadow(); dropShadow.setRadius(4.0); dropShadow.setColor(Color.BLACK /* valueOf("#4b5157")*/); dropShadow.setBlurType(BlurType.ONE_PASS_BOX); t.setEffect(dropShadow); return t; }
Example 2
Source File: MvcLogoExample.java From gef with Eclipse Public License 2.0 | 6 votes |
private static Effect createShadowEffect() { DropShadow outerShadow = new DropShadow(); outerShadow.setRadius(3); outerShadow.setSpread(0.2); outerShadow.setOffsetX(3); outerShadow.setOffsetY(3); outerShadow.setColor(new Color(0.3, 0.3, 0.3, 1)); Distant light = new Distant(); light.setAzimuth(-135.0f); Lighting l = new Lighting(); l.setLight(light); l.setSurfaceScale(3.0f); Blend effects = new Blend(BlendMode.MULTIPLY); effects.setTopInput(l); effects.setBottomInput(outerShadow); return effects; }
Example 3
Source File: GeometryNodeSnippet.java From gef with Eclipse Public License 2.0 | 6 votes |
protected static Effect createShadowEffect() { final DropShadow outerShadow = new DropShadow(); outerShadow.setRadius(3); outerShadow.setSpread(0.2); outerShadow.setOffsetX(3); outerShadow.setOffsetY(3); outerShadow.setColor(new Color(0.3, 0.3, 0.3, 1)); final Distant light = new Distant(); light.setAzimuth(-135.0f); final Lighting l = new Lighting(); l.setLight(light); l.setSurfaceScale(3.0f); final Blend effects = new Blend(BlendMode.MULTIPLY); effects.setTopInput(l); effects.setBottomInput(outerShadow); return effects; }
Example 4
Source File: FxmlImageManufacture.java From MyBox with Apache License 2.0 | 5 votes |
public static Image addShadowFx(Image image, int shadow, Color color) { try { if (image == null || shadow <= 0) { return null; } double imageWidth = image.getWidth(), imageHeight = image.getHeight(); Group group = new Group(); Scene s = new Scene(group); ImageView view = new ImageView(image); view.setPreserveRatio(true); view.setFitWidth(imageWidth); view.setFitHeight(imageHeight); DropShadow dropShadow = new DropShadow(); dropShadow.setOffsetX(shadow); dropShadow.setOffsetY(shadow); dropShadow.setColor(color); view.setEffect(dropShadow); group.getChildren().add(view); SnapshotParameters parameters = new SnapshotParameters(); parameters.setFill(Color.TRANSPARENT); WritableImage newImage = group.snapshot(parameters, null); return newImage; } catch (Exception e) { // logger.error(e.toString()); return null; } }
Example 5
Source File: DropShadowSample.java From marathonv5 with Apache License 2.0 | 5 votes |
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("#333333")); final DropShadow dropShadow = new DropShadow(); dropShadow.setOffsetX(4); dropShadow.setOffsetY(6); dropShadow.setColor(Color.rgb(0,0,0,0.7)); sample.setEffect(dropShadow); return sample; }
Example 6
Source File: KeyStrokeMotion.java From marathonv5 with Apache License 2.0 | 5 votes |
public LettersPane() { setId("LettersPane"); setPrefSize(480,480); setFocusTraversable(true); setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent me) { requestFocus(); me.consume(); } }); setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent ke) { createLetter(ke.getText()); ke.consume(); } }); // create press keys text pressText = new Text("Press Keys"); pressText.setTextOrigin(VPos.TOP); pressText.setFont(new Font(Font.getDefault().getFamily(), 40)); pressText.setLayoutY(5); pressText.setFill(Color.rgb(80, 80, 80)); DropShadow effect = new DropShadow(); effect.setRadius(0); effect.setOffsetY(1); effect.setColor(Color.WHITE); pressText.setEffect(effect); getChildren().add(pressText); }
Example 7
Source File: KeyStrokeMotion.java From netbeans with Apache License 2.0 | 5 votes |
public LettersPane() { setId("LettersPane"); setPrefSize(480,480); setFocusTraversable(true); setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent me) { requestFocus(); me.consume(); } }); setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent ke) { createLetter(ke.getText()); ke.consume(); } }); // create press keys text pressText = new Text("Press Keys"); pressText.setTextOrigin(VPos.TOP); pressText.setFont(new Font(Font.getDefault().getFamily(), 40)); pressText.setLayoutY(5); pressText.setFill(Color.rgb(80, 80, 80)); DropShadow effect = new DropShadow(); effect.setRadius(0); effect.setOffsetY(1); effect.setColor(Color.WHITE); pressText.setEffect(effect); getChildren().add(pressText); }
Example 8
Source File: LedSkin.java From JFX8CustomControls with Apache License 2.0 | 5 votes |
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); }
Example 9
Source File: BasicView.java From gluon-samples with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static void updateShapeAppearance( Shape shape, boolean selected ) { if ( shape == null ) return; shape.setFill(selected ? Color.LIGHTGREEN : Color.LIGHTBLUE); shape.setStroke(Color.DARKGRAY); shape.setStrokeWidth(2.5); DropShadow shadow = new DropShadow(); shadow.setOffsetY(3.0); shadow.setOffsetX(3.0); shadow.setColor(Color.GRAY); shape.setEffect(shadow); }
Example 10
Source File: FxUtils.java From stagedisplayviewer with MIT License | 5 votes |
public Text createLowerKey() { Text lowerKey = new Text(); lowerKey.setFont(Font.font(FONT_FAMILY.toString(), FontWeight.MEDIUM, MAX_FONT_SIZE.toInt())); lowerKey.setFill(Color.WHITE); lowerKey.setWrappingWidth(getWrappingWidth()); lowerKey.setTextAlignment(getAlignment()); DropShadow ds = new DropShadow(); ds.setOffsetY(0.0); ds.setOffsetX(0.0); ds.setColor(Color.BLACK); ds.setSpread(0.5); lowerKey.setEffect(ds); return lowerKey; }
Example 11
Source File: MainScene.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public void setGlow(Node node) { int depth = 70; //Setting the uniform variable for the glow width and height borderGlow = new DropShadow(); borderGlow.setOffsetY(0f); borderGlow.setOffsetX(0f); if (theme == 7) borderGlow.setColor(Color.ORANGE); else borderGlow.setColor(Color.BLUE); borderGlow.setWidth(depth); borderGlow.setHeight(depth); node.setEffect(borderGlow); }
Example 12
Source File: TimerControlTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); currentValueListener = o -> { if (tile.isRunning()) { return; } // Update time only if clock is not already running updateTime(ZonedDateTime.ofInstant(Instant.ofEpochSecond(tile.getCurrentTime()), ZoneId.of(ZoneId.systemDefault().getId()))); }; timeListener = o -> updateTime(tile.getTime()); dateFormatter = DateTimeFormatter.ofPattern("EE d", tile.getLocale()); sectionMap = new HashMap<>(tile.getTimeSections().size()); for (TimeSection section : tile.getTimeSections()) { sectionMap.put(section, new Arc()); } minuteRotate = new Rotate(); hourRotate = new Rotate(); secondRotate = new Rotate(); sectionsPane = new Pane(); sectionsPane.getChildren().addAll(sectionMap.values()); Helper.enableNode(sectionsPane, tile.getSectionsVisible()); minuteTickMarks = new Path(); minuteTickMarks.setFillRule(FillRule.EVEN_ODD); minuteTickMarks.setFill(null); minuteTickMarks.setStroke(tile.getMinuteColor()); minuteTickMarks.setStrokeLineCap(StrokeLineCap.ROUND); hourTickMarks = new Path(); hourTickMarks.setFillRule(FillRule.EVEN_ODD); hourTickMarks.setFill(null); hourTickMarks.setStroke(tile.getHourColor()); hourTickMarks.setStrokeLineCap(StrokeLineCap.ROUND); hour = new Rectangle(3, 60); hour.setArcHeight(3); hour.setArcWidth(3); hour.setStroke(tile.getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Rectangle(3, 96); minute.setArcHeight(3); minute.setArcWidth(3); minute.setStroke(tile.getMinuteColor()); minute.getTransforms().setAll(minuteRotate); second = new Rectangle(1, 96); second.setArcHeight(1); second.setArcWidth(1); second.setStroke(tile.getSecondColor()); second.getTransforms().setAll(secondRotate); second.setVisible(tile.isSecondsVisible()); second.setManaged(tile.isSecondsVisible()); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5); knob.setStroke(Color.web("#282a3280")); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second, knob); shadowGroupHour.setEffect(tile.isShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(tile.isShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(tile.isShadowsEnabled() ? dropShadow : null); titleText = new Text(""); titleText.setTextOrigin(VPos.TOP); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); amPmText = new Text(tile.getTime().get(ChronoField.AMPM_OF_DAY) == 0 ? "AM" : "PM"); dateText = new Text(""); Helper.enableNode(dateText, tile.isDateVisible()); text = new Text(""); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(sectionsPane, hourTickMarks, minuteTickMarks, titleText, amPmText, dateText, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); }
Example 13
Source File: IndustrialClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); centerDot = new Circle(); centerDot.setFill(Color.WHITE); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateText = new Text(""); dateText.setVisible(clock.isDateVisible()); dateText.setManaged(clock.isDateVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, dateNumber, text, shadowGroupMinute, shadowGroupHour, shadowGroupSecond, centerDot); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example 14
Source File: PearClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateText = new Text(""); dateText.setVisible(clock.isDateVisible()); dateText.setManaged(clock.isDateVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, dateNumber, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example 15
Source File: FatClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.setFill(clock.getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.setFill(clock.getMinuteColor()); minute.getTransforms().setAll(minuteRotate); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroup = new Group(hour, minute); shadowGroup.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateText = new Text(""); dateText.setVisible(clock.isDateVisible()); dateText.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, text, shadowGroup); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example 16
Source File: DBClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Rectangle(3, 60); hour.setArcHeight(3); hour.setArcWidth(3); hour.setStroke(null); hour.setFill(clock.getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Rectangle(3, 96); minute.setArcHeight(3); minute.setArcWidth(3); minute.setStroke(null); minute.setFill(clock.getMinuteColor()); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.setFill(clock.getSecondColor()); second.getTransforms().setAll(secondRotate); enableNode(second, clock.isSecondsVisible()); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5); knob.setStroke(null); knob.setFill(clock.getKnobColor()); knob.setEffect(dropShadow); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond, knob); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example 17
Source File: MainScene.java From mars-sim with GNU General Public License v3.0 | 4 votes |
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); }
Example 18
Source File: MosaicPane.java From Mosaic with Apache License 2.0 | 4 votes |
public SurfaceListener<T> getSurfaceObserver() { SurfaceListener<T> l = new SurfaceListener<T>() { public void changed(ChangeType changeType, Node n, String id, Rectangle2D r1, Rectangle2D r2) { switch(changeType) { case REMOVE_DISCARD: { content.getChildren().remove(n); requestLayout(); break; } case RESIZE_RELOCATE: { n.resizeRelocate(r2.getX(), r2.getY(), r2.getWidth(), r2.getHeight()); requestLayout(); break; } case ADD_COMMIT: { content.getChildren().add(n); n.resizeRelocate(r2.getX(), r2.getY(), r2.getWidth(), r2.getHeight()); requestLayout(); break; } case MOVE_BEGIN: { DropShadow shadow = new DropShadow(); shadow.setOffsetX(10); shadow.setOffsetY(10); shadow.setRadius(5); shadow.setColor(Color.GRAY); n.setEffect(shadow); n.toFront(); n.setOpacity(.5); break; } case RELOCATE_DRAG_TARGET: { n.resizeRelocate(r2.getX(), r2.getY(), r2.getWidth(), r2.getHeight()); requestLayout(); break; } case RESIZE_DRAG_TARGET: { n.resizeRelocate(r2.getX(), r2.getY(), r2.getWidth(), r2.getHeight()); requestLayout(); break; } case MOVE_END: { n.setOpacity(1); n.setEffect(null); break; } case ANIMATE_RESIZE_RELOCATE: { n.resizeRelocate(r2.getX(), r2.getY(), r2.getWidth(), r2.getHeight()); requestLayout(); break; } default: break; } } }; return l; }
Example 19
Source File: PlainClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.0148448); knob.setStroke(null); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second, knob); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateNumber, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example 20
Source File: TimerControlTileSkin.java From OEE-Designer with MIT License | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); currentValueListener = o -> { if (tile.isRunning()) { return; } // Update time only if clock is not already running updateTime(ZonedDateTime.ofInstant(Instant.ofEpochSecond(tile.getCurrentTime()), ZoneId.of(ZoneId.systemDefault().getId()))); }; timeListener = o -> updateTime(tile.getTime()); dateFormatter = DateTimeFormatter.ofPattern("EE d", tile.getLocale()); sectionMap = new HashMap<>(tile.getTimeSections().size()); for (TimeSection section : tile.getTimeSections()) { sectionMap.put(section, new Arc()); } minuteRotate = new Rotate(); hourRotate = new Rotate(); secondRotate = new Rotate(); sectionsPane = new Pane(); sectionsPane.getChildren().addAll(sectionMap.values()); Helper.enableNode(sectionsPane, tile.getSectionsVisible()); minuteTickMarks = new Path(); minuteTickMarks.setFillRule(FillRule.EVEN_ODD); minuteTickMarks.setFill(null); minuteTickMarks.setStroke(tile.getMinuteColor()); minuteTickMarks.setStrokeLineCap(StrokeLineCap.ROUND); hourTickMarks = new Path(); hourTickMarks.setFillRule(FillRule.EVEN_ODD); hourTickMarks.setFill(null); hourTickMarks.setStroke(tile.getHourColor()); hourTickMarks.setStrokeLineCap(StrokeLineCap.ROUND); hour = new Rectangle(3, 60); hour.setArcHeight(3); hour.setArcWidth(3); hour.setStroke(tile.getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Rectangle(3, 96); minute.setArcHeight(3); minute.setArcWidth(3); minute.setStroke(tile.getMinuteColor()); minute.getTransforms().setAll(minuteRotate); second = new Rectangle(1, 96); second.setArcHeight(1); second.setArcWidth(1); second.setStroke(tile.getSecondColor()); second.getTransforms().setAll(secondRotate); second.setVisible(tile.isSecondsVisible()); second.setManaged(tile.isSecondsVisible()); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5); knob.setStroke(Color.web("#282a3280")); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second, knob); shadowGroupHour.setEffect(tile.isShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(tile.isShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(tile.isShadowsEnabled() ? dropShadow : null); titleText = new Text(""); titleText.setTextOrigin(VPos.TOP); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); amPmText = new Text(tile.getTime().get(ChronoField.AMPM_OF_DAY) == 0 ? "AM" : "PM"); dateText = new Text(""); Helper.enableNode(dateText, tile.isDateVisible()); text = new Text(""); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(sectionsPane, hourTickMarks, minuteTickMarks, titleText, amPmText, dateText, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); }