当前位置: 首页>>代码示例>>Java>>正文


Java VBox.setPadding方法代码示例

本文整理汇总了Java中javafx.scene.layout.VBox.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java VBox.setPadding方法的具体用法?Java VBox.setPadding怎么用?Java VBox.setPadding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.layout.VBox的用法示例。


在下文中一共展示了VBox.setPadding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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();
    }
 
开发者ID:TheRedSpy15,项目名称:The-Trail,代码行数:25,代码来源:AlertBox.java

示例2: createAndShowTableWindow

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private void createAndShowTableWindow(ComboBox<String> traceNameComboBox) {
	openedWindowsCtr++;
	List<String> traceNames = new ArrayList<>();
	for (int i = 0; i < plotData.getAllTraces().size(); i++) {
		traceNames.add(plotData.getAllTraces().get(i).getTraceName());
	}
	traceNameComboBox.setItems(FXCollections.observableList(traceNames));
	traceNameComboBox.getSelectionModel().select(0);

	HBox hbox = new HBox();

	traceNameComboBox.getSelectionModel().select(0);
	Region spacer = new Region();
	HBox.setHgrow(spacer, Priority.ALWAYS);
	hbox.getChildren().addAll(new Label("Please Select a trace :"), spacer, traceNameComboBox);

	updateTableValues(traceNameComboBox);

	Scene scene = new Scene(new Group());
	VBox vbox = new VBox();
	VBox.setVgrow(table, Priority.ALWAYS);
	vbox.setSpacing(5);
	vbox.setPadding(new Insets(10, 10, 10, 10));
	vbox.prefWidthProperty().bind(scene.widthProperty());
	vbox.prefHeightProperty().bind(scene.heightProperty());
	vbox.getChildren().addAll(hbox, table);

	((Group) scene.getRoot()).getChildren().addAll(vbox);

	Stage stage = new Stage();
	stage.setOnCloseRequest(e -> closeTableWindow());
	stage.setWidth(300);
	stage.setHeight(400);
	stage.setScene(scene);
	stage.sizeToScene();
	stage.showAndWait();
}
 
开发者ID:jasrodis,项目名称:javafx-dataviewer,代码行数:38,代码来源:TopMenu.java

示例3: reload

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void reload() {
	tabs.getTabs().clear();
	for (Path path: PathController.getItems()) {
		// create one tab per path
		VBox container = new VBox(8);
		container.setPadding(new Insets(20));
		Text header = new Text("" + path.getMailman());

		TableView<Path.PathStep> pathTable = new TableView<Path.PathStep>();	
		pathTable.setItems(FXCollections.observableList(path.getSteps()));
		
		TableColumn<Path.PathStep, String> shipmentCol = new TableColumn<Path.PathStep, String>("Envois");
		shipmentCol.setCellValueFactory(new PropertyValueFactory<Path.PathStep, String>("shipment"));
		
		TableColumn<Path.PathStep, String> distanceToNextCol = new TableColumn<Path.PathStep, String>("Distances au suivant (km)");
		distanceToNextCol.setCellValueFactory(new PropertyValueFactory<Path.PathStep, String>("distanceToNext"));
		
		TableColumn<Path.PathStep, String> sumDistanceCol = new TableColumn<Path.PathStep, String>("Distances cumulées (km)");
		sumDistanceCol.setCellValueFactory(new PropertyValueFactory<Path.PathStep, String>("sumDistance"));
		
		pathTable.getColumns().setAll(shipmentCol, distanceToNextCol, sumDistanceCol);
		
		container.getChildren().addAll(header, pathTable);
		String tabName = path.getMailman().getName().charAt(0) + ". " + path.getMailman().getLastName() + " (" + path.size() + ")";
		tabs.getTabs().add(new Tab(tabName, container));
	}
}
 
开发者ID:teamOtee,项目名称:x-facteur,代码行数:29,代码来源:PathView.java

