Java Code Examples for javafx.scene.layout.Pane#setPrefHeight()

The following examples show how to use javafx.scene.layout.Pane#setPrefHeight() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CircleProperties.java    From UndoFX with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void start(Stage primaryStage) {
    Pane pane = new Pane();
    pane.setPrefWidth(400);
    pane.setPrefHeight(400);
    pane.getChildren().add(circle);

    HBox undoPanel = new HBox(20.0, undoBtn, redoBtn, saveBtn);

    VBox root = new VBox(10.0,
            pane,
            labeled("Color", colorPicker),
            labeled("Radius", radius),
            labeled("X", centerX),
            labeled("Y", centerY),
            undoPanel);
    root.setAlignment(Pos.CENTER);
    root.setFillWidth(false);

    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example 2
Source File: EditAxis.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
AxisEditor(final Axis axis, final boolean isHorizontal) {
    super();

    setTop(getLabelEditor(axis, isHorizontal));
    final Pane box = isHorizontal ? new HBox() : new VBox();
    setCenter(box);
    if (isHorizontal) {
        box.setPrefWidth(EditAxis.DEFAULT_PREFERRED_WIDTH);
    } else {
        box.setPrefHeight(EditAxis.DEFAULT_PREFERRED_HEIGHT);
    }

    box.getChildren().add(getMinMaxButtons(axis, isHorizontal, true));
    // add lower-bound text field
    box.getChildren().add(getBoundField(axis, isHorizontal));

    box.getChildren().add(createSpacer());

    box.getChildren().add(getLogCheckBoxes(axis));
    box.getChildren().add(getRangeChangeButtons(axis, isHorizontal));
    box.getChildren().add(getAutoRangeCheckBoxes(axis));

    box.getChildren().add(createSpacer());

    // add upper-bound text field
    box.getChildren().add(getBoundField(axis, !isHorizontal));

    box.getChildren().add(getMinMaxButtons(axis, isHorizontal, false));
}
 
Example 3
Source File: ShowSplitPane.java    From oim-fx with MIT License 5 votes vote down vote up
private void updateHeight(Pane stage, double value) {
	// double max = stage.getMaxHeight();
	// double min = stage.getMinHeight();
	if ((minBottom <= value && value <= (rootHeight - minTop))) {
		stage.setPrefHeight(value);
	}
}
 
Example 4
Source File: ItemAirBaseController.java    From logbook-kai with MIT License 5 votes vote down vote up
@Override
protected void updateItem(Integer alv, boolean empty) {
    super.updateItem(alv, empty);
    if (!empty && alv != null && alv > 0) {
        URL url = PluginServices.getResource("logbook/gui/alv" + alv + ".png");
        Pane pane = new StackPane(new ImageView(url.toString()));
        pane.setPrefWidth(16);
        pane.setPrefHeight(16);
        this.setGraphic(pane);
    } else {
        this.setGraphic(null);
        this.setText(null);
    }
}
 
Example 5
Source File: ItemItemController.java    From logbook-kai with MIT License 5 votes vote down vote up
@Override
protected void updateItem(Integer alv, boolean empty) {
    super.updateItem(alv, empty);
    if (!empty && alv != null && alv > 0) {
        URL url = PluginServices.getResource("logbook/gui/alv" + alv + ".png");
        Pane pane = new StackPane(new ImageView(url.toString()));
        pane.setPrefWidth(16);
        pane.setPrefHeight(16);
        this.setGraphic(pane);
    } else {
        this.setGraphic(null);
        this.setText(null);
    }
}
 
Example 6
Source File: ChatSplitPane.java    From oim-fx with MIT License 4 votes vote down vote up
private void updateHeight(Pane stage, double value) {
	if ((minBottom <= value && value <= (rootHeight - minTop))) {
		stage.setPrefHeight(value);
	}
}
 
