本文整理汇总了Java中javafx.scene.layout.Region.setStyle方法的典型用法代码示例。如果您正苦于以下问题:Java Region.setStyle方法的具体用法?Java Region.setStyle怎么用?Java Region.setStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.Region
的用法示例。
在下文中一共展示了Region.setStyle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TaskSample
import javafx.scene.layout.Region; //导入方法依赖的package包/类
public TaskSample() {
TableView<DailySales> tableView = new TableView<DailySales>();
Region veil = new Region();
veil.setStyle("-fx-background-color: rgba(0, 0, 0, 0.4)");
ProgressIndicator p = new ProgressIndicator();
p.setMaxSize(150, 150);
//Define table columns
TableColumn idCol = new TableColumn();
idCol.setText("ID");
idCol.setCellValueFactory(new PropertyValueFactory("dailySalesId"));
tableView.getColumns().add(idCol);
TableColumn qtyCol = new TableColumn();
qtyCol.setText("Qty");
qtyCol.setCellValueFactory(new PropertyValueFactory("quantity"));
tableView.getColumns().add(qtyCol);
TableColumn dateCol = new TableColumn();
dateCol.setText("Date");
dateCol.setCellValueFactory(new PropertyValueFactory("date"));
dateCol.setMinWidth(240);
tableView.getColumns().add(dateCol);
StackPane stack = new StackPane();
stack.getChildren().addAll(tableView, veil, p);
// Use binding to be notified whenever the data source chagnes
Task<ObservableList<DailySales>> task = new GetDailySalesTask();
p.progressProperty().bind(task.progressProperty());
veil.visibleProperty().bind(task.runningProperty());
p.visibleProperty().bind(task.runningProperty());
tableView.itemsProperty().bind(task.valueProperty());
getChildren().add(stack);
new Thread(task).start();
}
示例2: initGraphics
import javafx.scene.layout.Region; //导入方法依赖的package包/类
private void initGraphics() {
background = new Region();
background.getStyleClass().setAll("background");
frame = new Region();
frame.getStyleClass().setAll("frame");
frame.setStyle(getSkinnable().getAlarmed() ? "-fx-background-color: -warning-color" : "-fx-background-color: -frame-color");
warningIcon = new Region();
warningIcon.getStyleClass().setAll("warning-icon");
warningIcon.setOpacity(getSkinnable().getAlarmed() ? 1 : 0);
currentValueText = new Text(getSkinnable().getCurrentText());
currentValueText.getStyleClass().setAll("text");
currentValueText.setTextOrigin(VPos.BOTTOM);
currentValueText.setFill(getSkinnable().getTextFill());
unitText = new Text(getSkinnable().getUnit());
unitText.getStyleClass().setAll("text");
unitText.setOpacity(getSkinnable().getUnitVisible() ? 1 : 0);
unitText.setFill(getSkinnable().getTextFill());
unitText.setVisible(getSkinnable().getAlarmed());
titleText = new Text(getSkinnable().getTitle());
titleText.getStyleClass().setAll("text");
titleText.setFill(getSkinnable().getTextFill());
pane = new Pane();
pane.getChildren().setAll(background, frame, warningIcon, currentValueText, unitText, titleText);
getChildren().setAll(pane);
resize();
updateDisplay();
}
示例3: init
import javafx.scene.layout.Region; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private void init(Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root));
VBox vbox = new VBox(5);
vbox.setPadding(new Insets(12));
TableView tableView = new TableView();
Button button = new Button("Refresh");
button.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
service.restart();
}
});
vbox.getChildren().addAll(tableView, button);
Region veil = new Region();
veil.setStyle("-fx-background-color: rgba(0, 800, 0, 0.3)");
ProgressIndicator p = new ProgressIndicator();
p.setMaxSize(150, 150);
//Define table columns
TableColumn idCol = new TableColumn();
idCol.setText("ID");
idCol.setMinWidth(150);
idCol.setCellValueFactory(new PropertyValueFactory<>("dailySalesId"));
tableView.getColumns().add(idCol);
TableColumn qtyCol = new TableColumn();
qtyCol.setText("Qty");
qtyCol.setMinWidth(150);
qtyCol.setCellValueFactory(new PropertyValueFactory<>("quantity"));
tableView.getColumns().add(qtyCol);
TableColumn dateCol = new TableColumn();
dateCol.setText("Date");
dateCol.setCellValueFactory(new PropertyValueFactory<>("date"));
dateCol.setMinWidth(150);
tableView.getColumns().add(dateCol);
p.progressProperty().bind(service.progressProperty());
veil.visibleProperty().bind(service.runningProperty());
p.visibleProperty().bind(service.runningProperty());
tableView.itemsProperty().bind(service.valueProperty());
StackPane stack = new StackPane();
stack.getChildren().addAll(vbox, veil, p);
root.getChildren().add(stack);
service.start();
}
示例4: ServiceSample
import javafx.scene.layout.Region; //导入方法依赖的package包/类
public ServiceSample() {
VBox vbox = new VBox(5);
vbox.setPadding(new Insets(12));
TableView tableView = new TableView();
Button button = new Button("Refresh");
button.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
service.restart();
}
});
vbox.getChildren().addAll(tableView, button);
Region veil = new Region();
veil.setStyle("-fx-background-color: rgba(0, 0, 0, 0.4)");
ProgressIndicator p = new ProgressIndicator();
p.setMaxSize(150, 150);
//Define table columns
TableColumn idCol = new TableColumn();
idCol.setText("ID");
idCol.setCellValueFactory(new PropertyValueFactory("dailySalesId"));
tableView.getColumns().add(idCol);
TableColumn qtyCol = new TableColumn();
qtyCol.setText("Qty");
qtyCol.setCellValueFactory(new PropertyValueFactory("quantity"));
tableView.getColumns().add(qtyCol);
TableColumn dateCol = new TableColumn();
dateCol.setText("Date");
dateCol.setCellValueFactory(new PropertyValueFactory("date"));
dateCol.setMinWidth(240);
tableView.getColumns().add(dateCol);
p.progressProperty().bind(service.progressProperty());
veil.visibleProperty().bind(service.runningProperty());
p.visibleProperty().bind(service.runningProperty());
tableView.itemsProperty().bind(service.valueProperty());
StackPane stack = new StackPane();
stack.getChildren().addAll(vbox, veil, p);
getChildren().add(stack);
service.start();
}