示例4: CommentPopOver

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public CommentPopOver() {
  super();
  textArea = new TextArea();
  saveButton = GlyphsDude.createIconButton(FontAwesomeIcon.SAVE);
  buttonBar = new ButtonBar();
  buttonBar.getButtons().addAll(saveButton);
  VBox content = new VBox(textArea, buttonBar);
  content.setPadding(new Insets(5));
  this.setTitle("Edit Comment");
  this.setContentNode(content);
  textArea.editableProperty().bind(editable);

}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:14,代码来源:CommentPopOver.java

示例5: constructContainer

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	bottom = new HBox(50);
	bottom.setAlignment(Pos.CENTER);
	bottom.setMaxWidth(300);
	bottom.setPadding(new Insets(20,50,150,280));
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(100,20,20,20));

	
	btnLocal = new AppButton("lokal speichern");
	btnServer = new AppButton("auf dem Server speichern");
	back = new BackButton(getFXController(), "Zur�ck");
	
	home = new HomeButton(getFXController());
	
	
	
	AllFields.getChildren().addAll(btnLocal, btnServer);
	bottom.getChildren().addAll(back, home);
	
	bp.setCenter(AllFields);
	bp.setBottom(bottom);
	
	btnLocal.setOnAction(e -> getFXController().showView("savedownloadstacklocal view"));
	btnServer.setOnAction(e -> getFXController().showView("savedownloadstackonserverdialogview"));
	back.setOnAction(e -> getFXController().showView("serverdoorview"));
	
	return bp;
}
 
开发者ID:CoffeeCodeSwitzerland,项目名称:Lernkartei_2017,代码行数:37,代码来源:StackSavepathSelectionView.java

示例6: setPopOver

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void setPopOver(ImageView imageView, Image image) {
    PopOver popOver = new PopOver();
    popOver.setAnimated(false);

    VBox root = new VBox();
    root.setSpacing(3);
    root.setPadding(new Insets(10));

    root.getChildren().add(new Label(" image: " + image.getImageName()));

    if(image.getPosition() != -1)
        root.getChildren().add(new Label(" position: " + image.getPosition()));

    if(image.getScore() != -1)
        root.getChildren().add(new Label(" score: " + image.getScore()));

    popOver.setContentNode(root);
    popOver.setArrowLocation(PopOver.ArrowLocation.TOP_CENTER);

    imageView.hoverProperty().addListener((observable, wasHovering, isHovering) -> {
        if(isHovering && !popOver.isShowing()) {
            popOver.show(imageView);
        } else if(popOver.isShowing()) {
            popOver.hide();
        }
    });
}
 
开发者ID:AntonioGabrielAndrade,项目名称:LIRE-Lab,代码行数:28,代码来源:ToolTipProvider.java

示例7: PromptTab

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public PromptTab()
{
    super();
    super.setText("Confirmation Required");
    super.setClosable(false);
    
    pane = new Pane();
    contentBox = new VBox(); 
    buttonBox = new HBox();
    header = new Label();
    desc = new Label();
    
    yesButton = new Button("Yes");
    yesButton.setPrefWidth(50);
    
    noButton = new Button("No");
    noButton.setPrefWidth(50);
    
    buttonBox.getChildren().addAll(yesButton, noButton);
    buttonBox.setSpacing(10);
    
    contentBox.getChildren().addAll(header, desc, buttonBox);
    contentBox.setPadding(new Insets(15, 15, 15, 15));
    contentBox.setSpacing(15);
    
    pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    pane.getChildren().add(contentBox);
    
    super.setContent(pane);
}
 
开发者ID:BlueGoliath,项目名称:Goliath-Overclocking-Utility-FX,代码行数:32,代码来源:PromptTab.java

