Java Code Examples for javafx.scene.layout.HBox#setMaxWidth()

The following examples show how to use javafx.scene.layout.HBox#setMaxWidth() . 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: TracesTab.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
private void createDetailSection()
{
    final Label label = new Label(Messages.FormulaLabel);
    HBox.setHgrow(formula_txt, Priority.ALWAYS);
    formula_txt.setEditable(false);
    formula_txt.setOnMousePressed(event ->
    {
        final ModelItem item = trace_table.getSelectionModel().getSelectedItem();
        if (item instanceof FormulaItem)
        {
            final FormulaItem fitem = (FormulaItem) item;
            if (FormulaItemEditor.run(formula_txt, fitem, undo))
                Platform.runLater(() -> formula_txt.setText(fitem.getExpression()));
        }
    });
    final HBox row = new HBox(5, label, formula_txt);
    row.setAlignment(Pos.CENTER_LEFT);
    row.setMaxWidth(Double.MAX_VALUE);
    row.setPadding(new Insets(5));
    final Region filler = new Region();
    VBox.setVgrow(filler, Priority.ALWAYS);
    formula_pane = new VBox(row, filler);
}
 
Example 2
Source File: DaoLaunchWindow.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void createSlideControls() {
    sectionButtonsGroup = new ToggleGroup();

    HBox slideButtons = new HBox();
    slideButtons.setMaxWidth(616);
    slideButtons.getStyleClass().add("dao-launch-tab-box");

    sections.forEach(section -> {
        SectionButton sectionButton = new SectionButton(section.title.toUpperCase(), sections.indexOf(section));
        sectionButton.setMaxWidth(Double.MAX_VALUE);
        HBox.setHgrow(sectionButton, Priority.ALWAYS);
        slideButtons.getChildren().add(sectionButton);
    });

    sectionButtonsGroup.getToggles().get(0).setSelected(true);

    GridPane.setRowIndex(slideButtons, ++rowIndex);
    GridPane.setColumnSpan(slideButtons, 2);
    GridPane.setHalignment(slideButtons, HPos.CENTER);
    GridPane.setHgrow(slideButtons, Priority.NEVER);
    gridPane.getChildren().add(slideButtons);
}
 
Example 3
Source File: Styler.java    From Maus with GNU General Public License v3.0 5 votes vote down vote up
public static HBox hContainer(int spacing, Node... nodes) {
    HBox hBox = new HBox(spacing);
    HBox.setHgrow(hBox, Priority.ALWAYS);
    hBox.setMaxWidth(Double.MAX_VALUE);
    for (Node r : nodes) {
        hBox.getChildren().add(r);
    }
    return hBox;
}
 
Example 4
Source File: Styler.java    From Maus with GNU General Public License v3.0 5 votes vote down vote up
public static HBox hContainer(Node... nodes) {
    HBox hBox = new HBox();
    HBox.setHgrow(hBox, Priority.ALWAYS);
    hBox.setMaxWidth(Double.MAX_VALUE);
    for (Node r : nodes) {
        hBox.getChildren().add(r);
    }
    return hBox;
}
 
Example 5
Source File: PanelMenuBar.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private HBox createNameArea() {
    HBox nameArea = new HBox();

    nameText = new Text(panelName);
    nameText.setId(IdGenerator.getPanelNameAreaId(panel.panelIndex));
    nameText.setWrappingWidth(NAME_DISPLAY_WIDTH);

    nameBox = new HBox();
    nameBox.getChildren().add(nameText);
    nameBox.setMinWidth(NAME_DISPLAY_WIDTH);
    nameBox.setMaxWidth(NAME_DISPLAY_WIDTH);
    nameBox.setAlignment(Pos.CENTER_LEFT);

    nameBox.setOnMouseClicked(mouseEvent -> {
        if (mouseEvent.getButton().equals(MouseButton.PRIMARY)
                && mouseEvent.getClickCount() == 2) {

            mouseEvent.consume();
            activateInplaceRename();
        }
    });
    Tooltip.install(nameArea, new Tooltip("Double click to edit the name of this panel"));

    nameArea.getChildren().add(nameBox);
    nameArea.setMinWidth(NAME_AREA_WIDTH);
    nameArea.setMaxWidth(NAME_AREA_WIDTH);
    nameArea.setPadding(new Insets(0, 10, 0, 5));
    return nameArea;
}
 
Example 6
Source File: SelectionStripSkin.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor for all SkinBase instances.
 *
 * @param strip The strip for which this Skin should attach to.
 */
