本文整理汇总了Java中javafx.geometry.Insets类的典型用法代码示例。如果您正苦于以下问题:Java Insets类的具体用法?Java Insets怎么用?Java Insets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Insets类属于javafx.geometry包,在下文中一共展示了Insets类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import javafx.geometry.Insets; //导入依赖的package包/类
@Override
public void start(Stage stage) {
this.stage = stage;
stage.initStyle(StageStyle.TRANSPARENT);
VBox box = new VBox(20);
box.setMaxWidth(Region.USE_PREF_SIZE);
box.setMaxHeight(Region.USE_PREF_SIZE);
box.setBackground(Background.EMPTY);
String style = "-fx-background-color: rgba(255, 255, 255, 0.5);";
box.setStyle(style);
box.setPadding(new Insets(50));
BorderPane root = new BorderPane(box);
root.setStyle(style);
root.setBackground(Background.EMPTY);
Scene scene = new Scene(root);
scene.setFill(Color.TRANSPARENT);
stage.setScene(scene);
ImageView splashView = new ImageView(splashImage);
box.getChildren().addAll(splashView, new Label("ST Verification Studio is loading.."));
stage.show();
Rectangle2D primScreenBounds = Screen.getPrimary().getVisualBounds();
stage.setX((primScreenBounds.getWidth() - stage.getWidth()) / 2);
stage.setY((primScreenBounds.getHeight() - stage.getHeight()) / 2);
}
示例2: start
import javafx.geometry.Insets; //导入依赖的package包/类
@Override
public void start(Stage stage) {
Scene scene = new Scene(new Group());
scene.setFill(Color.ALICEBLUE);
stage.setScene(scene);
stage.show();
stage.setTitle("ChoiceBox Sample");
stage.setWidth(300);
stage.setHeight(200);
label.setFont(Font.font("Arial", 25));
label.setLayoutX(40);
final String[] greetings = new String[]{"Hello", "Hola", "Привет", "你好",
"こんにちは"};
final ChoiceBox cb = new ChoiceBox(FXCollections.observableArrayList(
"English", "Español", "Русский", "简体中文", "日本語")
);
cb.getSelectionModel().selectedIndexProperty().addListener(
(ObservableValue<? extends Number> ov,
Number old_val, Number new_val) -> {
label.setText(greetings[new_val.intValue()]);
});
cb.setTooltip(new Tooltip("Select the language"));
cb.setValue("English");
HBox hb = new HBox();
hb.getChildren().addAll(cb, label);
hb.setSpacing(30);
hb.setAlignment(Pos.CENTER);
hb.setPadding(new Insets(10, 0, 0, 10));
((Group) scene.getRoot()).getChildren().add(hb);
}
示例3: start
import javafx.geometry.Insets; //导入依赖的package包/类
@Override
public void start(Stage stage) {
Group root = new Group();
Scene scene = new Scene(root, 260, 80);
stage.setScene(scene);
stage.setTitle("Password Field Sample");
VBox vb = new VBox();
vb.setPadding(new Insets(10, 0, 0, 10));
vb.setSpacing(10);
HBox hb = new HBox();
hb.setSpacing(10);
hb.setAlignment(Pos.CENTER_LEFT);
Label label = new Label("Password");
final PasswordField pb = new PasswordField();
pb.setText("Your password");
pb.setOnAction((ActionEvent e) -> {
if (!pb.getText().equals("T2f$Ay!")) {
message.setText("Your password is incorrect!");
message.setTextFill(Color.rgb(210, 39, 30));
} else {
message.setText("Your password has been confirmed");
message.setTextFill(Color.rgb(21, 117, 84));
}
pb.clear();
});
hb.getChildren().addAll(label, pb);
vb.getChildren().addAll(hb, message);
scene.setRoot(vb);
stage.show();
}
示例4: overlay
import javafx.geometry.Insets; //导入依赖的package包/类
protected Parent overlay(int window, int yCode) {
EncoderParameters params = getEncoderParameters();
double ye = params.matrix.fromLumaCode(yCode);
double yo = params.transfer.eotf(ye);
CIExy xy = getColor(yo);
String text = format("HDR10 grayscale CIE(x=%.4f, y=%.4f) %.1f%% Y%d,"
+ " %.1f nit", xy.x, xy.y, ye * 100.0, yCode, yo * 10000.0);
Label label = new Label(text);
label.setFont(font(40));
label.setTextFill(gray(max(0.25, min(0.5, ye))));
BorderPane.setMargin(label, new Insets(20));
BorderPane layout = new BorderPane();
layout.setBackground(EMPTY);
layout.setBottom(label);
return layout;
}
示例5: init
import javafx.geometry.Insets; //导入依赖的package包/类
private void init() {
GridPane grid = new GridPane();
grid.setPadding(new Insets(GuiConstants.padding));
grid.setHgap(GuiConstants.padding);
grid.setVgap(GuiConstants.padding);
int row = 0;
row = addRow("Owner", ownerLabel, grid, row);
row = addRow("Name", nameLabel, grid, row);
row = addRow("Type", typeLabel, grid, row);
row = addRow("Access", accessLabel, grid, row);
row = addRow("Signature", sigLabel, grid, row);
row = addRow("Parents", parentLabel, grid, row);
row = addRow("Children", childLabel, grid, row);
row = addRow("Read refs", readRefLabel, grid, row);
row = addRow("Write refs", writeRefLabel, grid, row);
row = addRow("Comment", mapCommentLabel, grid, row);
setContent(grid);
}
示例6: start
import javafx.geometry.Insets; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
WatchDAO.addWatcher(this);
stage = primaryStage;
stage.setTitle(ViewConstants.PROGRAM_TITLE);
stage.getIcons().add(fileLoad.loadImageFile(ViewConstants.PROGRAM_ICON_LOCATION));
gridPane = new GridPane();
gridPane.setAlignment(Pos.TOP_LEFT);
gridPane.setHgap(10);
gridPane.setVgap(10);
gridPane.setPadding(new Insets(10, 10, 10, 10));
Scene scene = new Scene(gridPane, ViewConstants.PROGRAM_WIDTH, ViewConstants.PROGRAM_HEIGHT);
primaryStage.setScene(scene);
primaryStage.show();
gridPane.getStylesheets().add(this.getClass().getClassLoader().getResource("gui/css/weatherwatch.css")
.toExternalForm());
loadWeatherImages();
addGuiElements();
TrayApp.initialize();
}
示例7: makeInfoGUI
import javafx.geometry.Insets; //导入依赖的package包/类
/**
* Make Information Dialog
* @return BorderPane
*/
public void makeInfoGUI() {
root = new Group();
Scene scene = new Scene(root, 360, 185, Color.WHITE);
ImagePattern pattern = new ImagePattern(new Image("icon/bk2.jpg"));
scene.setFill(pattern);
setTitle("Information");
setScene(scene);
Image appIcon = new Image("icon/INFO.png");
getIcons().add(appIcon);
BorderPane bp = new BorderPane();
textArea = new TextArea(message);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(320);
textArea.setMaxHeight(130);
HBox hBox = new HBox();
hBox.setSpacing(5);
hBox.setPadding(new Insets(5,0,0,0));
hBox.setAlignment(Pos.BOTTOM_RIGHT);
hBox.getChildren().addAll(okButton);
bp.setCenter(textArea);
bp.setBottom(hBox);
root.getChildren().add(bp);
sizeToScene();
setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0);
setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0);
}
示例8: SocialNetwork
import javafx.geometry.Insets; //导入依赖的package包/类
public SocialNetwork(String site, VBox panel)
{
//apply the styles
getStyleClass().add("browser");
// load the web page
webEngine.load(site);
panel.setAlignment(Pos.CENTER);
panel.setPadding(new Insets(0,50,0,100));
flowPane.getChildren ().addAll(browser, panel);
flowPane.setVgap(25);
//add the web view to the scene
getChildren().add(flowPane);
}
示例9: start
import javafx.geometry.Insets; //导入依赖的package包/类
@Override public void start(Stage stage) {
HBox pane = new HBox(imageView, matrix);
pane.setSpacing(10);
pane.setPadding(new Insets(10));
pane.setBackground(new Background(new BackgroundFill(Color.rgb(10, 10, 20), CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
stage.setTitle("Matrix Image");
stage.setScene(scene);
stage.show();
timer.start();
}
示例10: queenWarning
import javafx.geometry.Insets; //导入依赖的package包/类
public void queenWarning(){
Dialog<ButtonType> popup = new Dialog<>();
popup.setTitle("Ajout impossible");
ButtonType close = new ButtonType("Fermer", ButtonBar.ButtonData.RIGHT);
popup.getDialogPane().getButtonTypes().add(close);
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
popup.getDialogPane().setContent(grid);
grid.add(new Label("Vous devez jouer votre reine."), 0, 0);
popup.show();
}
示例11: AssumptionPane
import javafx.geometry.Insets; //导入依赖的package包/类
public AssumptionPane(){
//this.getChildren().addAll(openButton,closeButton);
openButton.setMinWidth(100);
openButton.setMinHeight(40);
closeButton.setMinWidth(100);
closeButton.setMinHeight(40);
this.add(openButton,0,0);
this.add(closeButton,1,0);
openButton.setTooltip(openTip);
closeButton.setTooltip(closeTip);
this.setMargin(openButton, new Insets(5, 5, 5, 5));
this.setMargin(closeButton, new Insets(5, 5, 5, 5));
// this.setGridLinesVisible(true);
}
示例12: createIconContent
import javafx.geometry.Insets; //导入依赖的package包/类
public static Node createIconContent() {
StackPane sp = new StackPane();
VBox vbox = new VBox(3);
vbox.setAlignment(Pos.CENTER);
vbox.setPadding(new Insets(5, 5, 5, 5));
Rectangle rectangle = new Rectangle(32, 62, Color.LIGHTGREY);
rectangle.setStroke(Color.BLACK);
vbox.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
Rectangle r1 = new Rectangle(18, 14, Color.web("#1c89f4"));
Rectangle r2 = new Rectangle(18, 14, Color.web("#349b00"));
Rectangle r3 = new Rectangle(18, 20, Color.web("#349b00"));
vbox.getChildren().addAll(r1, r2, r3);
sp.getChildren().addAll(rectangle, vbox);
return new Group(sp);
}
示例13: layoutChildren
import javafx.geometry.Insets; //导入依赖的package包/类
@Override protected void layoutChildren() {
if (isFixedSize) {
super.layoutChildren();
} else {
List<Node> managed = getManagedChildren();
double width = getWidth();
///System.out.println("width = " + width);
double height = getHeight();
///System.out.println("height = " + height);
double top = getInsets().getTop();
double right = getInsets().getRight();
double left = getInsets().getLeft();
double bottom = getInsets().getBottom();
for (int i = 0; i < managed.size(); i++) {
Node child = managed.get(i);
layoutInArea(child, left, top,
width - left - right, height - top - bottom,
0, Insets.EMPTY, true, true, HPos.CENTER, VPos.CENTER);
}
}
}
示例14: initUi
import javafx.geometry.Insets; //导入依赖的package包/类
private void initUi() {
root.setMinSize(0, 0);
root.setPrefSize(1, 1); // Decouple from children.
root.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
root.getStyleClass().add(STYLE_CLASS);
root.getStylesheets().add(getClass().getResource(STYLESHEET).toExternalForm());
root.setAlignment(Pos.TOP_LEFT);
root.getChildren().addAll(panningComponent.getRoot(), addButton);
panningComponent.getChildren().addAll(sceneContent, resizerComponent.getRoot(), selectionBox.getRoot());
StackPane.setMargin(addButton, new Insets(15));
addButton.setGraphic(Svg.PLUS_FAT.node());
addButton.setFocusTraversable(false);
FocusHelper.requestFocusOnPress(panningComponent.getRoot());
}
示例15: createIconContent
import javafx.geometry.Insets; //导入依赖的package包/类
public static Node createIconContent() {
StackPane sp = new StackPane();
FlowPane fp = new FlowPane();
fp.setAlignment(Pos.CENTER);
Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
rectangle.setStroke(Color.BLACK);
fp.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
Rectangle[] littleRecs = new Rectangle[4];
Rectangle[] bigRecs = new Rectangle[4];
for (int i = 0; i < 4; i++) {
littleRecs[i] = new Rectangle(14, 14, Color.web("#1c89f4"));
bigRecs[i] = new Rectangle(16, 12, Color.web("#349b00"));
fp.getChildren().addAll(littleRecs[i], bigRecs[i]);
FlowPane.setMargin(littleRecs[i], new Insets(2, 2, 2, 2));
}
sp.getChildren().addAll(rectangle, fp);
return new Group(sp);
}