本文整理汇总了Java中javafx.scene.shape.Line.setOpacity方法的典型用法代码示例。如果您正苦于以下问题:Java Line.setOpacity方法的具体用法?Java Line.setOpacity怎么用?Java Line.setOpacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Line
的用法示例。
在下文中一共展示了Line.setOpacity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setLine
import javafx.scene.shape.Line; //导入方法依赖的package包/类
public void setLine(Line line, double startX, double startY, double endX, double endY, boolean opaque) {
line.setStartX(startX);
line.setStartY(startY);
line.setEndX(endX);
line.setEndY(endY);
line.setOpacity(opaque ? 1 : 0);
}
示例2: start
import javafx.scene.shape.Line; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
double[] values = new double[]{50,166,200,106,94,211,172,133,132,185,152,131,158,180,172,314,262,160};
//---->Default graph using plotter<----
LineGraph graph = new LineGraph(400,200, Theme.TRAFFIC);
graph.setInterval(20);
//Populating the graph
for (double value : values) {
graph.addValue(value);
}
graph.render(LineGraph.Render.ALL);
StackPane background = new StackPane();
background.setPrefHeight(300);
background.setPrefWidth(600);
background.setStyle("-fx-background-color: radial-gradient(center 50% 50%, radius 100%, #2a367f, #1f2756)");
background.getChildren().add(graph);
StackPane.setAlignment(graph, Pos.CENTER);
StackPane axis = new StackPane();
axis.setMaxSize(500,50);
Line divider = new Line(50,0,550,0);
divider.setStroke(Color.WHITE);
divider.setOpacity(0.3);
axis.getChildren().add(divider);
StackPane.setAlignment(divider,Pos.CENTER);
Label time1 = new Label("8am");
Label time2 = new Label("5pm");
time1.setTextFill(Color.WHITE);
time2.setTextFill(Color.WHITE);
time1.setOpacity(0.5);
time2.setOpacity(0.5);
time1.setFont(Font.font("Calibri",16));
time2.setFont(Font.font("Calibri",16));
axis.getChildren().addAll(time1,time2);
StackPane.setAlignment(time1,Pos.BOTTOM_LEFT);
StackPane.setMargin(time1, new Insets(0,0,0,30));
StackPane.setAlignment(time2, Pos.BOTTOM_RIGHT);
StackPane.setMargin(time2, new Insets(0,30,0,0));
background.getChildren().add(axis);
StackPane.setAlignment(axis, Pos.BOTTOM_CENTER);
StackPane.setMargin(axis, new Insets(0,0,40,0));
primaryStage.setScene(new Scene(background));
primaryStage.setTitle("Traffic");
primaryStage.show();
}
示例3: DayViewSkin
import javafx.scene.shape.Line; //导入方法依赖的package包/类
public DayViewSkin(T view) {
super(view);
earlyHoursRegion = new Region();
earlyHoursRegion.setMouseTransparent(true);
earlyHoursRegion.getStyleClass().add("early-hours-region"); //$NON-NLS-1$
earlyHoursRegion.setManaged(false);
getChildren().add(earlyHoursRegion);
lateHoursRegion = new Region();
lateHoursRegion.setMouseTransparent(true);
lateHoursRegion.getStyleClass().add("late-hours-region"); //$NON-NLS-1$
lateHoursRegion.setManaged(false);
getChildren().add(lateHoursRegion);
for (int i = 1; i < 24; i++) {
createLine("half-hour-line"); //$NON-NLS-1$
createLine("full-hour-line"); //$NON-NLS-1$
}
createLine("half-hour-line"); //$NON-NLS-1$
currentTimeCircle = new Circle(4);
currentTimeCircle.getStyleClass().add("current-time-circle"); //$NON-NLS-1$
currentTimeCircle.setManaged(false);
currentTimeCircle.setMouseTransparent(true);
currentTimeCircle.setOpacity(0);
currentTimeCircle.visibleProperty().bind(view.enableCurrentTimeMarkerProperty());
getChildren().add(currentTimeCircle);
currentTimeLine = new Line();
currentTimeLine.getStyleClass().add("current-time-line"); //$NON-NLS-1$
currentTimeLine.setManaged(false);
currentTimeLine.setMouseTransparent(true);
currentTimeLine.setOpacity(0);
currentTimeLine.visibleProperty().bind(view.enableCurrentTimeMarkerProperty());
getChildren().add(currentTimeLine);
if (!(this instanceof WeekDayViewSkin)) {
/*
* Dragging inside week day views will be handled by a drag controller
* installed on the week view, not on the individual days.
*/
new DayViewEditController(view);
}
setupCurrentTimeMarkerSupport();
view.draggedEntryProperty().addListener(it -> addOrRemoveDraggedEntryView());
view.showCurrentTimeMarkerProperty().addListener(it -> updateTimelineVisibility());
view.showCurrentTimeTodayMarkerProperty().addListener(it -> updateTimelineVisibility());
view.layoutProperty().addListener(it -> view.requestLayout());
updateShowMarkers();
updateTimelineVisibility();
view.dateProperty().addListener(it -> {
if (displayedDate == null || !displayedDate.equals(view.getDate())) {
loadData("date changed");
}
});
view.suspendUpdatesProperty().addListener(evt -> loadData("suspend updates was set to false"));
view.getCalendars().addListener((javafx.beans.Observable obs) -> loadData("list of calendars changed"));
updateLineStyling();
final InvalidationListener styleLinesListener = it -> updateLineStyling();
view.startTimeProperty().addListener(styleLinesListener);
view.endTimeProperty().addListener(styleLinesListener);
view.earlyLateHoursStrategyProperty().addListener(styleLinesListener);
loadData("initial data loading");
}