當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。