Example 7
Source File: DragIcon.java    From java_fx_node_link_demo with The Unlicense 4 votes vote down vote up
public void setType (DragIconType type) {
	
	mType = type;
	
	getStyleClass().clear();
	getStyleClass().add("dragicon");
	
	//added because the cubic curve will persist into other icons
	if (this.getChildren().size() > 0)
		getChildren().clear();
	
	switch (mType) {
	
	case cubic_curve:
		getStyleClass().add("icon-yellow");
		
		Pane  pane = new Pane();
		
		pane.setPrefWidth(64.0);
		pane.setPrefHeight(64.0);
		//pane.getStyleClass().add("icon-blue");
		pane.setLayoutX(0.0);
		pane.setLayoutY(0.0);
		
		CubicCurve curve = new CubicCurve();
		
		curve.setStartX(10.0);
		curve.setStartY(20.0);
		curve.setEndX(54.0);
		curve.setEndY(44.0);
		curve.setControlX1(64.0);
		curve.setControlY1(20.0);
		curve.setControlX2(0.0);
		curve.setControlY2(44.0);
		curve.getStyleClass().add("cubic-icon");
		
		pane.getChildren().add(curve);
		
		//r//oot_pane.
		getChildren().add(pane);
		
	break;
	
	case blue:
		getStyleClass().add("icon-blue");
	break;

	case red:
		getStyleClass().add("icon-red");			
	break;

	case green:
		getStyleClass().add("icon-green");
	break;

	case grey:
		getStyleClass().add("icon-grey");
	break;

	case purple:
		getStyleClass().add("icon-purple");
	break;

	case yellow:
		getStyleClass().add("icon-yellow");
	break;

	case black:
		getStyleClass().add("icon-black");
	break;
	
	default:
	break;
	}
}
 
Example 8
Source File: DockUIPanel.java    From AnchorFX with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void buildNode(String title, Image iconImage) {

        Objects.requireNonNull(iconImage);
        Objects.requireNonNull(title);
        
        barPanel = new Pane();

        String titleBarStyle = (!subStationStype) ? "docknode-title-bar" : "substation-title-bar";

        barPanel.getStyleClass().add(titleBarStyle);

        barPanel.setPrefHeight(BAR_HEIGHT);
        barPanel.relocate(0, 0);
        barPanel.prefWidthProperty().bind(widthProperty());

        titleLabel = new Label(title);

        String titleTextStyle = (!subStationStype) ? "docknode-title-text" : "substation-title-text";
        
        iconView = new ImageView(iconImage);
        iconView.setFitWidth(15);
        iconView.setFitHeight(15);
        iconView.setPreserveRatio(false);
        iconView.setSmooth(true);
        iconView.relocate(1,(BAR_HEIGHT-iconView.getFitHeight()) / 2);
         
        titleLabel.getStyleClass().add(titleTextStyle);
        barPanel.getChildren().addAll(iconView,titleLabel);
        titleLabel.relocate(25, 5);

        contentPanel = new StackPane();
        contentPanel.getStyleClass().add("docknode-content-panel");
        contentPanel.relocate(0, BAR_HEIGHT);
        contentPanel.prefWidthProperty().bind(widthProperty());
        contentPanel.prefHeightProperty().bind(heightProperty().subtract(BAR_HEIGHT));
        contentPanel.getChildren().add(nodeContent);
        
        contentPanel.setCache(true);
        contentPanel.setCacheHint(CacheHint.SPEED);
        
        if (nodeContent instanceof Pane)
        {
            Pane nodeContentPane = (Pane)nodeContent;
            nodeContentPane.setMinHeight(USE_COMPUTED_SIZE);
            nodeContentPane.setMinWidth(USE_COMPUTED_SIZE);
            nodeContentPane.setMaxWidth(USE_COMPUTED_SIZE);
            nodeContentPane.setMaxHeight(USE_COMPUTED_SIZE);
        }

        getChildren().addAll(barPanel, contentPanel);
    }