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


Java VBox.setSpacing方法代码示例

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


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

示例1: start

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250);
    stage.setScene(scene);
    stage.setTitle("Progress Controls");

    for (int i = 0; i < values.length; i++) {
        final Label label = labels[i] = new Label();
        label.setText("progress:" + values[i]);

        final ProgressBar pb = pbs[i] = new ProgressBar();
        pb.setProgress(values[i]);

        final ProgressIndicator pin = pins[i] = new ProgressIndicator();
        pin.setProgress(values[i]);
        final HBox hb = hbs[i] = new HBox();
        hb.setSpacing(5);
        hb.setAlignment(Pos.CENTER);
        hb.getChildren().addAll(label, pb, pin);
    }

    final VBox vb = new VBox();
    vb.setSpacing(5);
    vb.getChildren().addAll(hbs);
    scene.setRoot(vb);
    stage.show();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:29,代码来源:ProgressSample.java

示例2: ImageVariableSetter

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public ImageVariableSetter(String variableName) {
	super(variableName);
	myImagePath=new SimpleStringProperty();
	myContents=new VBox();
	getChildren().add(myContents);
	Button button= new Button("Choose Image File");
	button.setOnMouseClicked((event)->{
		FileChooser chooser=new FileChooser();
		chooser.setInitialDirectory(base);	
		File imageFile=chooser.showOpenDialog(new Stage());
		if(imageFile!=null){
			File relativePath=new File(base.toURI().relativize(imageFile.toURI()).getPath());
			myImagePath.set(relativePath.toString());
			System.out.println(relativePath);
		}
	});
	myContents.getChildren().addAll(new ImageDisplay(),button);
	myContents.setSpacing(20);
	System.out.println(base);
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:21,代码来源:ImageVariableSetter.java

示例3: 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

示例4: VisionControl

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public VisionControl() {
	slider = new Slider();
	slider.setMin(0.0);
	slider.setMax(255.0);
	slider.setValue(0.0);
	slider.setMaxWidth(350.0);
	slider.setDisable(true);
	
	inputText = new TextField();
	inputText.setText("0");
	inputText.setMaxWidth(50.0);
	inputText.setOnKeyPressed((e)->{
		if(e.getCode() == KeyCode.ENTER){
			setTextFromField();
		}
	});
	inputText.focusedProperty().addListener((obs, o, n)->{
		if(!n.booleanValue()){
			inputText.setText(String.valueOf((int)slider.getValue()));
		}
	});
	
	slider.valueProperty().addListener((obs, o, n)->{
		inputText.setText(String.valueOf((int)slider.getValue()));
	});
	
	nameLabel = new Label("");
	
	HBox top = new HBox();
	top.setSpacing(5.0);
	top.getChildren().addAll(nameLabel, inputText);
	
	VBox all = new VBox();
	all.setSpacing(10.0);
	all.getChildren().addAll(top, slider);
	root = all;
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:38,代码来源:MainWindow.java

示例5: initializeInputControls

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private Node initializeInputControls(){
	GridPane activatablecontrols = new GridPane();
	activatablecontrols.setAlignment(Pos.CENTER);
	activatablecontrols.setPadding(new Insets(10.0));
	activatablecontrols.setVgap(10.0);
	activatablecontrols.setHgap(10.0);
	controlsActivatable_Pane = activatablecontrols;
	
	GridPane inputcontrols = new GridPane();
	inputcontrols.setAlignment(Pos.CENTER);
	inputcontrols.setPadding(new Insets(10.0));
	inputcontrols.setVgap(10.0);
	inputcontrols.setHgap(15.0);
	controlsInput_Pane = inputcontrols;
	
	VBox estopBox = new VBox();
	estopBox.setSpacing(5.0);
	estopBox.setPadding(new Insets(10.0));
	estopBox.setAlignment(Pos.CENTER);
	estopBox.getChildren().addAll(Dashboard.getEmergencyStopControl().getRoot());
	
	SplitPane controlsPane = new SplitPane();
	controlsPane.setOrientation(Orientation.HORIZONTAL);
	controlsPane.getItems().addAll(inputcontrols, activatablecontrols);
	controlsPane.setMinSize(800.0, 150.0);
	
	BorderPane root = new BorderPane();
	root.setLeft(controlsPane);
	root.setRight(estopBox);
	return root;
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:32,代码来源:MainWindow.java

示例6: LosePresentation

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public LosePresentation(){
	vbButtons = new VBox(20);
	vbButtons.setLayoutY(200);
	vbButtons.setLayoutX(500);
	vbButtons.setSpacing(20);
	vbButtons.setPadding(new Insets(0, 20, 10, 20)); 

	vbTexts = new VBox(20);
	vbTexts.setLayoutY(20);
	vbButtons.setLayoutX(100);
	vbTexts.setSpacing(20);
	vbTexts.setPadding(new Insets(0, 20, 10, 20)); 
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:14,代码来源:LosePresentation.java

示例7: CircularDirectionIndicator

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public CircularDirectionIndicator(String name, double radius){
	this.name = name;
	this.radius = radius;
	
	root = new VBox();
	
	StackPane graphicalData = new StackPane();
	graphicalData.setMaxSize(radius * 2, radius * 2);
	lineBox = new Canvas();
	
	outerCircle = new Circle(graphicalData.getWidth() * 0.5, graphicalData.getHeight() * 0.5, radius);
	outerCircle.setFill(Color.TRANSPARENT);
	outerCircle.setStroke(Color.BLACK);
	/*innerCircle = new Circle(graphicalData.getWidth() * 0.5, graphicalData.getHeight() * 0.5, radius * 0.5);
	innerCircle.setFill(Color.TRANSPARENT);
	innerCircle.setStroke(Color.BLACK);*/
	
	lineBox.setWidth(radius * 2);
	lineBox.setHeight(radius * 2);
	
	graphicalData.getChildren().addAll(outerCircle, lineBox);
	
	valLbl = new Label(name+": 0.0");
	valLbl.setMinWidth(radius * 2);
	valLbl.setTextAlignment(TextAlignment.CENTER);
	
	HBox labalBox = new HBox();
	labalBox.getChildren().add(valLbl);
	labalBox.setAlignment(Pos.CENTER);
	
	root.setAlignment(Pos.CENTER);
	root.setSpacing(2.0);
	root.getChildren().addAll(labalBox, graphicalData);
	
	setValue(0);
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:37,代码来源:CircularDirectionIndicator.java

示例8: taskSelectionWindow

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
/**
 * Creates a Task selection window.
 *
 * @param list List of Tasks to be put into the window.
 * @return A list of selected Tasks
 */
protected static ObservableList<Task> taskSelectionWindow(ObservableList<Task> list)
{
    // Layout:
    VBox layout = new VBox();
    layout.setSpacing(10);
    layout.setAlignment(Pos.BOTTOM_RIGHT);
    // =================

    // Tasks columns:
    TableColumn<Task, String> nameColumn = new TableColumn<>("Task");
    nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));

    TableColumn<Task, String> assignmentColumn = new TableColumn<>("Assignments");
    assignmentColumn.setCellValueFactory(new PropertyValueFactory("assignments")
    {
        @Override public ObservableValue call(TableColumn.CellDataFeatures param)
        {
            SimpleStringProperty value = new SimpleStringProperty("");
            for (Assignment a : ((Task) param.getValue()).getAssignmentReferences())
                value.set(value.getValue() + a.getName() + "\n");
            return value;
        }
    });

    TableColumn<Task, String> deadlineColumn = new TableColumn<>("Deadline");
    deadlineColumn.setCellValueFactory(new PropertyValueFactory<>("deadline"));
    deadlineColumn.setStyle("-fx-alignment: CENTER-RIGHT;");
    // =================

    // Create a table:
    TableView<Task> tasks = new TableView<>();
    tasks.setItems(list);
    tasks.getColumns().addAll(nameColumn, assignmentColumn, deadlineColumn);
    tasks.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    // =================

    // Table attributes:
    tasks.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    GridPane.setHgrow(tasks, Priority.ALWAYS);
    GridPane.setVgrow(tasks, Priority.ALWAYS);
    // =================

    // Set click event:
    tasks.setRowFactory(TaskController::taskRowFactory);
    // =================

    // Button:
    Button OK = new Button("OK");
    OK.setOnAction(e -> {
        Stage current = (Stage) OK.getScene().getWindow();
        current.close();
    });
    VBox.setMargin(OK, new Insets(5));
    OK.setDefaultButton(true);
    // =================

    layout.getChildren().addAll(tasks, OK);

    // Set a new scene:
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setScene(new Scene(layout, 550, 300));
    stage.setTitle("Select dependencies");
    stage.getIcons().add(new Image("file:icon.png"));
    stage.showAndWait();
    // =================

    return tasks.getSelectionModel().getSelectedItems();
}
 
开发者ID:Alienturnedhuman,项目名称:PearPlanner,代码行数:76,代码来源:TaskController.java

示例9: CheckBoxes

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public CheckBoxes() {
    VBox vbox = new VBox();
    vbox.setSpacing(10);
    CheckBox cb1 = new CheckBox("Simple checkbox");

    CheckBox cb2 = new CheckBox("Three state checkbox");
    cb2.setAllowIndeterminate(true);
    cb2.setIndeterminate(false);

    CheckBox cb3 = new CheckBox("Disabled");
    cb3.setSelected(true);
    cb3.setDisable(true);

    vbox.getChildren().add(cb1);
    vbox.getChildren().add(cb2);
    vbox.getChildren().add(cb3);
    getChildren().add(vbox);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:CheckBoxes.java

示例10: TestApplication

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public TestApplication(Stage parent, Properties props) {
    initOwner(parent);
    MPFUtils.replaceEnviron(props);
    String model = props.getProperty(Constants.PROP_PROJECT_LAUNCHER_MODEL);
    if (model == null || model.equals("")) {
        commandField.setText("Select a launcher and set the parameters required.");
        show();
    } else {
        IRuntimeLauncherModel launcherModel = LauncherModelHelper.getLauncherModel(model);
        launchCommand = launcherModel.createLauncher(props);
    }
    initModality(Modality.APPLICATION_MODAL);
    BorderPane content = new BorderPane();
    VBox builder = new VBox();
    builder.setSpacing(5);
    outputArea.setEditable(false);
    errorArea.setEditable(false);
    VBox.setVgrow(errorArea, Priority.ALWAYS);
    builder.getChildren().addAll(new Label("Command"), commandField, new Label("Standard Output & Error"), outputArea,
            new Label("Message"), errorArea);
    closeButton.setOnAction((event) -> {
        if (launchCommand != null) {
            launchCommand.destroy();
        }
        close();
    });
    content.setCenter(builder);
    content.setBottom(new HBox(5, FXUIUtils.createFiller(), closeButton));
    setScene(new Scene(content));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:31,代码来源:TestApplication.java

示例11: 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

示例12: constructContainer

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	AllFields = new HBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));
	AllFields.setPadding(new Insets(200,0,0,0));
	//AllFields.setMinWidth(740);
	
	Value = new VBox();
	Value.setMinWidth(400);
	Value.setSpacing(35);
	Buttons = new VBox();
	Buttons.setSpacing(5);
	Name = new HBox();
	
	inputName = new TextField();
	inputName.setPromptText("Names der Door");
	inputName.setAlignment(Pos.CENTER_LEFT);
	inputName.setMinWidth(50);
	
	name = new Label("Name");
	removeDoor = new Label("Door l�schen");
	removeStacks = new Label("Enfert den/die Stack/s der Door");
	titel = new Label("Bearbeiten");

	btnRemoveDoor = new AppButton("Entfernen");
	btnRemoveStack = new AppButton("L�schen");
	btnModify = new AppButton("�ndern");
	back = new BackButton(getFXController(),"Abbrechen");
	
	//Buttons.getChildren().addAll(,,btnRemoveStack,back);
	Name.getChildren().addAll(name,inputName);
	Value.getChildren().addAll(Name,removeDoor,removeStacks);
	Buttons.getChildren().addAll(btnModify,btnRemoveStack,btnRemoveDoor,back);
	AllFields.getChildren().addAll(Value,Buttons);
	
	/*inside.setLeft(AllFields);
	inside.setRight(Buttons);*/
	
	bp.setCenter(AllFields);
	
	/*
	btnCreate.setOnAction(e -> getFXController().showView("serverdoorview"));
	--Listenter to crete a door
	*/
	
	
	return bp;
}
 
开发者ID:CoffeeCodeSwitzerland,项目名称:Lernkartei_2017,代码行数:54,代码来源:DMOModifyDoorView.java

示例13: 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()));
        });
}
 
