本文整理匯總了Java中javafx.scene.layout.StackPane.setStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java StackPane.setStyle方法的具體用法?Java StackPane.setStyle怎麽用?Java StackPane.setStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.StackPane
的用法示例。
在下文中一共展示了StackPane.setStyle方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: alert
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
/**
*
* Creates a scene, that has a label with a message, and is modal
*
* @param alertMSG String to be turned into a label
*/
protected void alert(String alertMSG){
Label label = new Label(alertMSG);
label.setFont(new Font(20));
label.setStyle("-fx-text-fill: white;");
label.setFont(new Font(20));
StackPane stackPane = new StackPane();
stackPane.setStyle("-fx-background-color: #cf1020");
stackPane.setPadding(new Insets(20,20,20,20));
stackPane.getChildren().add(label);
Scene scene = new Scene(stackPane);
Main.getAlertWindow().setScene(scene);
if (!(Main.getAlertWindow().isShowing())) Main.getAlertWindow().showAndWait();
}
示例2: wrap
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
@Override
protected Node wrap(Node node) {
HBox box = new HBox();
box.setMaxWidth(Double.MAX_VALUE);
box.setAlignment(Pos.CENTER);
box.setFillHeight(false);
StackPane stackPane = new StackPane();
stackPane.setStyle("-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 20px;");
box.getChildren().add(stackPane);
stackPane.getChildren().add(node);
stackPane.setEffect(new Reflection());
return box;
}
示例3: wrap
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
@Override
public Node wrap(Node node) {
HBox box = new HBox();
box.setStyle("-fx-padding: 100px;");
box.setAlignment(Pos.CENTER);
box.setFillHeight(false);
StackPane stackPane = new StackPane();
stackPane.setStyle(
"-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 0 20 0 20;");
box.getChildren().add(stackPane);
stackPane.getChildren().add(node);
stackPane.setEffect(new Reflection());
return box;
}
示例4: wrap
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
@Override
protected Node wrap(Node node) {
HBox box = new HBox();
box.setStyle("-fx-padding: 100px;");
box.setAlignment(Pos.CENTER);
box.setFillHeight(false);
StackPane stackPane = new StackPane();
stackPane.setStyle(
"-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 0 20 0 20;");
box.getChildren().add(stackPane);
stackPane.getChildren().add(node);
stackPane.setEffect(new Reflection());
return box;
}
示例5: wrap
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
@Override
protected Node wrap(Node node) {
TimeRangeView field = (TimeRangeView) node;
Label label = new Label("Range: " + field.getStartDate() + " to " + field.getEndDate());
label.setMaxHeight(Double.MAX_VALUE);
field.startDateProperty().addListener(it -> label.setText("Range: " + field.getStartDate() + " to " + field.getEndDate()));
field.endDateProperty().addListener(it -> label.setText("Range: " + field.getStartDate() + " to " + field.getEndDate()));
VBox box2 = new VBox(20, field, label);
box2.setFillWidth(false);
StackPane stackPane = new StackPane();
stackPane.setStyle("-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 20px;");
stackPane.getChildren().add(box2);
HBox box = new HBox(stackPane);
box.setStyle("-fx-padding: 100px;");
box.setAlignment(Pos.CENTER);
box.setFillHeight(false);
return box;
}
示例6: wrap
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
@Override
protected Node wrap(Node node) {
StackPane outerPane = new StackPane();
outerPane.setStyle("-fx-padding: 20px;");
StackPane stackPane = new StackPane();
stackPane.setStyle(
"-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 20px;");
outerPane.getChildren().add(stackPane);
StackPane.setAlignment(node, Pos.CENTER);
stackPane.getChildren().add(node);
return outerPane;
}
示例7: wrap
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
protected Node wrap(Node node) {
StackPane stackPane = new StackPane();
stackPane.setStyle("-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 20px;");
stackPane.getChildren().add(node);
HBox box = new HBox();
box.setAlignment(Pos.CENTER);
box.setFillHeight(false);
box.getChildren().add(stackPane);
return box;
}
示例8: configureBox
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void configureBox(HBox root) {
StackPane container = new StackPane();
//container.setPrefHeight(700);
container.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight());
container.setStyle("-fx-border-width:1px;-fx-border-style:solid;-fx-border-color:#999999;");
table= new TableView<AttClass>();
Label lview= new Label();
lview.setText("View Records");
lview.setId("lview");
bottomPane= new VBox();
tclock= new Text();
tclock.setId("lview");
//tclock.setFont(Font.font("Calibri", 20));
final Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
tclock.setText(DateFormat.getDateTimeInstance().format(new Date()));
}
}));
timeline.setCycleCount(Animation.INDEFINITE);
timeline.play();
bottomPane.getChildren().addAll(tclock,lview);
bottomPane.setAlignment(Pos.CENTER);
//table pane
namecol= new TableColumn<>("First Name");
namecol.setMinWidth(170);
namecol.setCellValueFactory(new PropertyValueFactory<>("name"));
admcol= new TableColumn<>("Identication No.");
admcol.setMinWidth(180);
admcol.setCellValueFactory(new PropertyValueFactory<>("adm"));
typecol= new TableColumn<>("Type");
typecol.setMinWidth(130);
typecol.setCellValueFactory(new PropertyValueFactory<>("type"));
timecol= new TableColumn<>("Signin");
timecol.setMinWidth(140);
timecol.setCellValueFactory(new PropertyValueFactory<>("timein"));
datecol= new TableColumn<>("Date");
datecol.setMinWidth(180);
datecol.setCellValueFactory(new PropertyValueFactory<>("date"));
table.getColumns().addAll(namecol, admcol, typecol, timecol, datecol);
table.setItems(getAtt());
att= getAtt();
table.setItems(FXCollections.observableArrayList(att));
table.setMinHeight(500);
btnrefresh = new Button("Refresh");
btnrefresh.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
table.setItems(getAtt());
}
});
laytable= new VBox(10);
laytable.getChildren().addAll(table, btnrefresh);
laytable.setAlignment(Pos.TOP_LEFT);
container.getChildren().addAll(bottomPane,laytable);
setAnimation();
sc.setContent(container);
root.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672)");
root.getChildren().addAll(getActionPane(),sc);
//service.start();
}
示例9: configureBox
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void configureBox(HBox root) {
StackPane container = new StackPane();
//container.setPrefHeight(700);
container.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight());
container.setStyle("-fx-border-width:1px;-fx-border-style:solid;-fx-border-color:#999999;");
table= new TableView<OfficeClass>();
Label lview= new Label();
lview.setText("View Records");
lview.setId("lview");
bottomPane= new VBox();
tclock= new Text();
tclock.setId("lview");
//tclock.setFont(Font.font("Calibri", 20));
final Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
tclock.setText(DateFormat.getDateTimeInstance().format(new Date()));
}
}));
timeline.setCycleCount(Animation.INDEFINITE);
timeline.play();
bottomPane.getChildren().addAll(tclock, lview);
bottomPane.setAlignment(Pos.CENTER);
nocol= new TableColumn<>("no");
nocol.setMinWidth(130);
nocol.setCellValueFactory(new PropertyValueFactory<>("no"));
namecol= new TableColumn<>("First Name");
namecol.setMinWidth(170);
namecol.setCellValueFactory(new PropertyValueFactory<>("name"));
admcol= new TableColumn<>("Admission Number");
admcol.setMinWidth(180);
admcol.setCellValueFactory(new PropertyValueFactory<>("adm"));
timecol= new TableColumn<>("Signin");
timecol.setMinWidth(140);
timecol.setCellValueFactory(new PropertyValueFactory<>("timein"));
datecol= new TableColumn<>("Date");
datecol.setMinWidth(180);
datecol.setCellValueFactory(new PropertyValueFactory<>("date"));
table.getColumns().addAll(nocol,namecol, admcol, timecol, datecol);
table.setItems(getAtt());
att= getAtt();
table.setItems(FXCollections.observableArrayList(att));
table.setMinHeight(500);
btnrefresh = new Button("Refresh");
btnrefresh.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
table.setItems(getAtt());
}
});
laytable= new VBox(10);
laytable.getChildren().addAll(table, btnrefresh);
laytable.setAlignment(Pos.TOP_LEFT);
container.getChildren().addAll(bottomPane,laytable);
setAnimation();
sc.setContent(container);
root.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672)");
root.getChildren().addAll(getActionPane(),sc);
//service.start();
}
示例10: start
import javafx.scene.layout.StackPane; //導入方法依賴的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();
}
示例11: createRootPane
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
public static StackPane createRootPane()
{
StackPane root = new StackPane();
root.setStyle("-fx-background-color: black");
return root;
}
示例12: createStackPane
import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
public static StackPane createStackPane(double width, double height, String style)
{
StackPane pane = createStackPane(width, height);
pane.setStyle(style);
return pane;
}