示例8: PatientCardPrescription

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public PatientCardPrescription(Patient patient) {
    
    imageView = new ImageView();
    vBox = new VBox();
    label = new Label();
    label0 = new Label();
    label1 = new Label();
    
    setAlignment(javafx.geometry.Pos.CENTER);
    setSpacing(5.0);
    getStylesheets().add("/view/prescription/../../css/main.css");
    
    imageView.setFitHeight(108.0);
    imageView.setFitWidth(93.0);
    imageView.setPickOnBounds(true);
    imageView.setPreserveRatio(true);
    showImage(patient);
    
    vBox.setAlignment(javafx.geometry.Pos.CENTER_LEFT);
    
    label.setText(patient.getName());
    
    label0.setText("Age : " + age(patient) + " Years");
    
    String sex = patient.getSex() == 1 ? "Male" : patient.getSex() == 2 ? "Fe-Male" : "Other";
    
    label1.setText("Sex : " + sex);
    vBox.setPadding(new Insets(0.0, 10.0, 0.0, 5.0));
    
    getChildren().add(imageView);
    vBox.getChildren().add(label);
    vBox.getChildren().add(label0);
    vBox.getChildren().add(label1);
    getChildren().add(vBox);
    
}
 
开发者ID:kmrifat,项目名称:Dr-Assistant,代码行数:37,代码来源:PatientCardPrescription.java

示例9: defineSubView

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private void defineSubView() {
    VBox mainView = new VBox();
    mainView.setPadding(new Insets(10, 10, 10, 10));

    Text title = new Text("Import JWK");
    title.setFont(viewTitleFont);

    mainView.getChildren().addAll(title, tableView, buttonRow);

    rootPane.setCenter(mainView);
}
 
开发者ID:atbashEE,项目名称:atbash-octopus,代码行数:12,代码来源:ImportJWKView.java

示例10: StringBindingSample

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public StringBindingSample() {
    final SimpleDateFormat format = new SimpleDateFormat("mm/dd/yyyy");
    final TextField dateField = new TextField();
    dateField.setPromptText("Enter a birth date");
    dateField.setMaxHeight(TextField.USE_PREF_SIZE);
    dateField.setMaxWidth(TextField.USE_PREF_SIZE);

    Label label = new Label();
    label.textProperty().bind(new StringBinding() {
        {
            bind(dateField.textProperty());
        }            
        @Override protected String computeValue() {
            try {
                Date date = format.parse(dateField.getText());
                Calendar c = Calendar.getInstance();
                c.setTime(date);

                Date today = new Date();
                Calendar c2 = Calendar.getInstance();
                c2.setTime(today);

                if (c.get(Calendar.DAY_OF_YEAR) == c2.get(Calendar.DAY_OF_YEAR) - 1
                        && c.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) {
                    return "You were born yesterday";
                } else {
                    return "You were born " + format.format(date);
                }
            } catch (Exception e) {
                return "Please enter a valid birth date (mm/dd/yyyy)";
            }
        }
    });

    VBox vBox = new VBox(7);
    vBox.setPadding(new Insets(12));
    vBox.getChildren().addAll(label, dateField);
    getChildren().add(vBox);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:40,代码来源:StringBindingSample.java

示例11: createRegisterControlPanel

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private Node createRegisterControlPanel()
{
	BorderPane registerPanel = new BorderPane();
	
	Label watchRegisterLabel = new Label("Watch Register: ");
	registerPanel.setLeft(watchRegisterLabel);
	setAlignment(watchRegisterLabel, Pos.CENTER);
	
	TextField registerNameField = new TextField();
	registerPanel.setCenter(registerNameField);
	setAlignment(registerNameField, Pos.CENTER);
	
	Button watchRegisterButton = new Button("Add");
	watchRegisterButton.setOnAction((event) -> watchRegister(registerNameField
			.getText()));
	registerPanel.setRight(watchRegisterButton);
	setAlignment(watchRegisterButton, Pos.CENTER);
	
	Pair<Node, ComboBox<String>> optionsRowPair = createDisplayOptionsRow();
	Node displayOptions = optionsRowPair.getKey();
	ComboBox<String> displayDropdown = optionsRowPair.getValue();
	displayDropdown.setOnAction((event) -> {
		String selection = displayDropdown.getSelectionModel().getSelectedItem();
		Function<Long, String> function = valueDisplayOptions.get(selection);
		registerDisplayFunction.set(function);
	});
	
	VBox controlPanel = new VBox();
	controlPanel.getChildren().add(registerPanel);
	controlPanel.getChildren().add(displayOptions);
	controlPanel.setAlignment(Pos.CENTER);
	setAlignment(controlPanel, Pos.CENTER);
	controlPanel.setPadding(new Insets(CP_PADDING));
	controlPanel.setSpacing(CP_SPACING);
	
	return controlPanel;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:38,代码来源:WatcherWindow.java

示例12: HTMLEditorSample

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public HTMLEditorSample() {
    VBox vRoot = new VBox();

    vRoot.setPadding(new Insets(8, 8, 8, 8));
    vRoot.setSpacing(5);

    htmlEditor = new HTMLEditor();
    htmlEditor.setPrefSize(500, 245);
    htmlEditor.setHtmlText(INITIAL_TEXT);
    vRoot.getChildren().add(htmlEditor);

    final Label htmlLabel = new Label();
    htmlLabel.setMaxWidth(500);
    htmlLabel.setWrapText(true);

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("noborder-scroll-pane");
    scrollPane.setContent(htmlLabel);
    scrollPane.setFitToWidth(true);
    scrollPane.setPrefHeight(180);

    Button showHTMLButton = new Button("Show the HTML below");
    vRoot.setAlignment(Pos.CENTER);
    showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent arg0) {
            htmlLabel.setText(htmlEditor.getHtmlText());
        }
    });

    vRoot.getChildren().addAll(showHTMLButton, scrollPane);
    getChildren().addAll(vRoot);

    // REMOVE ME
    // Workaround for RT-16781 - HTML editor in full screen has wrong border
    javafx.scene.layout.GridPane grid = (javafx.scene.layout.GridPane)htmlEditor.lookup(".html-editor");
    for(javafx.scene.Node child: grid.getChildren()) {
        javafx.scene.layout.GridPane.setHgrow(child, javafx.scene.layout.Priority.ALWAYS);
    }
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:43,代码来源:HTMLEditorSample.java

