本文整理汇总了Java中javafx.scene.layout.VBox.setPrefWidth方法的典型用法代码示例。如果您正苦于以下问题:Java VBox.setPrefWidth方法的具体用法?Java VBox.setPrefWidth怎么用?Java VBox.setPrefWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.VBox
的用法示例。
在下文中一共展示了VBox.setPrefWidth方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void initialize()
{
packList = new VBox();
packList.setMinWidth(400);
packList.setPrefWidth(400);
packList.setMaxWidth(400);
packList.setAlignment(Pos.CENTER);
searchPopOver = new PopOver(packList);
searchPopOver.setArrowLocation(PopOver.ArrowLocation.TOP_CENTER);
searchPopOver.setAutoHide(false);
txtSearch.textProperty().addListener((observable, oldValue, newValue) -> search());
txtSearch.focusedProperty().addListener((observable, oldValue, newValue) ->
{
if (newValue)
{
search();
}
else
{
searchPopOver.hide();
}
});
}
示例2: SearchBoxSample
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public SearchBoxSample() {
String searchBoxCss = SearchBoxSample.class.getResource("SearchBox.css").toExternalForm();
VBox vbox = VBoxBuilder.create().build();
vbox.getStylesheets().add(searchBoxCss);
vbox.setPrefWidth(200);
vbox.setMaxWidth(Control.USE_PREF_SIZE);
vbox.getChildren().add(new SearchBox());
getChildren().add(vbox);
}
示例3: draw
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public Node draw () {
VBox container = new VBox(parseString(getString("HUDCushion")));
container.setPrefWidth(parseString(getString("HUDWidth")));
container.setPrefHeight(parseString(getString("HUDHeight")));
addUser(container);
addAttributes(container);
return container;
}
示例4: show
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void show(){
Group root = new Group();
Scene scene = new Scene(root, WIDTH, HEIGHT);
scene.getStylesheets().setAll("/styleSheets/login.css");
Image backgroundImage = new Image(getClass().getClassLoader().getResourceAsStream(myResources.getString("loaderImagePath")));
scene.setFill(new ImagePattern(backgroundImage));
// Bind the timerLabel text property to the timeSeconds property
timerLabel.textProperty().bind(timeSeconds.divide(100).asString());
timerLabel.setId("label");
ProgressBar progressBar = new ProgressBar();
progressBar.progressProperty().bind(
timeSeconds.divide(START_TIME*100.0).subtract(1).multiply(-1));
timeSeconds.set((START_TIME)*100);
timelineController();
Label loadingLabel =new Label("Game loading ...");
loadingLabel.setId("label");
VBox vb = new VBox(20);
// center the components within VBox
vb.setAlignment(Pos.CENTER);
vb.setPrefWidth(scene.getWidth());
vb.setLayoutY(60);
vb.getChildren().addAll( timerLabel, progressBar, loadingLabel);
root.getChildren().add(vb);
scene.getStylesheets().setAll(CSS_LOCATION);
primaryStage.setScene(scene);
primaryStage.show();
}
示例5: instantiate
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private void instantiate(SpriteMakerModel spriteData, DeveloperData developerData){
this.developerData=developerData;
myPane=new VBox();
lister=new ComponentLister();
updateLister(spriteData);
myPane.getChildren().addAll(new Label(myResources.getString("spriteComponents")), lister);
myPane.setPrefWidth(PREF_WIDTH);
this.setContent(myPane);
this.setPrefWidth(PREF_WIDTH);
}
示例6: start
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws InterruptedException {
this.primaryStage = primaryStage;
//Application starts
//Load Configurations to memory
TatConfigManager configManager = new TatConfigManager(config);
try {
configManager.loadConfigItem();
DateUtil.importPublicHoliday();
} catch (IOException ioe){
ioe.printStackTrace();
}catch (ClassNotFoundException ce){
ce.printStackTrace();
}
//Setup Menu
appMenu = new MenuCreator().createApplicationLevelMenu(this, primaryStage, fm, config);
//Setup Toolbar
appToolbar = new ToolBarCreator().createApplicationLevelToolBar(this, primaryStage, fm, config);
//Setup application border pane
applicationPane = new BorderPane();
//Setup left panel SplitPane frame
leftPanelSp = createLeftPanelSplitPane();
leftPanelSp.setPrefWidth(330);
leftUpperTabPane = new LeftUpperTabPane();
leftBottomTabPane = new LeftBottomTabPane(this);
leftPanelSp.getItems().addAll(leftUpperTabPane, leftBottomTabPane);
/**
* Initialize the chart tab pane for the drawing area.
* This is the centralized area to display OHLC charts
* If a new chart is opened, it will add a tab for this
* OHLC that all the related indicator canvas will be
* add into the same tab
*/
chartTabPane = new ChartTabPane(this);
applicationPane.setLeft(leftPanelSp);
applicationPane.setCenter(chartTabPane);
rightVBox = new VBox();
rightVBox.setPrefWidth(40);
Rectangle rect = new Rectangle();
rect.setFill(Color.DARKCYAN);
rect.widthProperty().bind(rightVBox.widthProperty());
rect.heightProperty().bind(leftPanelSp.heightProperty());
rightVBox.getChildren().addAll(rect);
rightVBox.prefHeightProperty().bind(applicationPane.heightProperty());
applicationPane.setRight(rightVBox);
//Bottom Status Bars
bottomStatusHBox = new HBox();
Rectangle bottomRect = new Rectangle();
bottomRect.setFill(Color.DARKCYAN);
bottomRect.widthProperty().bind(applicationPane.widthProperty());
bottomRect.setHeight(40);
bottomStatusHBox.getChildren().add(bottomRect);
applicationPane.setBottom(bottomStatusHBox);
//Packup things
VBox topBox = new VBox(appMenu, appToolbar);
applicationPane.setTop(topBox);
Scene scene = new Scene(applicationPane, 880, 600);
scene.getStylesheets().add("style/stylesheet.css");
Image appIcon = new Image("icon/TAT_LOGO_BLUE.png");
primaryStage.getIcons().add(appIcon);
primaryStage.setIconified(true);
primaryStage.setTitle("Technical Analysis Tool Version 1.0.0");
primaryStage.setScene(scene);
primaryStage.setMinWidth(400);
primaryStage.setMinHeight(350);
primaryStage.setMaximized(true);
BindProperties();
primaryStage.show();
System.out.println("javafx.runtime.version: " + System.getProperty("javafx.runtime.version"));
}
示例7: constructContainer
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public Parent constructContainer() {
webContent.loadContent("<html><body><b>Missing a manual</b></body></html>");
try {
// To avoid strange chars like "", the html -Tag is added here separately:
webContent.loadContent("<html>"+Functions.fileToString(new File(
"src/views/txt/impressum.htm"))+"</html>");
} catch (Exception e) {
e.printStackTrace();
}
double pageWidth = this.getFXController().getMyFXStage().getOPTIMAL_WIDTH();
double pageHeight = this.getFXController().getMyFXStage().getOPTIMAL_HEIGHT();
debug.Debugger.out("ImpressumView sizes: w:"+pageWidth+" h:"+pageHeight);
//webPage.setPrefHeight(pageHeight);
//webContent.setJavaScriptEnabled(true);
webPage.setPrefWidth(pageWidth*.93);
webPage.applyCss();
Label labelTitel = new Label("Impressum");
labelTitel.setId("impressumtitel");
AppButton backBtn = new AppButton("_Zur�ck");
backBtn.setOnAction(e -> getFXController().showMainView());
BorderPane headLayout = new BorderPane(labelTitel);
headLayout.setPadding(new Insets(20));
//Info: Die Links sind nun im Controlllayout damit sie mit dem
//Zur�ckButton auf einer H�he sind.
Hyperlink WISSlink = new Hyperlink("WISS Webseite");
WISSlink.setOnAction(e -> Functions.openWebpage("http://www.wiss.ch/"));
Hyperlink BITLink = new Hyperlink("BIT Webseite");
BITLink.setOnAction(e -> Functions.openWebpage("https://www.bit.admin.ch/"));
Hyperlink LehrlingeLink = new Hyperlink("Unsere Webseite");
LehrlingeLink.setOnAction(e -> Functions.openWebpage("http://bund2015.wiss-bern.ch/"));
WISSlink.setId("LinkiD");
BITLink.setId("LinkiD");
LehrlingeLink.setId("LinkiD");
//ScrollPane scroller = new ScrollPane();
//scroller.setMaxWidth(800);
//scroller.setHbarPolicy(ScrollBarPolicy.NEVER);
//scroller.setVbarPolicy(ScrollBarPolicy.ALWAYS);
//scroller.setContent(contentLayout);
//Contentlayout beinhaltet webpage
VBox contentLayout = new VBox(20);
contentLayout.setMinHeight(pageHeight*0.6);
contentLayout.setPrefWidth(pageWidth*.93);
contentLayout.getChildren().addAll(webPage);
//F�r die ControllButtons und die Links
ControlLayout conLay = new ControlLayout(backBtn,WISSlink, BITLink, LehrlingeLink);
MainLayout maLay = new MainLayout(contentLayout, headLayout, conLay);
return maLay;
}
示例8: constructContainer
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public Parent constructContainer() {
webContent.loadContent("<html><body><b>Missing a manual</b></body></html>");
try {
// To avoid strange chars like "", the html -Tag is added here separately:
webContent.loadContent("<html>"+Functions.fileToString(new File(
"src/views/txt/anleitung.htm"))+"</html>");
} catch (Exception e) {
e.printStackTrace();
}
double pageWidth = this.getFXController().getMyFXStage().getOPTIMAL_WIDTH();
double pageHeight = this.getFXController().getMyFXStage().getOPTIMAL_HEIGHT();
debug.Debugger.out("ManualView sizes: w:"+pageWidth+" h:"+pageHeight);
//webPage.setPrefHeight(pageHeight);
//webContent.setJavaScriptEnabled(true);
webPage.setPrefWidth(pageWidth*.93);
webPage.applyCss();
webPage.setId("anleitung");
Label labelTitel = new Label("Anleitung");
labelTitel.setId("anleitungstitel");
BackButton backBtn = new BackButton(this.getFXController());
BorderPane headLayout = new BorderPane(labelTitel);
headLayout.setPadding(new Insets(5));
//ScrollPane scroller = new ScrollPane();
//scroller.setMaxWidth(800);
//scroller.setHbarPolicy(ScrollBarPolicy.NEVER);
//scroller.setVbarPolicy(ScrollBarPolicy.ALWAYS);
//scroller.setContent(contentLayout);
VBox contentLayout = new VBox(0);
contentLayout.getChildren().addAll(webPage);
contentLayout.setMinHeight(pageHeight*0.6);
contentLayout.setPrefWidth(pageWidth*.93);
HBox controlLayout = new HBox(5);
controlLayout.setAlignment(Pos.BOTTOM_CENTER);
controlLayout.getChildren().addAll(backBtn);
controlLayout.setPadding(new Insets(10));
BorderPane mainLayout = new BorderPane();
mainLayout.setPadding(new Insets(25));
mainLayout.setTop(headLayout);
mainLayout.setCenter(contentLayout);
mainLayout.setBottom(controlLayout);
return mainLayout;
}
示例9: constructContainer
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public Parent constructContainer() {
webContent.loadContent("<html><body><b>Missing a manual</b></body></html>");
try {
// To avoid strange chars like "", the html -Tag is added here separately:
webContent.loadContent("<html>"+Functions.fileToString(new File(
"src/views/txt/quizlet.htm"))+"</html>");
} catch (Exception e) {
e.printStackTrace();
}
double pageWidth = this.getFXController().getMyFXStage().getOPTIMAL_WIDTH();
double pageHeight = this.getFXController().getMyFXStage().getOPTIMAL_HEIGHT();
debug.Debugger.out("QuizletView sizes: w:"+pageWidth+" h:"+pageHeight);
//webContent.setJavaScriptEnabled(true);
webPage.setPrefHeight(pageHeight);
webPage.setPrefWidth(pageWidth*.93);
webPage.applyCss();
Label labelTitel = new Label("Quizlet");
labelTitel.setId("impressumtitel");
AppButton backBtn = new AppButton("_Zur�ck");
backBtn.setOnAction(e -> getFXController().showMainView());
BorderPane headLayout = new BorderPane(labelTitel);
headLayout.setPadding(new Insets(5));
//ScrollPane scroller = new ScrollPane();
//scroller.setMaxWidth(800);
//scroller.setHbarPolicy(ScrollBarPolicy.NEVER);
//scroller.setVbarPolicy(ScrollBarPolicy.ALWAYS);
//scroller.setContent(contentLayout);
Hyperlink QuizletLink = new Hyperlink("Quizlet");
QuizletLink.setOnAction(e -> Functions.openWebpage("http://quizlet.com/"));
QuizletLink.setId("LinkiD");
VBox contentLayout = new VBox(0);
contentLayout.getChildren().addAll(webPage);
contentLayout.setMinHeight(pageHeight*0.6);
contentLayout.setPrefWidth(pageWidth*.93);
HBox controlLayout = new HBox(5);
controlLayout.setAlignment(Pos.BOTTOM_CENTER);
controlLayout.getChildren().addAll(backBtn,QuizletLink);
controlLayout.setPadding(new Insets(5));
BorderPane mainLayout = new BorderPane();
mainLayout.setPadding(new Insets(20));
mainLayout.setTop(headLayout);
mainLayout.setCenter(contentLayout);
mainLayout.setBottom(controlLayout);
return mainLayout;
}
示例10: generateDialog
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private void generateDialog(GoogleService t) {
Dialog<ArrayList<String>> dialog = new Dialog<>();
dialog.setWidth(300);
dialog.setTitle("Sync with Google Drive");
dialog.setHeaderText("Google Drive Sync");
ButtonType loginButtonType = new ButtonType("View", ButtonData.OK_DONE);
ButtonType cancelButtonType = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);
dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, cancelButtonType);
VBox vbox = new VBox();
vbox.setSpacing(10);
vbox.setAlignment(Pos.CENTER);
vbox.setPrefWidth(dialog.getWidth());
vbox.getChildren().add(new Label("Wait, sync is in progress."));
ProgressBar p = new ProgressBar();
p.setPrefWidth(300);
vbox.getChildren().add(p);
// Enable/Disable login button depending on whether a username was entered.
Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
loginButton.setDisable(true);
Node cancelButton = dialog.getDialogPane().lookupButton(cancelButtonType);
cancelButton.setOnMouseClicked(event ->{
t.cancel();
DownloadFiles.getInstance().stop();
});
t.setOnCancelled(event ->{
System.out.println("Downloading cancelled.");
t.cancel();
});
t.setOnSucceeded(success_evt ->{
System.out.println("Succeded.");
loginButton.setDisable(false);
cancelButton.setDisable(true);
});
dialog.getDialogPane().setContent(vbox);
dialog.setResultConverter(dialogButton -> {
if (dialogButton == loginButtonType) {
try {
model_man.listFromGoogleTable();
} catch (IOException ex) {
Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
}
return images;
}
return null;
});
Optional<ArrayList<String>> result = dialog.showAndWait();
result.ifPresent(usernamePassword -> {
ObservableList list = FXCollections.observableArrayList(images);
image_list.setCellFactory(new CallbackImpl());
image_list.getItems().clear();
image_list.refresh();
image_list.setItems(list);
items_count.setText(String.valueOf(images.size()));
});
}
示例11: viewCustom
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public void viewCustom(String title, String headerText, String content) {
if(t != null){
Dialog<ArrayList<String>> dialog = new Dialog<>();
dialog.setWidth(300);
dialog.setTitle(title);
dialog.setHeaderText(headerText);
ButtonType loginButtonType = new ButtonType("OK", ButtonBar.ButtonData.OK_DONE);
ButtonType cancelButtonType = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, cancelButtonType);
VBox vbox = new VBox();
vbox.setSpacing(10);
vbox.setAlignment(Pos.CENTER);
vbox.setPrefWidth(dialog.getWidth());
vbox.getChildren().add(new Label(content));
ProgressBar p = new ProgressBar();
p.setPrefWidth(300);
vbox.getChildren().add(p);
// Enable/Disable login button depending on whether a username was entered.
Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
loginButton.setDisable(true);
Node cancelButton = dialog.getDialogPane().lookupButton(cancelButtonType);
cancelButton.setOnMouseClicked(event ->{
t.cancel();
});
t.setOnCancelled(event ->{
t.cancel();
});
t.setOnSucceeded(success_evt ->{
System.out.println("Succeded.");
loginButton.setDisable(false);
cancelButton.setDisable(true);
});
dialog.getDialogPane().setContent(vbox);
dialog.getDialogPane().getStylesheets().add("/styles/Styles.css");
dialog.setResultConverter(dialogButton -> {
if (dialogButton == loginButtonType) {
}
return null;
});
Optional<ArrayList<String>> result = dialog.showAndWait();
result.ifPresent(usernamePassword -> {
});
}
}
示例12: setRightBlock
import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public VBox setRightBlock(){
VBox jobb = new VBox(10);
jobb.setSpacing(10);
jobb.setPrefWidth(200);
jobb.setPrefHeight(500);
jobb.setLayoutX(WIDTH-200);
Button gomb = new Button("Játék újrakezdése");
gomb.setPrefWidth(150);
gomb.setPadding(new Insets(10, 10, 10, 10));
gomb.setTranslateX((jobb.getPrefWidth()-gomb.getPrefWidth())/2);
gomb.setTranslateY(50);
jobb.setStyle("-fx-background-color: #c2c2d6;");
jobb.getChildren().add(gomb);
Text manualTitle = new Text("Irányítás:");
manualTitle.setTranslateX(50);
manualTitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
manualTitle.setTranslateY(100);
jobb.getChildren().add(manualTitle);
GridPane moveHolder = new GridPane();
moveHolder.setAlignment(Pos.CENTER);
moveHolder.setHgap(10);
moveHolder.setVgap(10);
moveHolder.setPrefWidth(200);
moveHolder.setPrefHeight(400);
Text moveUp = new Text("↑ - Felfele lépés");
moveUp.setTextAlignment(TextAlignment.CENTER);
moveUp.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveUp, 0, 0, 2, 1);
Text moveDown = new Text("↓ - Lefele lépés");
moveDown.setTextAlignment(TextAlignment.CENTER);
moveDown.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveDown, 0, 1, 2, 1);
Text moveLeft = new Text("← - Balra lépés");
moveLeft.setTextAlignment(TextAlignment.CENTER);
moveLeft.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveLeft, 0, 2, 2, 1);
Text moveRight = new Text("→ - Jobbra lépés");
moveRight.setTextAlignment(TextAlignment.CENTER);
moveRight.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveRight, 0, 3, 2, 1);
jobb.getChildren().add(moveHolder);
gomb.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
playGround.lepes = 0;
playGround.celban = 0;
playGround.getDatum();
playGround.resetPlayGround();
updatePlayGround();
playGround.nyertes = 0;
playGround.kezdes = 1;
}
});
return jobb;
}