Java Code Examples for javafx.scene.effect.DropShadow#setOffsetX()
The following examples show how to use
javafx.scene.effect.DropShadow#setOffsetX() .
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: 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 2
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 3
Source File: Toast.java From ApkToolPlus with Apache License 2.0 | 6 votes |
public Toast(final String msg) { label = new Label(msg); String style = "-fx-background-color:black;" + "-fx-background-radius:10;" + "-fx-font: 16px \"Microsoft YaHei\";" + "-fx-text-fill:white;-fx-padding:10;"; label.setStyle(style); DropShadow dropShadow = new DropShadow(); dropShadow.setBlurType(BlurType.THREE_PASS_BOX); dropShadow.setWidth(40); dropShadow.setHeight(40); dropShadow.setRadius(19.5); dropShadow.setOffsetX(0); dropShadow.setOffsetY(00); dropShadow.setColor(Color.color(0, 0, 0)); label.setEffect(dropShadow); }
Example 4
Source File: DisplayPreview.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * Create a new display preview. * * @param canvas the display canvas to use in this preview. */ public DisplayPreview(DisplayCanvas canvas) { this.canvas = canvas; DropShadow dropShadow = new DropShadow(); dropShadow.setRadius(10); dropShadow.setOffsetX(6); dropShadow.setOffsetY(6); dropShadow.setColor(Color.GRAY); canvas.setEffect(dropShadow); if (!QueleaProperties.get().getUseDarkTheme()) { setStyle("-fx-background-color:#dddddd;"); } getChildren().add(canvas); updateSize(); ChangeListener<Number> cl = new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) { updateSize(); } }; widthProperty().addListener(cl); heightProperty().addListener(cl); QueleaApp.get().getProjectionWindow().widthProperty().addListener(cl); QueleaApp.get().getProjectionWindow().heightProperty().addListener(cl); }
Example 5
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 6
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 7
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 8
Source File: ChangeListenerSample.java From marathonv5 with Apache License 2.0 | 5 votes |
private static Group createBean(double rotate, double translateX, double translateY) { javafx.scene.shape.Ellipse bean1 = new javafx.scene.shape.Ellipse(16, 10); javafx.scene.shape.Ellipse bean1end = new javafx.scene.shape.Ellipse( 4,3, 3.2, 1.8); bean1end.setFill(Color.WHITESMOKE); bean1.setFill(Color.BROWN); javafx.scene.Group group = new javafx.scene.Group(bean1, bean1end); group.setRotate(rotate); group.setTranslateX(translateX+57); group.setTranslateY(translateY+57); DropShadow dropShadow = new DropShadow(); dropShadow.setOffsetX(2); dropShadow.setOffsetY(3); group.setEffect(dropShadow); return group; }
Example 9
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 10
Source File: ChangeListenerSample.java From marathonv5 with Apache License 2.0 | 5 votes |
private static Group createBean(double rotate, double translateX, double translateY) { javafx.scene.shape.Ellipse bean1 = new javafx.scene.shape.Ellipse(16, 10); javafx.scene.shape.Ellipse bean1end = new javafx.scene.shape.Ellipse( 4,3, 3.2, 1.8); bean1end.setFill(Color.WHITESMOKE); bean1.setFill(Color.BROWN); javafx.scene.Group group = new javafx.scene.Group(bean1, bean1end); group.setRotate(rotate); group.setTranslateX(translateX+57); group.setTranslateY(translateY+57); DropShadow dropShadow = new DropShadow(); dropShadow.setOffsetX(2); dropShadow.setOffsetY(3); group.setEffect(dropShadow); return group; }
Example 11
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 12
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 13
Source File: FxmlImageManufacture.java From MyBox with Apache License 2.0 | 5 votes |
public static Image addTextFx(Image image, String textString, Font font, Color color, int x, int y, float transparent, int shadow) { try { Group group = new Group(); Text text = new Text(x, y, textString); text.setFill(color); text.setFont(font); if (shadow > 0) { DropShadow dropShadow = new DropShadow(); dropShadow.setOffsetX(shadow); dropShadow.setOffsetY(shadow); text.setEffect(dropShadow); } group.getChildren().add(text); Blend blend = new Blend(BlendMode.SRC_OVER); blend.setBottomInput(new ImageInput(image)); blend.setOpacity(1.0 - transparent); group.setEffect(blend); 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 14
Source File: SerializableDropShadow.java From Quelea with GNU General Public License v3.0 | 5 votes |
public DropShadow getDropShadow() { DropShadow shadow = new DropShadow(); if (use) { shadow.setColor(getColor()); } else { shadow.setColor(Color.TRANSPARENT); } shadow.setOffsetX(getOffsetX()); shadow.setOffsetY(getOffsetY()); shadow.setSpread(getSpread()); shadow.setRadius(getRadius()); shadow.setBlurType(BlurType.GAUSSIAN); return shadow; }
Example 15
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 16
Source File: TodaysDateWiget.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public Group getToDayControl(){ String[] months = {"Jan", "Feb","Mar", "Apr", "May", "Jun", "Jul","Aug", "Sep", "Oct", "Nov","Dec"}; Calendar cal = Calendar.getInstance(); Group ctrl = new Group(); Rectangle rect = new Rectangle(); rect.setWidth(WIDTH); rect.setHeight(HEIGHT); rect.setArcHeight(10.0); rect.setArcWidth(10.0); Rectangle headerRect = new Rectangle(); headerRect.setWidth(WIDTH); headerRect.setHeight(30); headerRect.setArcHeight(10.0); headerRect.setArcWidth(10.0); Stop[] stops = new Stop[] { new Stop(0, Color.color(0.31, 0.31, 0.31, 0.443)), new Stop(1, Color.color(0, 0, 0, 0.737))}; LinearGradient lg = new LinearGradient( 0.482, -0.017, 0.518, 1.017, true, CycleMethod.REFLECT, stops); headerRect.setFill(lg); Rectangle footerRect = new Rectangle(); footerRect.setY(headerRect.getBoundsInLocal().getHeight() -4); footerRect.setWidth(WIDTH); footerRect.setHeight(125); footerRect.setFill(Color.color(0.51, 0.671, 0.992)); final Text currentMon = new Text(months[(cal.get(Calendar.MONTH) )]); currentMon.setFont(Font.font("null", FontWeight.BOLD, 24)); currentMon.setTranslateX((footerRect.getBoundsInLocal().getWidth() - currentMon.getBoundsInLocal().getWidth())/2.0); currentMon.setTranslateY(23); currentMon.setFill(Color.WHITE); final Text currentDate = new Text(Integer.toString(cal.get(Calendar.DATE))); currentDate.setFont(new Font(100.0)); currentDate.setTranslateX((footerRect.getBoundsInLocal().getWidth() - currentDate.getBoundsInLocal().getWidth())/2.0); currentDate.setTranslateY(120); currentDate.setFill(Color.WHITE); ctrl.getChildren().addAll(rect, headerRect, footerRect , currentMon,currentDate); DropShadow ds = new DropShadow(); ds.setOffsetY(3.0); ds.setOffsetX(3.0); ds.setColor(Color.GRAY); ctrl.setEffect(ds); return ctrl; }
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: CImageDisplay.java From Open-Lowcode with Eclipse Public License 2.0 | 4 votes |
@Override public Node getNode( PageActionManager actionmanager, CPageData inputdata, Window parentwindow, TabPane[] parenttabpanes, CollapsibleNode nodetocollapsewhenactiontriggered) { inputdata.addInlineActionDataRef(this.inlineactiondataref); this.actionmanager = actionmanager; SFile thumbnail = getThumbnail(inputdata, datareference); if (!thumbnail.isEmpty()) { ByteArrayInputStream imagedata = new ByteArrayInputStream(thumbnail.getContent()); Image image = new Image(imagedata); double imagewidth = image.getWidth(); double imageheight = image.getHeight(); thumbnailview = new ImageView(image); thumbnailview.setFitWidth(imagewidth); thumbnailview.setFitHeight(imageheight); thumbnailview.setOnMousePressed(actionmanager.getMouseHandler()); actionmanager.registerInlineAction(thumbnailview, fullimageaction); BorderPane border = new BorderPane(); border.setBorder(new Border( new BorderStroke(Color.web("#ddeeff"), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(3)), new BorderStroke(Color.web("#bbccdd"), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); border.setCenter(thumbnailview); border.setMaxHeight(imageheight + 6); border.setMaxWidth(imagewidth + 6); DropShadow ds = new DropShadow(); ds.setRadius(3.0); ds.setOffsetX(1.5); ds.setOffsetY(1.5); ds.setColor(Color.color(0.2, 0.2, 0.2)); border.setEffect(ds); if (this.islabel) { FlowPane thispane = new FlowPane(); Label thislabel = new Label(label); thislabel.setFont( Font.font(thislabel.getFont().getName(), FontPosture.ITALIC, thislabel.getFont().getSize())); thislabel.setMinWidth(120); thislabel.setWrapText(true); thislabel.setMaxWidth(120); thispane.setRowValignment(VPos.TOP); thispane.getChildren().add(thislabel); thispane.getChildren().add(border); return thispane; } else { return border; } } return null; }
Example 19
Source File: PushButtonSkin.java From Enzo with Apache License 2.0 | 4 votes |
private void initGraphics() { frame = new Region(); frame.getStyleClass().setAll("frame"); frameInnerShadow0 = new InnerShadow(); frameInnerShadow0.setOffsetX(0); frameInnerShadow0.setOffsetY(1); frameInnerShadow0.setRadius(0); frameInnerShadow0.setColor(Color.web("0x333333a6")); frameInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); frameInnerShadow1 = new InnerShadow(); frameInnerShadow1.setOffsetX(0); frameInnerShadow1.setOffsetY(-1); frameInnerShadow1.setRadius(0); frameInnerShadow1.setColor(Color.web("0xeeeeeea6")); frameInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); frameInnerShadow1.setInput(frameInnerShadow0); frame.setEffect(frameInnerShadow1); deselected = new Region(); deselected.getStyleClass().setAll("deselected"); deselectedInnerShadow0 = new InnerShadow(); deselectedInnerShadow0.setOffsetX(0); deselectedInnerShadow0.setOffsetY(-1); deselectedInnerShadow0.setRadius(0); deselectedInnerShadow0.setColor(Color.web("0x4b4e52a6")); deselectedInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); deselectedInnerShadow1 = new InnerShadow(); deselectedInnerShadow1.setOffsetX(0); deselectedInnerShadow1.setOffsetY(1); deselectedInnerShadow1.setRadius(0); deselectedInnerShadow1.setColor(Color.web("0xeeeeeea6")); deselectedInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); deselectedInnerShadow1.setInput(deselectedInnerShadow0); deselectedDropShadow = new DropShadow(); deselectedDropShadow.setOffsetX(0); deselectedDropShadow.setOffsetY(3); deselectedDropShadow.setRadius(3.0 / 128.0 * PREFERRED_WIDTH); deselectedDropShadow.setColor(Color.web("0x000000a6")); deselectedDropShadow.setBlurType(BlurType.TWO_PASS_BOX); deselectedDropShadow.setInput(deselectedInnerShadow1); deselected.setEffect(deselectedDropShadow); selected = new Region(); selected.getStyleClass().setAll("selected"); selectedInnerShadow0 = new InnerShadow(); selectedInnerShadow0.setOffsetX(0); selectedInnerShadow0.setOffsetY(-1); selectedInnerShadow0.setRadius(0); selectedInnerShadow0.setColor(Color.web("0x4b4e52a6")); selectedInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); selectedInnerShadow1 = new InnerShadow(); selectedInnerShadow1.setOffsetX(0); selectedInnerShadow1.setOffsetY(1); selectedInnerShadow1.setRadius(0); selectedInnerShadow1.setColor(Color.web("0xeeeeeea6")); selectedInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); selectedInnerShadow1.setInput(selectedInnerShadow0); selectedDropShadow = new DropShadow(); selectedDropShadow.setOffsetX(0); selectedDropShadow.setOffsetY(0); selectedDropShadow.setRadius(2.0 / 128.0 * PREFERRED_WIDTH); selectedDropShadow.setColor(Color.web("0x000000a6")); selectedDropShadow.setBlurType(BlurType.TWO_PASS_BOX); selectedDropShadow.setInput(selectedInnerShadow1); selected.setEffect(selectedDropShadow); icon = new Region(); icon.getStyleClass().setAll("icon"); pane.getChildren().setAll(frame, deselected, selected, icon); // Adjust visibility dependent on settings updateStatus(); getChildren().setAll(pane); resize(); }