示例13: loadPropertyViewer

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private void loadPropertyViewer(){
	keysBox = new ComboBox<String>();
	keysBox.setPrefWidth(150);
	valField = new TextField();
	valField.setPrefWidth(150);
	final Button save = new Button("Save"), newProp = new Button("New"), 
			delete = new Button("Delete");
	save.setDisable(true);
	delete.setDisable(true);
	
	keysBox.getItems().add("");
	String[] keys = getKeys();
	keysBox.getItems().addAll(keys);
	keysBox.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue)->{
		local = true;
		if(newValue.intValue() != 0){
			cProp = props.get(newValue.intValue() - 1);
			valField.setText(cProp.getValue());
			delete.setDisable(false);
		}else {
			valField.setText("");
			delete.setDisable(true);
		}
		local = false;
		save.setDisable(true);
	});
	valField.textProperty().addListener((observable, oldValue, newValue)->{
		if(!local && keysBox.getSelectionModel().getSelectedIndex() > 0)
			save.setDisable(false);
	});
	
	delete.setOnAction((e)->{
		int i = keysBox.getSelectionModel().getSelectedIndex();
		if(i != 0){
			keysBox.getItems().remove(i);
			props.get(i - 1).remove();
			props.remove(i - 1);
		}
		keysBox.getSelectionModel().select(i - 1);
	});
	save.setOnAction((e)->{
		String newVal = valField.getText();
		if(!newProp(cProp, newVal))
			FlashFXUtils.showErrorDialog(this, "Error", "Value is incompatible with property type");
		save.setDisable(true);
	});
	newProp.setOnAction((e)->{
		Property prop = PropertyViewer.showPropertyCreator(this);
		if(prop != null){
			props.add(prop);
			keysBox.getItems().add(prop.getName());
		}
	});
	VBox viewerNode = new VBox();
	viewerNode.getChildren().addAll(keysBox, valField);
	viewerNode.setSpacing(10);
	viewerNode.setAlignment(Pos.CENTER);
	viewerNode.setPadding(new Insets(10, 10, 10, 10));
	HBox buttonNode = new HBox();
	buttonNode.getChildren().addAll(save, newProp, delete);
	buttonNode.setSpacing(10);
	buttonNode.setAlignment(Pos.CENTER_RIGHT);
	buttonNode.setPadding(new Insets(0, 5, 5, 0));
	BorderPane pane = new BorderPane();
	pane.setBottom(buttonNode);
	pane.setCenter(viewerNode);
	setScene(new Scene(pane, 200, 200));
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:69,代码来源:PropertyViewer.java