public SelectionStripSkin(SelectionStrip<T> strip) {
  super(strip);

  content = new HBox();
  content.setMinWidth(Region.USE_PREF_SIZE);
  content.setMaxWidth(Double.MAX_VALUE);
  content.setAlignment(Pos.CENTER_LEFT);

  leftBtn = new Region();
  leftBtn.getStyleClass().addAll("scroller", "left");
  leftBtn.setOpacity(0);
  leftBtn.setVisible(false);

  rightBtn = new Region();
  rightBtn.getStyleClass().addAll("scroller", "right");
  rightBtn.setOpacity(0);
  rightBtn.setVisible(false);

  leftFader = new Region();
  leftFader.setMouseTransparent(true);
  leftFader.getStyleClass().addAll("fader", "left");
  leftFader.setOpacity(0);

  rightFader = new Region();
  rightFader.setMouseTransparent(true);
  rightFader.getStyleClass().addAll("fader", "right");
  rightFader.setOpacity(0);

  getChildren().addAll(content, leftFader, rightFader, leftBtn, rightBtn);
  getChildren().forEach(child -> child.setManaged(false));

  Rectangle clip = new Rectangle();
  clip.widthProperty().bind(strip.widthProperty());
  clip.heightProperty().bind(strip.heightProperty());
  getSkinnable().setClip(clip);

  setupListeners();
  setupBindings();
  setupEventHandlers();

  strip.itemsProperty().addListener((Observable it) -> buildContent());
  buildContent();
}
 
Example 7
Source File: MainLayout.java    From redtorch with MIT License 4 votes vote down vote up
private void createLayout() {

		vBox.getChildren().add(crearteMainMenuBar());
		// 左右切分布局------------------------
		SplitPane horizontalSplitPane = new SplitPane();
		horizontalSplitPane.setDividerPositions(0.5);
		vBox.getChildren().add(horizontalSplitPane);
		VBox.setVgrow(horizontalSplitPane, Priority.ALWAYS);

		// 左右切分布局----左侧上下切分布局---------
		SplitPane leftVerticalSplitPane = new SplitPane();
		leftVerticalSplitPane.setDividerPositions(0.4);
		horizontalSplitPane.getItems().add(leftVerticalSplitPane);
		leftVerticalSplitPane.setOrientation(Orientation.VERTICAL);
		// 左右切分布局----左侧上下切分布局----上布局-----
		SplitPane leftTopHorizontalSplitPane = new SplitPane();
		leftVerticalSplitPane.getItems().add(leftTopHorizontalSplitPane);

		HBox leftTopRithtPane = new HBox();
		Node orderPanelLayoutNode = orderPanelLayout.getNode();
		HBox.setHgrow(orderPanelLayoutNode, Priority.ALWAYS);

		ScrollPane marketDetailsScrollPane = new ScrollPane();
		Node marketDetailsNode = marketDetailsLayout.getNode();
		marketDetailsScrollPane.setContent(marketDetailsNode);
		marketDetailsScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
		marketDetailsScrollPane.setPrefWidth(253);
		marketDetailsScrollPane.setMinWidth(253);
		marketDetailsScrollPane.setMaxWidth(253);
		leftTopRithtPane.getChildren().addAll(marketDetailsScrollPane, orderPanelLayoutNode);
		leftTopRithtPane.setMaxWidth(680);
		leftTopRithtPane.setPrefWidth(680);

		leftTopHorizontalSplitPane.getItems().addAll(tickLayout.getNode(), leftTopRithtPane);
		SplitPane.setResizableWithParent(leftTopRithtPane, false);

		// 左右切分布局----左侧上下切分布局----下布局-----
		TabPane leftBootomTabPane = new TabPane();
		leftVerticalSplitPane.getItems().add(leftBootomTabPane);

		Tab orderTab = new Tab("定单");
		leftBootomTabPane.getTabs().add(orderTab);
		orderTab.setClosable(false);

		orderTab.setContent(orderLayout.getNode());

		Tab tradeTab = new Tab("成交");
		leftBootomTabPane.getTabs().add(tradeTab);
		tradeTab.setClosable(false);

		tradeTab.setContent(tradeLayout.getNode());

		// 左右切分布局----右侧TAB布局-------------
		TabPane rightTabPane = new TabPane();
		horizontalSplitPane.getItems().add(rightTabPane);

		Tab portfolioInvestmentTab = new Tab("投资组合");
		rightTabPane.getTabs().add(portfolioInvestmentTab);
		portfolioInvestmentTab.setClosable(false);

		SplitPane portfolioVerticalSplitPane = new SplitPane();
		portfolioInvestmentTab.setContent(portfolioVerticalSplitPane);
		portfolioVerticalSplitPane.setOrientation(Orientation.VERTICAL);
		VBox.setVgrow(portfolioVerticalSplitPane, Priority.ALWAYS);

		VBox portfolioVBox = new VBox();
		portfolioVBox.getChildren().add(combinationLayout.getNode());

		portfolioVBox.getChildren().add(accountLayout.getNode());

		VBox.setVgrow(accountLayout.getNode(), Priority.ALWAYS);

		portfolioVerticalSplitPane.getItems().add(portfolioVBox);

		portfolioVerticalSplitPane.getItems().add(positionLayout.getNode());

		Tab allContractTab = new Tab("全部合约");
		allContractTab.setContent(contractLayout.getNode());
		rightTabPane.getTabs().add(allContractTab);
		allContractTab.setClosable(false);

		// 状态栏------------------------------
		vBox.getChildren().add(createStatusBar());
	}