本文整理匯總了Java中javafx.scene.shape.Path.setVisible方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.setVisible方法的具體用法?Java Path.setVisible怎麽用?Java Path.setVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.shape.Path
的用法示例。
在下文中一共展示了Path.setVisible方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initGraphics
import javafx.scene.shape.Path; //導入方法依賴的package包/類
@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);
}
示例2: initGraphics
import javafx.scene.shape.Path; //導入方法依賴的package包/類
@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);
}
示例3: initGraphics
import javafx.scene.shape.Path; //導入方法依賴的package包/類
@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);
}