示例14: setToEdit

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void setToEdit()
{
	window= new Stage();
	window.setTitle("Edit User");
	window.initModality(Modality.APPLICATION_MODAL);
	window.getIcons().add(new Image("/pic/slogo.png"));
	window.setResizable(false);
	lusername= new Label("Username");
	txtname= new TextField();
	txtname.setPromptText("Username");
	txtname.setEditable(false);
	txtname.setText(Users.txtname.getText());
	
	llevel= new Label("User Level");
	cuser= new ComboBox<>();
	cuser.getItems().addAll("Super User","Gate Admin", "Office Admin","User");
	cuser.setEditable(true);
	cuser.setValue(Users.txtlevel.getText());
	btnsave=new Button("Save");
	btnsave.setOnAction(e ->{
		setEdited();
	});
	btnclose=new Button("Close");
	btnclose.setOnAction( e -> {
		window.close();
	});
	
	HBox lay= new HBox(10);
	lay.getChildren().addAll(lusername, txtname);
	
	HBox lay1= new HBox(10);
	lay1.getChildren().addAll(llevel, cuser);
	
	HBox laybtn= new HBox(10);
	laybtn.getChildren().addAll(btnsave, btnclose);
	laybtn.setPadding(new Insets(0,10,0,10));
	laybtn.setAlignment(Pos.CENTER_RIGHT);
	
	VBox layall= new VBox(15);
	layall.setPadding(new Insets(15,15,5,15));
	layall.getChildren().addAll(lay,lay1, laybtn);
	layall.setStyle("-fx-background-color: linear-gradient(#E4E9A9, #9CD777);");
	scene= new Scene(layall);
	scene.getStylesheets().add(EditingClass.class.getResource("users.css").toExternalForm());
	window.setScene(scene);
	window.show();
}
 
开发者ID:mikemacharia39,项目名称:gatepass,代码行数:48,代码来源:EditingClass.java

示例15: HTMLEditorSample

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public HTMLEditorSample() {
    final VBox root = new VBox();
    root.setPadding(new Insets(8, 8, 8, 8));
    root.setSpacing(5);
    root.setAlignment(Pos.BOTTOM_LEFT);

    final GridPane grid = new GridPane();
    grid.setVgap(5);
    grid.setHgap(10);

    final ChoiceBox sendTo = new ChoiceBox(FXCollections.observableArrayList("To:", "Cc:", "Bcc:"));

    sendTo.setPrefWidth(100);
    GridPane.setConstraints(sendTo, 0, 0);
    grid.getChildren().add(sendTo);

    final TextField tbTo = new TextField();
    tbTo.setPrefWidth(400);
    GridPane.setConstraints(tbTo, 1, 0);
    grid.getChildren().add(tbTo);

    final Label subjectLabel = new Label("Subject:");
    GridPane.setConstraints(subjectLabel, 0, 1);
    grid.getChildren().add(subjectLabel);

    final TextField tbSubject = new TextField();
    tbTo.setPrefWidth(400);
    GridPane.setConstraints(tbSubject, 1, 1);
    grid.getChildren().add(tbSubject);

    root.getChildren().add(grid);

    Platform.runLater(() -> {
        final HTMLEditor htmlEditor = new HTMLEditor();
        htmlEditor.setPrefHeight(370);
        root.getChildren().addAll(htmlEditor, new Button("Send"));
    });

    final Label htmlLabel = new Label();
    htmlLabel.setWrapText(true);
    getChildren().add(root);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:43,代码来源:HTMLEditorSample.java


注:本文中的javafx.scene.layout.VBox.setPadding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。