本文整理了Java中javafx.scene.layout.VBox.setAlignment()
方法的一些代码示例,展示了VBox.setAlignment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VBox.setAlignment()
方法的具体详情如下:
包路径:javafx.scene.layout.VBox
类名称:VBox
方法名:setAlignment
暂无
代码示例来源:origin: stackoverflow.com
Stage dialogStage = new Stage();
dialogStage.initModality(Modality.WINDOW_MODAL);
VBox vbox = new VBox(new Text("Hi"), new Button("Ok."));
vbox.setAlignment(Pos.CENTER);
vbox.setPadding(new Insets(15));
dialogStage.setScene(new Scene(vbox));
dialogStage.show();
代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx
@Override
public void handle(WebEvent<String> t) {
final Stage dialogStage = new Stage();
dialogStage.initModality(Modality.WINDOW_MODAL);
dialogStage.initOwner(owner);
ResourceBundle r = ResourceBundle.getBundle("org/netbeans/html/boot/fx/Bundle"); // NOI18N
dialogStage.setTitle(r.getString("AlertTitle")); // NOI18N
final Button button = new Button(r.getString("AlertCloseButton")); // NOI18N
final Text text = new Text(t.getData());
VBox box = new VBox();
box.setAlignment(Pos.CENTER);
box.setSpacing(10);
box.setPadding(new Insets(10));
box.getChildren().addAll(text, button);
dialogStage.setScene(new Scene(box));
button.setCancelButton(true);
button.setOnAction(new CloseDialogHandler(dialogStage, null));
dialogStage.centerOnScreen();
dialogStage.showAndWait();
}
});
代码示例来源:origin: stackoverflow.com
layout.setAlignment(Pos.CENTER);
layout.getChildren().setAll(
title,
stage.setScene(scene);
stage.show();
代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx
final Insets ins = new Insets(10);
final VBox box = new VBox();
box.setAlignment(Pos.CENTER);
box.setSpacing(10);
box.setPadding(ins);
buttons.setPadding(ins);
box.getChildren().addAll(text, buttons);
dialogStage.setScene(new Scene(box));
ok.setCancelButton(false);
代码示例来源:origin: stackoverflow.com
vBox.setAlignment(Pos.BASELINE_CENTER);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
代码示例来源:origin: org.apidesign.html/boot-fx
@Override
public void handle(WebEvent<String> t) {
final Stage dialogStage = new Stage();
dialogStage.initModality(Modality.WINDOW_MODAL);
dialogStage.setTitle("Warning");
final Button button = new Button("Close");
final Text text = new Text(t.getData());
VBox box = new VBox();
box.setAlignment(Pos.CENTER);
box.setSpacing(10);
box.setPadding(new Insets(10));
box.getChildren().addAll(text, button);
dialogStage.setScene(new Scene(box));
button.setCancelButton(true);
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
dialogStage.close();
}
});
dialogStage.centerOnScreen();
dialogStage.showAndWait();
}
});
代码示例来源:origin: stackoverflow.com
layout.setAlignment(Pos.CENTER);
layout.setStyle("-fx-padding: 10;");
layout.getChildren().addAll(configure, update);
stage.setScene(new Scene(layout));
stage.show();
代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx
box.setAlignment(Pos.CENTER);
box.setSpacing(10);
box.setPadding(ins);
buttons.setPadding(ins);
box.getChildren().addAll(text, line, buttons);
dialogStage.setScene(new Scene(box));
ok.setCancelButton(false);
代码示例来源:origin: stackoverflow.com
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ColoredToggle extends Application {
public static void main(String[] args) { Application.launch(ColoredToggle.class, args); }
@Override public void start(Stage stage) {
ToggleButton visibilityControl = new ToggleButton("Winterfell");
VBox layout = new VBox(10);
layout.setAlignment(Pos.CENTER);
layout.getChildren().setAll(visibilityControl);
layout.getStylesheets().add(getClass().getResource("colored-toggle.css").toExternalForm());
stage.setScene(new Scene(layout));
stage.show();
}
}
代码示例来源:origin: stackoverflow.com
private boolean isANext = true;
public void start(Stage primaryStage) throws Exception {
Button button = new Button("Change CSS");
VBox vbox = new VBox(10);
vbox.setAlignment(Pos.CENTER);
vbox.getChildren().add(button);
scene = new Scene(vbox, 200, 200);
button.setOnAction(ev -> {
// Alternate two stylesheets just for this demo.
String css = isANext ? "file:///C:/temp/a.css" : "file:///C:/temp/b.css";
isANext = !isANext;
System.out.println("Loading CSS at URL " + css);
scene.getStylesheets().clear();
scene.getStylesheets().add(css);
});
primaryStage.setTitle("Title");
primaryStage.setScene(scene);
primaryStage.show();
}
代码示例来源:origin: stackoverflow.com
root.getChildren().add(label);
root.setPadding(new Insets(5));
root.setAlignment(Pos.CENTER);
primaryStage.setScene(scene);
primaryStage.show();
代码示例来源:origin: stackoverflow.com
layout.setAlignment(Pos.CENTER);
layout.getChildren().setAll(
new ColoredProgressBar("red-bar", 0.2),
);
layout.getStylesheets().add(getClass().getResource("progress.css").toExternalForm());
stage.setScene(new Scene(layout));
stage.show();
代码示例来源:origin: stackoverflow.com
layout.setAlignment(Pos.CENTER);
layout.getChildren().addAll(button, response);
layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 10; -fx-font-size: 20;");
stage.setScene(new Scene(layout));
stage.show();
代码示例来源:origin: stackoverflow.com
);
layout.setPadding(new Insets(10));
layout.setAlignment(Pos.CENTER);
);
stage.setScene(new Scene(layout));
stage.show();
代码示例来源:origin: stackoverflow.com
layout.setAlignment(Pos.CENTER);
layout.getChildren().setAll(bar, reset);
layout.getStylesheets().add(getClass().getResource("progress.css").toExternalForm());
stage.setScene(new Scene(layout));
stage.show();
代码示例来源:origin: stackoverflow.com
layout.setAlignment(Pos.BASELINE_RIGHT);
layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 20; -fx-font-size: 20;");
stage.setScene(new Scene(layout));
stage.show();
代码示例来源:origin: stackoverflow.com
Label cursorCoords = createCursorGraphCoordsMonitorLabel(lineChart);
stage.setScene(
new Scene(
layoutScene(
stage.show();
VBox layout = new VBox(10);
layout.setPadding(new Insets(10));
layout.setAlignment(Pos.CENTER);
layout.getChildren().setAll(
cursorCoords,
代码示例来源:origin: stackoverflow.com
public class MyStageSize extends Application {
@Override
public void start(Stage stage) {
Label label = new Label();
VBox root = new VBox(label);
root.setAlignment(Pos.CENTER);
Scene scene = new Scene(root, 500, 500);
stage.setScene(scene);
stage.setX(0);
stage.setY(0);
stage.show();
scene.setOnMouseMoved(e -> label.setText(String.valueOf("X = " + e.getScreenX() + "\nY = " + e.getScreenY())));
}
public static void main(String[] args) {
launch(args);
}
}
代码示例来源:origin: stackoverflow.com
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
ImageGallery gallery = new ImageGallery();
VBox box= new VBox(gallery);
box.setAlignment(Pos.CENTER);
Scene scene = new Scene(box, 400, 400);
primaryStage.setScene(scene);
primaryStage.show();
gallery.rotateRight();
}
public static void main(String[] args){
launch(args);
}
}
代码示例来源:origin: stackoverflow.com
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class FontLoad extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Label label = new Label("JavaFX Application");
Button button = new Button("My Button");
VBox box = new VBox(15, label, button);
box.setAlignment(Pos.CENTER);
Scene scene = new Scene(box, 500, 300);
scene.getStylesheets().add(getClass().getResource("/fontstyle.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
内容来源于网络,如有侵权,请联系作者删除!