开发者ID:Obsidiam,项目名称:joanne,代码行数:66,代码来源:FXMLDocumentController.java

示例14: start

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Checkbox Sample");
    stage.setWidth(250);
    stage.setHeight(150);

    rect.setArcHeight(10);
    rect.setArcWidth(10);
    rect.setFill(Color.rgb(41, 41, 41));

    for (int i = 0; i < names.length; i++) {
        final Image image = images[i] =
            new Image(getClass().getResourceAsStream(names[i] + ".png"));
        final ImageView icon = icons[i] = new ImageView();
        final CheckBox cb = cbs[i] = new CheckBox(names[i]);
        cb.selectedProperty().addListener(
                (ObservableValue<? extends Boolean> ov,
                Boolean old_val, Boolean new_val) -> {
                    icon.setImage(new_val ? image : null);                
        });
    }
    
    VBox vbox = new VBox();
    vbox.getChildren().addAll(cbs);
    vbox.setSpacing(5);

    HBox hbox = new HBox();
    hbox.getChildren().addAll(icons);
    hbox.setPadding(new Insets(0, 0, 0, 5));

    StackPane stack = new StackPane();

    stack.getChildren().add(rect);
    stack.getChildren().add(hbox);
    StackPane.setAlignment(rect, Pos.TOP_CENTER);                

    HBox root = new HBox();
    root.getChildren().add(vbox);
    root.getChildren().add(stack);
    root.setSpacing(40);
    root.setPadding(new Insets(20, 10, 10, 20));

    ((Group) scene.getRoot()).getChildren().add(root);

    stage.setScene(scene);
    stage.show();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:49,代码来源:CheckboxSample.java

