本文整理汇总了Java中javafx.scene.layout.VBox.setStyle方法的典型用法代码示例。如果您正苦于以下问题:Java VBox.setStyle方法的具体用法?Java VBox.setStyle怎么用?Java VBox.setStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.VBox
的用法示例。
在下文中一共展示了VBox.setStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import javafx.scene.layout.VBox; //导入方法依赖的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: notEnoughMoney
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
protected void notEnoughMoney(int amount){
Button button = new Button("Back");
Label label = new Label("Amount over: "+ amount);
label.setFont(new Font(20));
label.setStyle("-fx-text-fill: white;");
VBox stackPane = new VBox();
stackPane.setStyle("-fx-background-color: #cf1020");
stackPane.setPadding(new Insets(20,20,20,20));
stackPane.getChildren().addAll(label,button);
Scene scene = new Scene(stackPane);
// Determining what scene to go back too
if (!(Main.getAlertWindow().isShowing())) button.setOnAction(e -> Main.getAlertWindow().close());
else if (Main.getAlertWindow().getScene() == Main.getDealerScene()) button.setOnAction(e -> Main.getAlertWindow().setScene(Main.getDealerScene()));
else if (Main.getAlertWindow().getScene() == Main.getGunStoreScene()) button.setOnAction(e -> Main.getAlertWindow().setScene(Main.getGunStoreScene()));
else if (Main.getAlertWindow().getScene() == Main.getHireScene()) button.setOnAction(e -> Main.getAlertWindow().setScene(Main.getHireScene()));
Main.getAlertWindow().setScene(scene);
Main.getAlertWindow().setTitle("Not enough money");
if (!(Main.getAlertWindow().isShowing())) Main.getAlertWindow().showAndWait();
}
示例3: sold
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
protected void sold(String item, short amount, short profit){
Main.store.playPurchaseSound();
Gang.setMoney(Gang.getMoney() + profit);
Button button = new Button("Back");
Label label = new Label("You sold "+amount+" "+item+" for $"+profit);
label.setFont(new Font(20));
label.setStyle("-fx-text-fill: white;");
VBox stackPane = new VBox();
stackPane.setStyle("-fx-background-color: #cf1020");
stackPane.setPadding(new Insets(20,20,20,20));
stackPane.getChildren().addAll(label,button);
Scene scene = new Scene(stackPane);
button.setOnAction(e -> Main.getAlertWindow().setScene(Main.getSellScene()));
Main.getAlertWindow().setScene(scene);
if (!(Main.getAlertWindow().isShowing())) Main.getAlertWindow().showAndWait();
}
示例4: specialPurchase
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
protected void specialPurchase(String item){
Button button = new Button("Ok");
Label label = new Label("Purchased: " + item);
label.setFont(new Font(20));
label.setStyle("-fx-text-fill: white;");
VBox stackPane = new VBox();
stackPane.setStyle("-fx-background-color: #cf1020");
stackPane.setPadding(new Insets(20,20,20,20));
stackPane.getChildren().addAll(label,button);
Scene scene = new Scene(stackPane);
// Determining what scene to go back too
if (!(Main.getAlertWindow().isShowing())) button.setOnAction(e -> Main.getAlertWindow().close());
else if (Main.getAlertWindow().getScene() == Main.getDealerScene()) button.setOnAction(e -> Main.getAlertWindow().setScene(Main.getDealerScene()));
else if (Main.getAlertWindow().getScene() == Main.getGunStoreScene()) button.setOnAction(e -> Main.getAlertWindow().setScene(Main.getGunStoreScene()));
Main.getAlertWindow().setScene(scene);
Main.getAlertWindow().setTitle("PURCHASED");
if (!(Main.getAlertWindow().isShowing())) Main.getAlertWindow().showAndWait();
}
示例5: display
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public static void display(String title, String message)
{
Stage window= new Stage();
window.initModality(Modality.APPLICATION_MODAL);
//window.setAlwaysOnTop(true);
window.getIcons().add(new Image("/pic/slogo.png"));
window.setTitle(title);
Label label= new Label();
label.setText(message);
label.setStyle("-fx-font-size:14px;");
ImageView imageView = new ImageView(ICON);
imageView.setFitWidth(40);
imageView.setFitHeight(40);
Label labelimage = new Label("",imageView);
// two buttons
Button okbtn= new Button("Ok");
okbtn.setOnAction(e -> {
answer= false;
window.close();
});
okbtn.setId("red");
HBox hbox= new HBox(10);
hbox.setAlignment(Pos.CENTER_LEFT);
hbox.setPadding(new Insets(10,5,10,5));
hbox.getChildren().addAll(labelimage,label);
VBox layout= new VBox(15);
layout.setAlignment(Pos.CENTER_RIGHT);
layout.setPadding(new Insets(10,5,10,5));
layout.getChildren().addAll(hbox,okbtn);
layout.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);");
Scene scene= new Scene(layout);
scene.getStylesheets().add(ErrorMessage.class.getResource("confirm.css").toExternalForm());
window.setScene(scene);
window.setResizable(false);
window.showAndWait();
}
示例6: display
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public static void display(String title, String message)
{
Stage window= new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setAlwaysOnTop(true);
window.getIcons().add(new Image("/pic/slogo.png"));
window.setTitle(title);
Label label= new Label();
label.setText(message);
label.setStyle("-fx-font-size:14px;");
ImageView imageView = new ImageView(ICON);
imageView.setFitWidth(40);
imageView.setFitHeight(40);
Label labelimage = new Label("",imageView);
// two buttons
Button okbtn= new Button("Ok");
okbtn.setOnAction(e -> {
answer= false;
window.close();
});
okbtn.setId("blue");
HBox hbox= new HBox(10);
hbox.setAlignment(Pos.CENTER_LEFT);
hbox.setPadding(new Insets(10,5,10,5));
hbox.getChildren().addAll(labelimage,label);
VBox layout= new VBox(15);
layout.setAlignment(Pos.CENTER_RIGHT);
layout.setPadding(new Insets(10,5,10,5));
layout.getChildren().addAll(hbox,okbtn);
layout.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);");
Scene scene= new Scene(layout);
window.setScene(scene);
scene.getStylesheets().add(SuccessMessage.class.getResource("confirm.css").toExternalForm());
window.setResizable(false);
window.showAndWait();
}
示例7: getContentPane
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override protected Parent getContentPane() {
VBox root = new VBox();
root.setStyle("-fx-background-color:black");
root.getStyleClass().add("about-stage");
root.setId("aboutStage");
root.getChildren().addAll(FXUIUtils.getImage("marathon-splash"), infoBox, buttonBar);
return root;
}
示例8: getContentPane
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override protected Parent getContentPane() {
VBox root = new VBox();
root.setStyle("-fx-background-color:black");
root.setId("marathonITESplashScreen");
root.getStyleClass().add("marathonite-splash-screen");
root.getChildren().addAll(FXUIUtils.getImage("marathon-splash"), createInfo());
Timeline timeline = new Timeline(new KeyFrame(SPLASH_DISPLAY_TIME, (e) -> {
dispose();
}));
timeline.play();
return root;
}
示例9: paceSetterMethod
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
/**
*
* Creates, and sets the scene to one that allows the player(s) to set the pace
*
*/
protected static void paceSetterMethod(){
VBox PaceLayout = new VBox(10);
Label label = new Label("Choose a speed");
Button Slowbtn = new Button("Slow pace");
Button ModerateSpeedbtn = new Button("Moderate pace");
Button Fastbtn = new Button("Fast pace");
label.setStyle("-fx-text-fill: purple;");
label.setFont(new Font(20));
PaceLayout.setStyle("-fx-background-color: black");
Slowbtn.setOnAction(e -> {
Gang.setPace(5);
TravelController.animationDuration = 30;
getMenuWindow().setScene(menuScene);
});
ModerateSpeedbtn.setOnAction(e -> {
Gang.setPace(10);
TravelController.animationDuration = 15;
getMenuWindow().setScene(menuScene);
});
Fastbtn.setOnAction(e -> {
Gang.setPace(15);
TravelController.animationDuration = 10;
getMenuWindow().setScene(menuScene);
});
PaceLayout.setPadding(new Insets(20,20,20,20));
PaceLayout.getChildren().addAll(label,Slowbtn,ModerateSpeedbtn,Fastbtn);
setPaceScene(new Scene(PaceLayout,320,200));
}
示例10: showHelpContent
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
/**
* Help content of XpanderFX
*/
@SuppressWarnings("deprecation")
private void showHelpContent() {
try {
Node content = FXMLLoader.load(getClass().getResource("/com/shekkar/xpanderfx/top/popup/HelpFXML.fxml"));
help_box = new VBox();
help_box.getChildren().addAll(content,
HBoxBuilder.create().alignment(Pos.CENTER_LEFT)
.padding(new Insets(0,3,0,0))
.children(
VBoxBuilder.create().minWidth(720).alignment(Pos.CENTER_LEFT).padding(new Insets(0,0,0,10))
.children(
HyperlinkBuilder.create().text("open-source on GitHub [ShekkarRaee/XpanderFX]")
.onAction(e -> this.browse("https://github.com/ShekkarRaee/XpanderFX-2048-Game-JavaFX")).build(),
LabelBuilder.create().text("[email protected]").build()
)
.build(),
ButtonBuilder.create().text("OK")
.minHeight(40)
.minWidth(70)
.style("-fx-base:black;"
+ "-fx-border-radius: 7;"
+ "-fx-background-radius: 7;")
.onAction(e -> this.popupCloser(help, help_box))
.font(Font.font("System", FontWeight.MEDIUM, FontPosture.REGULAR, 20))
.build()
).style("-fx-background-color:white")
.build()
);
help_box.setStyle("-fx-background-color: linear-gradient(lightgrey, white, lightgrey);"
+ "-fx-border-color: white;"
+ "-fx-border-width: 1;");
help.getContent().add(help_box);
} catch (IOException ex) {
Logger.getLogger(MainFXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
}
help.show(this.ICON.getScene().getWindow(), this.getNodeMaxX() + 20, this.getNodeMaxY() + 40);
this.popupOpener(help_box);
}
示例11: start
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage)
{
IWSettingsController settings = new IWSettingsController();
IWMenuBar menuBar = new IWMenuBar(primaryStage, tabPane);
IWInternetTab iTab;
String actualPage = "";
if(settings.getUseHomepage()) {
System.out.println("use homepage");
actualPage = settings.getHomepage();
} else {
System.out.println("dont use homepage");
}
iTab = new IWInternetTab(actualPage, tabPane);
tabPane.getTabs().add(iTab);
VBox vbox = new VBox();
vbox.setStyle("-fx-padding: 10px;");
vbox.getChildren().addAll(menuBar, tabPane);
Scene scene = new Scene(vbox, settings.getMinimumWidth(), settings.getMinimumHeight());
primaryStage.setTitle(IWPropertyHelper.getProperty("default_window_title"));
primaryStage.setMinWidth(settings.getMinimumWidth());
primaryStage.setMinHeight(settings.getMinimumHeight());
primaryStage.setScene(scene);
primaryStage.show();
}
示例12: formatcomment
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public static BorderPane formatcomment(String timestamp, String comment){
BorderPane notice = new BorderPane();
notice.setPadding(new Insets(0,-20,0,10));
notice.setMaxWidth(340);
VBox noticeVB = new VBox(5);
noticeVB.setStyle("-fx-background-color: transparent; -fx-border-color: #333; -fx-border-width: 1,1,1,1; -fx-border-radius: 10; -fx-text-color: #333;");
Label commentLabel = new Label(comment);
commentLabel.setPadding(new Insets(5));
commentLabel.setFont(new Font("Cambria", 16));
commentLabel.setTextFill(Color.web("#191919"));
commentLabel.setWrapText(true);
commentLabel.setMaxWidth(320);
commentLabel.setAlignment(Pos.BOTTOM_LEFT);
Label time = new Label(timeStampChangeFormat.timeStampChangeFormat(timestamp));
time.setFont(new Font("Cambria", 12));
time.setTextFill(Color.web("#4c4c4c"));
time.setPadding(new Insets(5));
time.setMaxWidth(320);
time.setAlignment(Pos.BOTTOM_LEFT);
noticeVB.getChildren().addAll(commentLabel,time);
notice.setLeft(noticeVB);
noticeVB.setStyle("-fx-background-color: #fff");
return notice;
}
示例13: initUI
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private void initUI() {
VBox vbox = new VBox(20);
vbox.setStyle("-fx-padding: 10;");
Scene scene = new Scene(vbox, 400, 400);
stage.setScene(scene);
checkInDatePicker = new DatePicker();
checkOutDatePicker = new DatePicker();
checkInDatePicker.setValue(LocalDate.now());
final Callback<DatePicker, DateCell> dayCellFactory =
new Callback<DatePicker, DateCell>() {
@Override
public DateCell call(final DatePicker datePicker) {
return new DateCell() {
@Override
public void updateItem(LocalDate item, boolean empty) {
super.updateItem(item, empty);
if (item.isBefore(
checkInDatePicker.getValue().plusDays(1))
) {
setDisable(true);
setStyle("-fx-background-color: #ffc0cb;");
}
long p = ChronoUnit.DAYS.between(
checkInDatePicker.getValue(), item
);
setTooltip(new Tooltip(
"You're about to stay for " + p + " days")
);
}
};
}
};
checkOutDatePicker.setDayCellFactory(dayCellFactory);
checkOutDatePicker.setValue(checkInDatePicker.getValue().plusDays(1));
checkInDatePicker.setChronology(ThaiBuddhistChronology.INSTANCE);
checkOutDatePicker.setChronology(HijrahChronology.INSTANCE);
GridPane gridPane = new GridPane();
gridPane.setHgap(10);
gridPane.setVgap(10);
Label checkInlabel = new Label("Check-In Date:");
gridPane.add(checkInlabel, 0, 0);
GridPane.setHalignment(checkInlabel, HPos.LEFT);
gridPane.add(checkInDatePicker, 0, 1);
Label checkOutlabel = new Label("Check-Out Date:");
gridPane.add(checkOutlabel, 0, 2);
GridPane.setHalignment(checkOutlabel, HPos.LEFT);
gridPane.add(checkOutDatePicker, 0, 3);
vbox.getChildren().add(gridPane);
}
示例14: addDrawerVBox
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
/**
* Generates VBox with a drawer menu in it.
* @return generated VBox
*/
//TODO Once files gonna be generated, remove hard-coded stuff.
public VBox addDrawerVBox() {
leftDrawer.setDefaultDrawerSize(300);
leftDrawer.setOverLayVisible(false);
leftDrawer.setSidePane(drawerPane);
leftDrawer.setPrefSize(0,0);
JFXButton profileButton = new JFXButton("View Profile");
JFXButton button1 = new JFXButton("View Auctions");
JFXButton button2 = new JFXButton("View Favourites");
JFXButton searchButton = new JFXButton("Search profiles");
VBox vBox = new VBox();
vBox.setStyle("-fx-background-color: #E91E63; -fx-padding: -10;");
vBox.setPadding(new Insets(15, 12, 15, 0));
vBox.setSpacing(10);
button1.setMaxWidth(10000);
searchButton.setMaxWidth(10000);
button1.addEventHandler(MOUSE_CLICKED, e -> {
GUIController
.getPrimaryStage()
.setScene(new Scene(new ArtworkContainer(dc,curProfile,loggedInProfile)
.getPane(), getPane()
.getWidth(), getPane()
.getHeight())
);
});
button2.setMaxWidth(10000);
button2.addEventHandler(MOUSE_CLICKED, e -> {
GUIController
.getPrimaryStage()
.setScene(new Scene(new FavouriteProfileScene(dc,loggedInProfile,loggedInProfile)
.getPane(), getPane()
.getWidth(), getPane()
.getHeight())
);
});
profileButton.addEventHandler(MOUSE_CLICKED, e -> {
GUIController
.getPrimaryStage()
.setScene(new Scene(new ProfileScene(dc,loggedInProfile,loggedInProfile)
.getPane(), getPane()
.getWidth(), getPane()
.getHeight())
);
});
searchButton.addEventHandler(MOUSE_CLICKED, e -> {
GUIController
.getPrimaryStage()
.setScene(new Scene(new SearchScene(dc,curProfile,loggedInProfile)
.getPane(), getPane()
.getWidth(), getPane()
.getHeight()));
});
vBox.setMargin(profileButton, new Insets(25, 25, 1, 25));
vBox.setMargin(button1, new Insets(1, 25, 1, 25));
vBox.setMargin(button2, new Insets(1, 25, 25, 25));
vBox.setMargin(searchButton,new Insets(1,25,25,25));
button2.setMaxWidth(10000);
profileButton.setMaxWidth(10000);
vBox
.getChildren()
.addAll(profileButton,button1, button2, searchButton
);
return vBox;
}
示例15: showUsers
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void showUsers()
{
primaryStage = new Stage();
primaryStage.setTitle("e-Tracker Users");
primaryStage.setResizable(false);
primaryStage.initModality(Modality.APPLICATION_MODAL);
primaryStage.getIcons().add(new Image("/pic/slogo.png"));
//name
namecol = new TableColumn<>("Username");
namecol.setMinWidth(250);
namecol.setCellValueFactory(new PropertyValueFactory<>("name"));//has to be the same as in the UserCreation class
//level
levelcol = new TableColumn<>("User Level");
levelcol.setMinWidth(250);
levelcol.setCellValueFactory(new PropertyValueFactory<>("level"));
table= new TableView<>();
table.setItems(getProduct());
table.getColumns().addAll(namecol, levelcol);
table.getSelectionModel().selectedItemProperty().addListener(
(observable, oldValue, newValue) -> showPersonDetails(newValue));
txtname= new TextField();
txtname.setEditable(false);
txtname.setPromptText("Username");
txtlevel= new TextField();
txtlevel.setEditable(false);
txtlevel.setPromptText("User Level e.g. Admin");
badd= new Button("Add...");
badd.setOnAction(e ->{
addClicked();
});
bdel= new Button("Delete");
bdel.setOnAction(e ->{
deleteClicked();
});
bedit= new Button("Edit...");
bedit.setOnAction( e ->{
setPressbEdit();
});
HBox layout2= new HBox();
layout2.setSpacing(10); //similar to that 10
//layout2.setPadding(new Insets(20,20,20,20));
layout2.getChildren().addAll(txtname, txtlevel, bedit, badd, bdel);
layout2.setAlignment(Pos.CENTER_RIGHT);
VBox layout = new VBox(12);
layout.getChildren().addAll(table, layout2);
layout.setPadding(new Insets(20,20,20,20));
layout.setStyle("-fx-background-color: linear-gradient(#E4E9A9, #9CD777);");
Scene scene= new Scene(layout);
scene.getStylesheets().add(Users.class.getResource("users.css").toExternalForm());
primaryStage.setScene(scene);
if(MainWindow.ladmins.getText().equals("User") || MainWindow.ladmins.getText().equals("Office Admin") ||
MainWindow.ladmins.getText().equals("Gate Admin"))
{
badd.setDisable(true);
bdel.setDisable(true);
bedit.setDisable(true);
}
}