Java Code Examples for javafx.scene.shape.Rectangle#setArcWidth()
The following examples show how to use
javafx.scene.shape.Rectangle#setArcWidth() .
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: KeyboardExample.java From JavaFX with MIT License | 6 votes |
public Node createNode() { final StackPane keyNode = new StackPane(); keyNode.setFocusTraversable(true); installEventHandler(keyNode); final Rectangle keyBackground = new Rectangle(50, 50); keyBackground.fillProperty().bind( Bindings.when(pressedProperty) .then(Color.RED) .otherwise( Bindings.when(keyNode.focusedProperty()) .then(Color.LIGHTGRAY) .otherwise(Color.WHITE))); keyBackground.setStroke(Color.BLACK); keyBackground.setStrokeWidth(2); keyBackground.setArcWidth(12); keyBackground.setArcHeight(12); final Text keyLabel = new Text(keyCode.getName()); keyLabel.setFont(Font.font("Arial", FontWeight.BOLD, 20)); keyNode.getChildren().addAll(keyBackground, keyLabel); return keyNode; }
Example 2
Source File: ShearSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public static Node createIconContent() { final Rectangle r1 = new Rectangle (22, 0, 64, 64); r1.setArcHeight(4); r1.setArcWidth(4); r1.setFill(Color.web("#ed4b00",0.5)); r1.getTransforms().add(new Shear(-0.35, 0)); Polygon polygon = createArrow(); polygon.setLayoutX(-5); polygon.setLayoutY(-2); polygon.setRotate(90); Rectangle r2 = new Rectangle (0, 0, 64, 64); r2.setArcHeight(4); r2.setArcWidth(4); r2.setFill(Color.web("#ed4b00", 0.25)); javafx.scene.Group g = new javafx.scene.Group(r2,r1, polygon); return new javafx.scene.Group(g); }
Example 3
Source File: Cross.java From jsilhouette with Apache License 2.0 | 6 votes |
@Override protected void calculateShape() { double cx = getCenterX(); double cy = getCenterY(); double r = getRadius(); double n = validateRoundness(getRoundness()); double w = validateWidth(getWidth(), r); double arcWH = w * n; Rectangle beam1 = new Rectangle(cx - r, cy - (w / 2), r * 2, w); Rectangle beam2 = new Rectangle(cx - (w / 2), cy - r, w, r * 2); beam1.setArcWidth(arcWH); beam1.setArcHeight(arcWH); beam2.setArcWidth(arcWH); beam2.setArcHeight(arcWH); Shape shape = Shape.union(beam1, beam2); shape.getStyleClass().addAll("silhouette", "silhoutte-cross"); setShape(shape); }
Example 4
Source File: ActivityDashboard.java From medusademo with Apache License 2.0 | 6 votes |
private VBox getVBox(final String TEXT, final Color COLOR, final Gauge GAUGE) { Rectangle bar = new Rectangle(200, 3); bar.setArcWidth(6); bar.setArcHeight(6); bar.setFill(COLOR); Label label = new Label(TEXT); label.setTextFill(COLOR); label.setAlignment(Pos.CENTER); label.setPadding(new Insets(0, 0, 10, 0)); GAUGE.setBarColor(COLOR); VBox vBox = new VBox(bar, label, GAUGE); vBox.setSpacing(3); vBox.setAlignment(Pos.CENTER); return vBox; }
Example 5
Source File: RotateTransitionSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public RotateTransitionSample() { super(140,140); Rectangle rect = new Rectangle(20, 20, 100, 100); rect.setArcHeight(20); rect.setArcWidth(20); rect.setFill(Color.ORANGE); getChildren().add(rect); rotateTransition = RotateTransitionBuilder.create() .node(rect) .duration(Duration.seconds(4)) .fromAngle(0) .toAngle(720) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
Example 6
Source File: Cutaway.java From FXyzLib with GNU General Public License v3.0 | 6 votes |
private void redraw() { params.setViewport(new Rectangle2D(0, 0, imageView.getFitWidth(), imageView.getFitHeight())); if (image == null || image.getWidth() != imageView.getFitWidth() || image.getHeight() != imageView.getFitHeight()) { image = worldToView.snapshot(params, null); } else { worldToView.snapshot(params, image); } // set a clip to apply rounded border to the original image. Rectangle clip = new Rectangle( imageView.getFitWidth(), imageView.getFitHeight() ); clip.setArcWidth(20); clip.setArcHeight(20); imageView.setClip(clip); imageView.setImage(image); }
Example 7
Source File: RotateTransitionSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public RotateTransitionSample() { super(140,140); Rectangle rect = new Rectangle(20, 20, 100, 100); rect.setArcHeight(20); rect.setArcWidth(20); rect.setFill(Color.ORANGE); getChildren().add(rect); rotateTransition = RotateTransitionBuilder.create() .node(rect) .duration(Duration.seconds(4)) .fromAngle(0) .toAngle(720) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
Example 8
Source File: FillTransitionSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public FillTransitionSample() { super(100,100); Rectangle rect = new Rectangle(0, 0, 100, 100); rect.setArcHeight(20); rect.setArcWidth(20); rect.setFill(Color.DODGERBLUE); getChildren().add(rect); fillTransition = FillTransitionBuilder.create() .duration(Duration.seconds(3)) .shape(rect) .fromValue(Color.RED) .toValue(Color.DODGERBLUE) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
Example 9
Source File: LinearGradientSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public static Node createIconContent() { Rectangle rect = new Rectangle(80,80,new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] { new Stop(0, Color.rgb(156,216,255)), new Stop(0.5, Color.DODGERBLUE), new Stop(1, Color.rgb(0,70,140)) })); rect.setArcWidth(20); rect.setArcHeight(20); return rect; }
Example 10
Source File: OverviewPanel.java From constellation with Apache License 2.0 | 5 votes |
/** * Helper method that creates and styles a POV object. * * The POV object is a styled rectangle that is used to indicate the * currently observed time range (aka time extent) on the timeline. It can * also be used to quickly interact with the time extent. * * @return A formatted POV object. */ private Rectangle createPOV() { final Rectangle rect = new Rectangle(135, 25, 60, 1); // Bind the height of the POV to the Height of the histogram: rect.yProperty().bind(histogram.heightProperty()); rect.heightProperty().bind(innerPane.prefHeightProperty()); rect.setManaged(true); // Style the rectangle: rect.setStroke(Color.DODGERBLUE); rect.setStrokeWidth(2d); final LinearGradient gradient = new LinearGradient(0.0, 0.0, 0.0, 0.5, true, CycleMethod.NO_CYCLE, new Stop[]{ new Stop(0, Color.LIGHTBLUE.darker()), new Stop(1, Color.TRANSPARENT) }); rect.setFill(gradient); rect.setSmooth(true); // Round the edges of the rectangle: rect.setArcWidth(5.0); rect.setArcHeight(5.0); // Set the POV mouse event handlers: final POVMouseEventHandler handler = new POVMouseEventHandler(rect); rect.setOnMouseMoved(handler); rect.setOnMousePressed(handler); rect.setOnMouseDragged(handler); rect.setOnMouseReleased(handler); // Make the POV object the top-most object on this panel: rect.toFront(); return rect; }
Example 11
Source File: TransitionPath.java From netbeans with Apache License 2.0 | 5 votes |
private void init(Stage primaryStage) { Group root = new Group(); primaryStage.setResizable(false); primaryStage.setScene(new Scene(root, 400,260)); Rectangle rect = new Rectangle (0, 0, 40, 40); rect.setArcHeight(10); rect.setArcWidth(10); rect.setFill(Color.ORANGE); root.getChildren().add(rect); Path path = PathBuilder.create() .elements( new MoveTo(20,20), new CubicCurveTo(380, 0, 380, 120, 200, 120), new CubicCurveTo(0, 120, 0, 240, 380, 240) ) .build(); path.setStroke(Color.DODGERBLUE); path.getStrokeDashArray().setAll(5d,5d); root.getChildren().add(path); pathTransition = PathTransitionBuilder.create() .duration(Duration.seconds(4)) .path(path) .node(rect) .orientation(OrientationType.ORTHOGONAL_TO_TANGENT) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
Example 12
Source File: PauseTransitionSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public PauseTransitionSample() { super(400,150); // create rectangle Rectangle rect = new Rectangle(-25,-25,50, 50); rect.setArcHeight(15); rect.setArcWidth(15); rect.setFill(Color.CRIMSON); rect.setTranslateX(50); rect.setTranslateY(75); getChildren().add(rect); animation = SequentialTransitionBuilder.create() .node(rect) .children( TranslateTransitionBuilder.create() .duration(Duration.seconds(2)) .fromX(50) .toX(200) .build(), PauseTransitionBuilder.create() .duration(Duration.seconds(2)) .build(), TranslateTransitionBuilder.create() .duration(Duration.seconds(2)) .fromX(200) .toX(350) .build() ) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
Example 13
Source File: SequentialTransitionSample.java From marathonv5 with Apache License 2.0 | 4 votes |
public SequentialTransitionSample() { super(400,100); // create rectangle Rectangle rect = new Rectangle(-25,-25,50, 50); rect.setArcHeight(15); rect.setArcWidth(15); rect.setFill(Color.CRIMSON); rect.setTranslateX(50); rect.setTranslateY(50); getChildren().add(rect); // create 4 transitions FadeTransition fadeTransition = FadeTransitionBuilder.create() .duration(Duration.seconds(1)) .fromValue(1) .toValue(0.3) .cycleCount(2) .autoReverse(true) .build(); TranslateTransition translateTransition = TranslateTransitionBuilder.create() .duration(Duration.seconds(2)) .fromX(50) .toX(375) .cycleCount(2) .autoReverse(true) .build(); RotateTransition rotateTransition = RotateTransitionBuilder.create() .duration(Duration.seconds(2)) .byAngle(180) .cycleCount(4) .autoReverse(true) .build(); ScaleTransition scaleTransition = ScaleTransitionBuilder.create() .duration(Duration.seconds(2)) .toX(2) .toY(2) .cycleCount(2) .autoReverse(true) .build(); // create sequential transition to do 4 transitions one after another sequentialTransition = SequentialTransitionBuilder.create() .node(rect) .children(fadeTransition, translateTransition, rotateTransition, scaleTransition) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
Example 14
Source File: CloudToTweetStep.java From TweetwallFX with MIT License | 4 votes |
private Pane createInfoBox( final WordleSkin wordleSkin, final MachineContext context, final Tweet displayTweet, final Point2D lowerLeft) { final Tweet originalTweet = displayTweet.getOriginTweet(); Image profileImage = context.getDataProvider(TweetUserProfileImageDataProvider.class).getImage(originalTweet.getUser()); ImageView imageView = new ImageView(profileImage); Rectangle clip = new Rectangle(64, 64); clip.setArcWidth(10); clip.setArcHeight(10); imageView.setClip(clip); HBox imageBox = new HBox(imageView); imageBox.setPadding(new Insets(10)); Label name = new Label(originalTweet.getUser().getName()); name.getStyleClass().setAll("name"); Label handle = new Label("@" + originalTweet.getUser().getScreenName() + " - " + wordleSkin.getDf().format(originalTweet.getCreatedAt())); handle.getStyleClass().setAll("handle"); HBox firstLineBox = new HBox(); HBox secondLineBox = new HBox(name); HBox thirdLineBox = new HBox(handle); if (originalTweet.getUser().isVerified()) { FontAwesomeIconView verifiedIcon = new FontAwesomeIconView(); verifiedIcon.getStyleClass().addAll("verifiedAccount"); secondLineBox.getChildren().add(verifiedIcon); HBox.setMargin(verifiedIcon, new Insets(9, 10, 0, 5)); } if (displayTweet.isRetweet()) { FontAwesomeIconView retweetIconBack = new FontAwesomeIconView(); retweetIconBack.getStyleClass().addAll("retweetBack"); FontAwesomeIconView retweetIconFront = new FontAwesomeIconView(); retweetIconFront.getStyleClass().addAll("retweetFront"); Label retweetName = new Label(displayTweet.getUser().getName()); retweetName.getStyleClass().setAll("retweetName"); GlyphsStack stackedIcon = GlyphsStack.create() .add(retweetIconBack) .add(retweetIconFront); firstLineBox.getChildren().addAll(stackedIcon, retweetName); HBox.setMargin(stackedIcon, new Insets(0, 10, 0, 0)); } if (wordleSkin.getFavIconsVisible()) { if (0 < originalTweet.getRetweetCount()) { FontAwesomeIconView faiReTwCount = new FontAwesomeIconView(); faiReTwCount.getStyleClass().setAll("retweetCount"); Label reTwCount = new Label(String.valueOf(originalTweet.getRetweetCount())); reTwCount.getStyleClass().setAll("handle"); thirdLineBox.getChildren().addAll(faiReTwCount, reTwCount); HBox.setMargin(faiReTwCount, new Insets(5, 10, 0, 5)); } if (0 < originalTweet.getFavoriteCount()) { FontAwesomeIconView faiFavCount = new FontAwesomeIconView(); faiFavCount.getStyleClass().setAll("favoriteCount"); Label favCount = new Label(String.valueOf(originalTweet.getFavoriteCount())); favCount.getStyleClass().setAll("handle"); thirdLineBox.getChildren().addAll(faiFavCount, favCount); HBox.setMargin(faiFavCount, new Insets(5, 10, 0, 5)); } } final GridPane infoBox = new GridPane(); infoBox.setStyle("-fx-padding: 20px;"); infoBox.setPrefHeight(100); infoBox.setMaxHeight(100); infoBox.setLayoutX(lowerLeft.getX()); infoBox.setLayoutY(lowerLeft.getY()); infoBox.setAlignment(Pos.CENTER); infoBox.getChildren().addAll(imageBox, firstLineBox, secondLineBox, thirdLineBox); GridPane.setConstraints(imageBox, 0, 1, 1, 2); GridPane.setConstraints(firstLineBox, 1, 0); GridPane.setConstraints(secondLineBox, 1, 1); GridPane.setConstraints(thirdLineBox, 1, 2); return infoBox; }
Example 15
Source File: ClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 || Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) { if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) { getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight()); } else { getSkinnable().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(getSkinnable().getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Rectangle(3, 96); minute.setArcHeight(3); minute.setArcWidth(3); minute.setStroke(getSkinnable().getMinuteColor()); minute.getTransforms().setAll(minuteRotate); second = new Rectangle(1, 96); second.setArcHeight(1); second.setArcWidth(1); second.setStroke(getSkinnable().getSecondColor()); second.getTransforms().setAll(secondRotate); second.setVisible(getSkinnable().isSecondsVisible()); second.setManaged(getSkinnable().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(getSkinnable().getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(getSkinnable().getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(getSkinnable().getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(getSkinnable().isTitleVisible()); title.setManaged(getSkinnable().isTitleVisible()); dateText = new Text(""); dateText.setVisible(getSkinnable().isDateVisible()); dateText.setManaged(getSkinnable().isDateVisible()); text = new Text(""); text.setVisible(getSkinnable().isTextVisible()); text.setManaged(getSkinnable().isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(getSkinnable().getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example 16
Source File: LcdClockSkin.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); } } mainInnerShadow0 = new InnerShadow(); mainInnerShadow0.setOffsetX(0.0); mainInnerShadow0.setOffsetY(0.0); mainInnerShadow0.setRadius(3.0 / 132.0 * PREFERRED_WIDTH); mainInnerShadow0.setColor(Color.rgb(255, 255, 255, 0.5)); mainInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); mainInnerShadow1 = new InnerShadow(); mainInnerShadow1.setOffsetX(0.0); mainInnerShadow1.setOffsetY(1.0); mainInnerShadow1.setRadius(2.0 / 132.0 * PREFERRED_WIDTH); mainInnerShadow1.setColor(Color.rgb(0, 0, 0, 0.65)); mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); mainInnerShadow1.setInput(mainInnerShadow0); crystalClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT); crystalClip.setArcWidth(5); crystalClip.setArcHeight(5); crystalImage = Helper.createNoiseImage(PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8); crystalOverlay = new ImageView(crystalImage); crystalOverlay.setClip(crystalClip); boolean crystalEnabled = clock.isLcdCrystalEnabled(); crystalOverlay.setManaged(crystalEnabled); crystalOverlay.setVisible(crystalEnabled); boolean secondsVisible = clock.isSecondsVisible(); backgroundTimeText = new Text(""); backgroundTimeText.setFill(clock.getLcdDesign().lcdBackgroundColor); backgroundTimeText.setOpacity((LcdFont.LCD == clock.getLcdFont() || LcdFont.ELEKTRA == clock.getLcdFont()) ? 1 : 0); backgroundSecondText = new Text(""); backgroundSecondText.setFill(clock.getLcdDesign().lcdBackgroundColor); backgroundSecondText.setOpacity((LcdFont.LCD == clock.getLcdFont() || LcdFont.ELEKTRA == clock.getLcdFont()) ? 1 : 0); backgroundSecondText.setManaged(secondsVisible); backgroundSecondText.setVisible(secondsVisible); timeText = new Text(""); timeText.setFill(clock.getLcdDesign().lcdForegroundColor); secondText = new Text(""); secondText.setFill(clock.getLcdDesign().lcdForegroundColor); secondText.setManaged(secondsVisible); secondText.setVisible(secondsVisible); title = new Text(clock.getTitle()); title.setFill(clock.getLcdDesign().lcdForegroundColor); boolean titleVisible = clock.isTitleVisible(); title.setManaged(titleVisible); title.setVisible(titleVisible); dateText = new Text(dateFormat.format(clock.getTime())); dateText.setFill(clock.getLcdDesign().lcdForegroundColor); boolean dateVisible = clock.isDateVisible(); dateText.setManaged(dateVisible); dateText.setVisible(dateVisible); dayOfWeekText = new Text(""); dayOfWeekText.setFill(clock.getLcdDesign().lcdForegroundColor); dayOfWeekText.setManaged(dateVisible); dayOfWeekText.setVisible(dateVisible); alarm = new Path(); alarm.setFillRule(FillRule.EVEN_ODD); alarm.setStroke(null); boolean alarmVisible = clock.getAlarms().size() > 0; alarm.setManaged(alarmVisible); alarm.setVisible(alarmVisible); shadowGroup = new Group(); shadowGroup.setEffect(clock.getShadowsEnabled() ? FOREGROUND_SHADOW : null); shadowGroup.getChildren().setAll(timeText, secondText, title, dateText, dayOfWeekText, alarm); pane = new Pane(); pane.setEffect(clock.getShadowsEnabled() ? mainInnerShadow1 : null); pane.getChildren().setAll(crystalOverlay, backgroundTimeText, backgroundSecondText, shadowGroup); getChildren().setAll(pane); }
Example 17
Source File: LinearSkin.java From Medusa with Apache License 2.0 | 4 votes |
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(preferredWidth, preferredHeight); } } barBorder1 = new Line(); barBorder2 = new Line(); barBackground = new Rectangle(); ticksAndSectionsCanvas = new Canvas(preferredWidth, preferredHeight); ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D(); ledCanvas = new Canvas(); led = ledCanvas.getGraphicsContext2D(); Helper.enableNode(ledCanvas, gauge.isLedVisible()); lcd = new Rectangle(0.3 * preferredWidth, 0.014 * preferredHeight); lcd.setArcWidth(0.0125 * preferredHeight); lcd.setArcHeight(0.0125 * preferredHeight); lcd.relocate((preferredWidth - lcd.getWidth()) * 0.5, 0.44 * preferredHeight); Helper.enableNode(lcd, gauge.isLcdVisible() && gauge.isValueVisible()); bar = new Rectangle(); bar.setStroke(null); barHighlight = new Rectangle(); barHighlight.setStroke(null); Helper.enableNode(barHighlight, gauge.isBarEffectEnabled()); titleText = new Text(gauge.getTitle()); titleText.setFill(gauge.getTitleColor()); Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); unitText = new Text(gauge.getUnit()); unitText.setFill(gauge.getUnitColor()); Helper.enableNode(unitText, !gauge.getUnit().isEmpty()); valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue())); valueText.setFill(gauge.getValueColor()); Helper.enableNode(valueText, gauge.isValueVisible()); pane = new Pane(barBorder1, barBorder2, barBackground, ticksAndSectionsCanvas, titleText, unitText, ledCanvas, lcd, valueText, bar, barHighlight); pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
Example 18
Source File: TurnoverTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@Override protected void resize() { super.resize(); width = tile.getWidth() - tile.getInsets().getLeft() - tile.getInsets().getRight(); height = tile.getHeight() - tile.getInsets().getTop() - tile.getInsets().getBottom(); size = width < height ? width : height; double containerWidth = contentBounds.getWidth(); double containerHeight = contentBounds.getHeight(); double containerSize = containerWidth < containerHeight ? containerWidth : containerHeight; if (tile.isShowing() && width > 0 && height > 0) { pane.setMaxSize(width, height); pane.setPrefSize(width, height); rotationEffect.setPrefSize(width, height); if (containerWidth > 0 && containerHeight > 0) { graphicContainer.setMinSize(containerWidth, containerHeight); graphicContainer.setMaxSize(containerWidth, containerHeight); graphicContainer.setPrefSize(containerWidth, containerHeight); graphicContainer.relocate(contentBounds.getX(), contentBounds.getY() * 0.3); if (null != tile) { imgView.setPreserveRatio(true); imgView.setFitWidth(containerWidth * 0.46); imgView.setFitHeight(containerHeight * 0.46); imgView.relocate((width - containerWidth) * 0.5, (height - containerHeight) * 0.5); switch(tile.getImageMask()) { case ROUND: imgView.setClip(new Circle(imgView.getLayoutBounds().getWidth() * 0.5, imgView.getLayoutBounds().getHeight() * 0.5, containerSize * 0.23)); rectangularFrame.setManaged(false); rectangularFrame.setVisible(false); roundFrame.setManaged(true); roundFrame.setVisible(true); roundFrame.setRadius(containerSize * 0.25); roundFrame.setStrokeWidth(size * 0.01); break; case RECTANGULAR: Rectangle clip = new Rectangle(containerSize * 0.46, containerSize * 0.46); clip.setArcWidth(size * 0.03); clip.setArcHeight(size * 0.03); imgView.setClip(clip); roundFrame.setManaged(false); roundFrame.setVisible(false); rectangularFrame.setManaged(true); rectangularFrame.setVisible(true); rectangularFrame.setWidth(containerSize * 0.5); rectangularFrame.setHeight(containerSize * 0.5); rectangularFrame.setStrokeWidth(size * 0.01); rectangularFrame.setArcWidth(size * 0.05); rectangularFrame.setArcHeight(size * 0.05); break; case NONE: default : imgView.setClip(null); roundFrame.setManaged(false); roundFrame.setVisible(false); rectangularFrame.setManaged(false); rectangularFrame.setVisible(false); break; } if (ImageMask.ROUND == tile.getImageMask()) { imgView.setClip(new Circle(imgView.getLayoutBounds().getWidth() * 0.5, imgView.getLayoutBounds().getHeight() * 0.5, containerSize * 0.23)); roundFrame.setManaged(true); roundFrame.setVisible(true); roundFrame.setRadius(containerSize * 0.25); roundFrame.setStrokeWidth(size * 0.01); } else { roundFrame.setManaged(false); roundFrame.setVisible(false); } } } rankingCircle.setRadius(containerSize * 0.075); rankingText.setFont(Fonts.latoRegular(size * 0.075)); rankingContainer.relocate(width * 0.5 - rankingCircle.getRadius(), height * 0.5 - containerSize * 0.4 - rankingCircle.getRadius()); resizeDynamicText(); resizeStaticText(); valueUnitFlow.setPrefWidth(width - size * 0.1); valueUnitFlow.relocate(size * 0.05, (height - valueUnitFlow.getLayoutBounds().getHeight()) * 0.8); valueUnitFlow.setMaxHeight(valueText.getFont().getSize()); fractionLine.setStartX(width - 0.17 * size); fractionLine.setStartY(tile.getTitle().isEmpty() ? size * 0.2 : size * 0.3); fractionLine.setEndX(width - 0.05 * size); fractionLine.setEndY(tile.getTitle().isEmpty() ? size * 0.2 : size * 0.3); fractionLine.setStroke(tile.getUnitColor()); fractionLine.setStrokeWidth(size * 0.005); unitFlow.setTranslateY(-size * 0.005); } }
Example 19
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); }
Example 20
Source File: SymbolRepresentation.java From phoebus with Eclipse Public License 1.0 | 3 votes |
DefaultSymbolNode() { setManaged(true); int w = 100; int h = 100; r = new Rectangle(0, 0, w, h); r.setFill(null); r.setArcHeight(0); r.setArcWidth(0); r.setStroke(Color.BLACK); r.setStrokeType(StrokeType.INSIDE); l1 = new Line(0.5, 0.5, w - 0.5, h - 0.5); l1.setStroke(Color.BLACK); l1.setStrokeLineCap(StrokeLineCap.BUTT); l2 = new Line(0.5, h - 0.5, w - 0.5, 0.5); l2.setStroke(Color.BLACK); l2.setStrokeLineCap(StrokeLineCap.BUTT); getChildren().add(r); getChildren().add(l1); getChildren().add(l2); }