示例15: constructContainer

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public Parent constructContainer()
{
	bp = new BorderPane();
	bp.setId("userviewbg");
	
	back = new BackButton(getFXController(),"Zur�ck");
	
	tabPane = new TabPane();
	tabPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
	tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
		   @Override
		   public void changed(ObservableValue<? extends Tab> ov, Tab tabOld, Tab tabNew) {
		      refreshView();
		   }
		});
	 
    	    
    Center = new VBox();
    Search = new HBox();
    Top = new VBox();
    
    
    txtSearch = new TextField();
    txtSearch.setPromptText("Suche nach Doors");
    txtSearch.setMinWidth(740);
    txtSearch.setMinHeight(50);;
    btnSearch = new AppButton("Suchen");
    btnCreate = new AppButton("++Erstellen++");
    btnCreate.setMinWidth(740);
    btnCreate.setMinWidth(740);
    btnCreate.setOnAction(e -> getFXController().showView("createdoorview"));
    
    StackShowList.setSpacing(20);
    Center.setSpacing(20);
    
    
    sMain = new ScrollPane();
    sMain.setContent(Center);
    
    Search.getChildren().addAll(txtSearch,btnSearch);
    Center.getChildren().addAll(StackShowList,btnCreate);
    
	back = new AppButton("Zur�ck");
	back.setOnAction(e-> getFXController().showView("lernenselectionview"));
	
	
	Bottom = new VBox();

	Bottom.getChildren().addAll(back);
	Top.getChildren().addAll(Search,tabPane);
	
	bp.setTop(Top);
	bp.setCenter(sMain);
	bp.setBottom(Bottom);
	
	getFXController().getModel("serverstack").registerView(this);
	
	return bp;
}
 
开发者ID:CoffeeCodeSwitzerland,项目名称:Lernkartei_2017,代码行数:61,代码来源:DMODoorView.java


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