public void start(Stage primaryStage) { canvas = new GridPane(); canvas.setPrefSize(800,800); canvas.setGridLinesVisible(true); final int numCols = 9 ; final int numRows = 8 ; for (int i = 0; i < numCols; i++) { ColumnConstraints colConst = new ColumnConstraints(); colConst.setPercentWidth(100.0 / numCols); canvas.getColumnConstraints().add(colConst); } for (int i = 0; i < numRows; i++) { RowConstraints rowConst = new RowConstraints(); rowConst.setPercentHeight(100.0 / numRows); canvas.getRowConstraints().add(rowConst); } scene = new Scene(canvas, 800, 800); primaryStage.setScene(scene); bubble = new Bubble(scene); primaryStage.show(); scene.setFill(createGridPattern()); }
private GridPane createGrid() { //-------------------------------------------------------------------- Grid GRID.setHgap(GRID_GAP); GRID.setVgap(GRID_GAP); GRID.setPadding(new Insets(GRID_GAP)); GRID.setGridLinesVisible(false); //-------------------------------------------------------------------- Constraints for (int i = 0; i < 2; i++) { final ColumnConstraints column = new ColumnConstraints(); column.setFillWidth(true); column.setHgrow(Priority.NEVER); GRID.getColumnConstraints().add(column); } GRID.getColumnConstraints().get(1).setHgrow(Priority.SOMETIMES); //-------------------------------------------------------------------- End return GRID; }
public static void loadSousMoment(MomentExpVBox mev,Main main){ if(mev.getChildren().size() == 1){ mev.getChildren().add(mev.getSousMomentPane()); } for (MomentExperience m: mev.getMoment().getSousMoments()) { MomentExpVBox tmp = new MomentExpVBox(main); tmp.setMoment(m); tmp.showMoment(); tmp.LoadMomentData(); ColumnConstraints c = new ColumnConstraints(); mev.getSousMomentPane().getColumnConstraints().add(c); mev.getSousMomentPane().add(tmp,mev.getSousMomentPane().getColumnConstraints().size()-1,0); MainViewTransformations.addMomentExpBorderPaneListener(tmp, main); loadTypes(tmp,main); loadSousMoment(tmp, main); } }
@Override public void execute() { momentExpPane.showMoment(); main.getCurrentDescription().addMomentExp(momentExpPane.getMoment()); if(momentExpPane.getCol() == main.getCurrentDescription().getNumberCols()-1){ MomentExpVBox mb = new MomentExpVBox(main, true); MainViewTransformations.addMomentExpBorderPaneListener(mb, main); ColumnConstraints c = new ColumnConstraints(); c.setMinWidth(180); c.setPrefWidth(Control.USE_COMPUTED_SIZE); c.setMaxWidth(Control.USE_COMPUTED_SIZE); // add a new col and the borderPane main.getGrid().getColumnConstraints().add(c); main.getGrid().add(mb,main.getCurrentDescription().getNumberCols(), 0); // increase the number of col by one main.getCurrentDescription().setNumberCols(main.getCurrentDescription().getNumberCols()+1); } main.needToSave(); }
/** * Creates the node used for the body part of each cell. * * In this default implementation the body consists of a grid pane with * three columns. The middle column is used for showing the title of * calendar entries. This column will get whatever space is left after * the icon and the time column have used what they need. This means * that a very long title will automatically be truncated. * * @return the body node */ protected Node createBody() { // icon column ColumnConstraints iconColumn = new ColumnConstraints(); // title column ColumnConstraints descriptionColumn = new ColumnConstraints(); descriptionColumn.setFillWidth(true); descriptionColumn.setHgrow(Priority.SOMETIMES); descriptionColumn.setMinWidth(0); descriptionColumn.setPrefWidth(0); // time column ColumnConstraints timeColumn = new ColumnConstraints(); timeColumn.setHalignment(HPos.RIGHT); gridPane = new GridPane(); gridPane.setGridLinesVisible(true); gridPane.setMinWidth(0); gridPane.setPrefWidth(0); gridPane.getStyleClass().add(AGENDA_VIEW_BODY); gridPane.getColumnConstraints().addAll(iconColumn, descriptionColumn, timeColumn); return gridPane; }
public void start(Stage primaryStage) { canvas = new GridPane(); canvas.setPrefSize(1300,741); canvas.setGridLinesVisible(false); final int numCols = 13 ; final int numRows = 13 ; for (int i = 0; i < numCols; i++) { ColumnConstraints colConst = new ColumnConstraints(); colConst.setPercentWidth(100.0 / numCols); canvas.getColumnConstraints().add(colConst); } for (int i = 0; i < numRows; i++) { RowConstraints rowConst = new RowConstraints(); rowConst.setPercentHeight(100.0 / numRows); canvas.getRowConstraints().add(rowConst); } scene = new Scene(canvas); primaryStage.setScene(scene); //primaryStage.sizeToScene(); //primaryStage.setFullScreen(true); primaryStage.show(); scene.setFill(createGridPattern()); }
private void makeGrid() { myGrid = new GridPane(); myGrid.setMaxHeight(getScreenHeight()); myGrid.setMaxWidth(getScreenWidth()); for (int i = 0; i < getNumRows(); i++) { RowConstraints row = new RowConstraints(getScreenHeight()/getNumRows()); myGrid.getRowConstraints().add(row); } for (int j = 0; j < getNumCols(); j++) { ColumnConstraints col = new ColumnConstraints(getScreenWidth()/getNumCols()); myGrid.getColumnConstraints().add(col); } for (int i = 0; i < getNumRows(); i++) { for (int j = 0; j < getNumCols(); j++) { myGrid.add(new Rectangle(CELL_SIZE, CELL_SIZE, Color.WHITESMOKE), j, i); } } this.getChildren().clear(); this.getChildren().add(myGrid); }
public CannotReadPrompt(Consumer<String> directoryOpener, Runnable focusTrigger) { super(); this.directoryOpener = directoryOpener; this.focusTrigger = focusTrigger; // if invisible, also remove from layout this.managedProperty().bind(this.visibleProperty()); this.setVisible(false); this.setVgap(SPACING / 2); this.setHgap(SPACING / 2); ColumnConstraints colConstraints = new ColumnConstraints(); colConstraints.setPercentWidth(50); this.getColumnConstraints().addAll(colConstraints, colConstraints); initUI(); }
/** * Sets constraints of the columns and rows of the grid pane. */ private void sector () { gameDisplayProperties = VoogaBundles.GameDisplayProperties; ColumnConstraints leftColumn = new ColumnConstraints(); leftColumn.setPercentWidth(getConstraint("leftColConstraints")); ColumnConstraints rightColumn = new ColumnConstraints(); rightColumn.setPercentWidth(getConstraint("rightColConstraints")); RowConstraints topRow = new RowConstraints(); topRow.setPercentHeight(getConstraint("topRowConstraints")); RowConstraints middleRow = new RowConstraints(); middleRow.setPercentHeight(getConstraint("middleRowConstraints")); RowConstraints bottomRow = new RowConstraints(); bottomRow.setPercentHeight(getConstraint("bottomRowConstraints")); this.getColumnConstraints().addAll(leftColumn, rightColumn); this.getRowConstraints().addAll(topRow, middleRow, bottomRow); }
private void initGridPane() { List<NodeDescriptor> nodes = puzzle.getNodeDescriptors(); int gridRows = nodes.stream() .mapToInt(NodeDescriptor::getRow) .max().getAsInt(), gridCols = nodes.stream() .mapToInt(NodeDescriptor::getColumn) .max().getAsInt(); for (int i = 0; i < gridRows; ++i) { sourceCodeGridPane.getRowConstraints().add(new RowConstraints(300)); } for (int i = 0; i < gridCols; ++i) { sourceCodeGridPane.getColumnConstraints().add(new ColumnConstraints(300)); } }
/** * Constructs a new {@link BuildWallConfigurationPanelImpl}. * @param configuration the {@link BuildWallConfiguration} to configure. * @param title the title of the panel. */ public BuildWallConfigurationPanelImpl( String title, BuildWallConfiguration configuration ) { this.configuration = configuration; this.styling = new JavaFxStyle(); constructTitle( title ); constructDimensions(); constructJobPoliciesPane(); constructFontItemPane(); constructColourItemPane(); ColumnConstraints width = new ColumnConstraints(); width.setPercentWidth( 100 ); width.setHgrow( Priority.ALWAYS ); getColumnConstraints().addAll( width ); }
/** * Creates the 5 different panels that are used to hold different windows of * the program */ private void establishGridPane() { grid = new GridPane(); ColumnConstraints leftColumn = new ColumnConstraints(); leftColumn.setPercentWidth(COL70); ColumnConstraints rightColumn = new ColumnConstraints(); rightColumn.setPercentWidth(COL30); grid.getColumnConstraints().addAll(leftColumn, rightColumn); for (int i = 0; i < 24; i++) { RowConstraints row = new RowConstraints(); row.setPercentHeight(TWENTY_FOURTH); grid.getRowConstraints().add(row); } List<Region> windows = Arrays.asList(variables, methods, history, console); for (Region window : windows) { windowsShowing.put(window.getClass().toString(), new Pair<Region, Boolean>(window, true)); } setTopLeft(tabify(graphicsWindow, false)); setBottomLeft(tabify(displayedEditor, false)); setRightPanels(windowsShowing); }
/** * Create a GridPane containing columns that resize similarly to Swing's GridLayout(), * where controls have their widths bound to their parent. * * @param nodes * @return */ public static GridPane createColumnGridControls(final Node... nodes) { GridPane pane = new GridPane(); int n = nodes.length; double maxMinWidth = 0; for (int i = 0; i < n; i++) { ColumnConstraints col = new ColumnConstraints(); col.setPercentWidth(100.0/n); pane.getColumnConstraints().add(col); Node node = nodes[i]; pane.add(node, i, 0); if (node instanceof Control) { maxMinWidth = Math.max(maxMinWidth, ((Control)node).getPrefWidth()); ((Control)node).prefWidthProperty().bind(pane.widthProperty().divide(n)); } } RowConstraints row = new RowConstraints(); row.setPercentHeight(100); pane.getRowConstraints().add(row); pane.setMinWidth(maxMinWidth * n); pane.setPrefWidth(maxMinWidth * n); return pane; }
/** * Create a GridPane containing columns that resize similarly to Swing's GridLayout(), * while also resizing contained objects to have the corresponding widths. * * @param nodes * @return */ public static GridPane createRowGridControls(final Node... nodes) { GridPane pane = new GridPane(); int n = nodes.length; for (int i = 0; i < n; i++) { RowConstraints row = new RowConstraints(); row.setPercentHeight(100.0/n); pane.getRowConstraints().add(row); Node node = nodes[i]; pane.add(node, 0, i); if (node instanceof Control) { // ((Control)node).setMinSize(((Control) node).getPrefWidth(), ((Control) node).getPrefHeight()); ((Control)node).prefWidthProperty().bind(pane.widthProperty()); } } ColumnConstraints col = new ColumnConstraints(); col.setPercentWidth(100); pane.getColumnConstraints().add(col); return pane; }
/** * Binds the width properties to the GridPane width. * * @param controls * @return */ public static GridPane createColumnGridControls(final Control... controls) { GridPane pane = new GridPane(); int n = controls.length; for (int i = 0; i < n; i++) { ColumnConstraints col = new ColumnConstraints(); col.setPercentWidth(100.0/n); pane.getColumnConstraints().add(col); Control control = controls[i]; pane.add(control, i, 0); control.prefWidthProperty().bind(pane.widthProperty().divide(n)); } RowConstraints row = new RowConstraints(); row.setPercentHeight(100); pane.getRowConstraints().add(row); return pane; }
private void configureGrid() { grid.setHgap(10); grid.setVgap(4); grid.setPadding(new Insets(0, 10, 0, 10)); ColumnConstraints column1 = new ColumnConstraints(32); ColumnConstraints column2 = new ColumnConstraints(USE_COMPUTED_SIZE , USE_COMPUTED_SIZE, Double.MAX_VALUE); column2.setHgrow(Priority.NEVER); ColumnConstraints column3 = new ColumnConstraints(30 , 50 , Double.MAX_VALUE); column3.setHgrow(Priority.ALWAYS); column3.setFillWidth(true); ColumnConstraints column4 = new ColumnConstraints(USE_COMPUTED_SIZE , USE_COMPUTED_SIZE , Double.MAX_VALUE); column4.setHgrow(Priority.NEVER); ColumnConstraints column5 = new ColumnConstraints(30 , 50 , Double.MAX_VALUE); column5.setHgrow(Priority.ALWAYS); column5.setFillWidth(true); ColumnConstraints column6 = new ColumnConstraints(10, 12, 16); column6.setHgrow(Priority.NEVER); column6.setFillWidth(false); grid.getColumnConstraints().addAll(column1, column2, column3, column4, column5, column6); }
private void createMetadata() { metadata = new VBox(); metadata.getStyleClass().add(Constants.CSS_INSPECTIONPART); VBox.setVgrow(metadata, Priority.ALWAYS); metadataGrid = new GridPane(); metadataGrid.setVgap(5); metadataGrid.setPadding(new Insets(5, 5, 5, 5)); metadataGrid.setStyle(ConfigurationManager.getStyle(Constants.CSS_BACKGROUNDWHITE)); ColumnConstraints column1 = new ColumnConstraints(); column1.setPercentWidth(25); ColumnConstraints column2 = new ColumnConstraints(); column2.setPercentWidth(75); metadataGrid.getColumnConstraints().addAll(column1, column2); metadataFormWrapper = new ScrollPane(); metadataFormWrapper.setContent(metadataGrid); metadataFormWrapper.setFitToWidth(true); createMetadataHelp(); createMetadataTop(); createMetadataTextBox(); metadata.getChildren().addAll(metadataTopBox, metaText); }
@Override public void createPane() { this.setHgap(10); this.setVgap(10); ColumnConstraints firstColumnConstrains = new ColumnConstraints(); ColumnConstraints secondColumnConstrains = new ColumnConstraints(); firstColumnConstrains.setPercentWidth(FIRST_COLUMN_PERCENT_WIDTH); secondColumnConstrains.setPercentWidth(SECOND_COLUMN_PERCENT_WIDTH); secondColumnConstrains.setHgrow(Priority.ALWAYS); this.getColumnConstraints().addAll(firstColumnConstrains, secondColumnConstrains); this.addRow(0, projectNameLabel, projectNameField); this.addRow(1, projectPathLabel, new HBox(projectPathField, pathChooserButton)); this.addRow(2, startDateLabel, startDatePicker); this.addRow(3, finishDateLabel, finishDatePicker); this.addRow(4, descriptionLabel, descriptionTextArea); HBox.setHgrow(projectPathField, Priority.ALWAYS); GridPane.setMargin(descriptionTextArea, new Insets(0, 0, 10, 0)); GridPane.setValignment(descriptionLabel, VPos.TOP); startDatePicker.setPrefWidth(350); finishDatePicker.setPrefWidth(350); descriptionTextArea.setPrefHeight(200); }
@Override public void createPane() { ColumnConstraints firstColumnConstrains = new ColumnConstraints(); ColumnConstraints secondColumnConstrains = new ColumnConstraints(); firstColumnConstrains.setPercentWidth(FIRST_COLUMN_PERCENT_WIDTH); secondColumnConstrains.setPercentWidth(SECOND_COLUMN_PERCENT_WIDTH); secondColumnConstrains.setHgrow(Priority.ALWAYS); this.getColumnConstraints().addAll(firstColumnConstrains, secondColumnConstrains); this.addRow(0, nameLabel, nameField); this.addRow(1, startDateLabel, startDatePicker); this.addRow(2, finishDateLabel, finishDatePicker); this.addRow(3, donePercentLabel, donePercentSlider); this.addRow(4, costLabel, costField); this.addRow(5, descriptionLabel, descriptionTextArea); this.setVgap(10); this.setHgap(10); this.setPadding(new Insets(10)); startDatePicker.setPrefWidth(350); finishDatePicker.setPrefWidth(350); GridPane.setValignment(descriptionLabel, VPos.TOP); }
@Override public void createPane() { ColumnConstraints firstColumnConstrains = new ColumnConstraints(); ColumnConstraints secondColumnConstrains = new ColumnConstraints(); firstColumnConstrains.setPercentWidth(FIRST_COLUMN_PERCENT_WIDTH); secondColumnConstrains.setPercentWidth(SECOND_COLUMN_PERCENT_WIDTH); secondColumnConstrains.setHgrow(Priority.ALWAYS); this.getColumnConstraints().addAll(firstColumnConstrains, secondColumnConstrains); this.addRow(0, nameLabel, nameField); this.addRow(1, emailLabel, emailField); this.addRow(2, resourceTypeLabel, resourceTypeComboBox); this.addRow(3, descriptionLabel, descriptionTextArea); this.setVgap(10); this.setHgap(10); this.setPadding(new Insets(10)); emailField.setPrefWidth(350); resourceTypeComboBox.setPrefWidth(350); GridPane.setValignment(descriptionLabel, VPos.TOP); }
@Override public void createPane() { ColumnConstraints firstColumnConstrains = new ColumnConstraints(); ColumnConstraints secondColumnConstrains = new ColumnConstraints(); firstColumnConstrains.setPercentWidth(FIRST_COLUMN_PERCENT_WIDTH); secondColumnConstrains.setPercentWidth(SECOND_COLUMN_PERCENT_WIDTH); secondColumnConstrains.setHgrow(Priority.ALWAYS); this.getColumnConstraints().addAll(firstColumnConstrains, secondColumnConstrains); this.addRow(0, nameLabel, nameField); this.addRow(1, startDateLabel, startDatePicker); this.addRow(2, finishDateLabel, finishDatePicker); this.addRow(3, descriptionLabel, descriptionTextArea); this.setVgap(10); this.setHgap(10); this.setPadding(new Insets(10)); startDatePicker.setPrefWidth(350); finishDatePicker.setPrefWidth(350); GridPane.setValignment(descriptionLabel, VPos.TOP); }
private Node buildDoubleClickActionsOptionPane() { final ColumnConstraints firstColumn = new ColumnConstraints(); firstColumn.setPercentWidth(40); final GridPane doubleClickOptionsPane = new GridPane(); doubleClickOptionsPane.getColumnConstraints().addAll(firstColumn); doubleClickOptionsPane.setVgap(10); doubleClickOptionsPane.add(new Label("For seeding torrents: "), 0, 0); doubleClickOptionsPane.add(seedingTorrentOptionsComboBox, 1, 0); doubleClickOptionsPane.add(new Label("For downloading torrents: "), 0, 1); doubleClickOptionsPane.add(downloadingTorrentOptionsComboBox, 1, 1); seedingTorrentOptionsComboBox.setMaxWidth(Double.POSITIVE_INFINITY); downloadingTorrentOptionsComboBox.setMaxWidth(Double.POSITIVE_INFINITY); GridPane.setHgrow(seedingTorrentOptionsComboBox, Priority.ALWAYS); GridPane.setHgrow(downloadingTorrentOptionsComboBox, Priority.ALWAYS); return doubleClickOptionsPane; }
private Node buildBasicOptionsPane() { final ColumnConstraints firstColumn = new ColumnConstraints(); final ColumnConstraints secondColumn = new ColumnConstraints(); firstColumn.setPercentWidth(50); secondColumn.setPercentWidth(50); final GridPane basicOptionsPane = new GridPane(); basicOptionsPane.getColumnConstraints().addAll(firstColumn, secondColumn); basicOptionsPane.setVgap(10); basicOptionsPane.add(enableDhtNetworkCheck, 0, 0); basicOptionsPane.add(enableDhtForNewTorrentsCheck, 1, 0); basicOptionsPane.add(enablePexCheck, 0, 1); basicOptionsPane.add(enableLocalPeerDiscoveryCheck, 1, 1); basicOptionsPane.add(enableWebSeedsCheck, 0, 2, 2, 1); return basicOptionsPane; }
private Node buildTrackerOptionsPane() { final ColumnConstraints firstColumn = new ColumnConstraints(); final ColumnConstraints secondColumn = new ColumnConstraints(); firstColumn.setPercentWidth(50); secondColumn.setPercentWidth(50); final GridPane basicOptionsPane = new GridPane(); basicOptionsPane.getColumnConstraints().addAll(firstColumn, secondColumn); basicOptionsPane.setVgap(10); basicOptionsPane.add(scrapeTrackerCheck, 0, 0); basicOptionsPane.add(enableUdpTrackerCheck, 1, 0); basicOptionsPane.add(reportedTrackerIpCheck, 0, 1); basicOptionsPane.add(reportedTrackerIpField, 1, 1); return basicOptionsPane; }
private Node buildThemeOptionsPane() { final ColumnConstraints firstColumn = new ColumnConstraints(); firstColumn.setPercentWidth(40); final GridPane themeOptionsPane = new GridPane(); themeOptionsPane.getColumnConstraints().addAll(firstColumn); themeOptionsPane.setVgap(10); themeOptionsPane.add(new Label("Theme: "), 0, 0); themeOptionsPane.add(themeOptionsComboBox, 1, 0); themeOptionsComboBox.setMaxWidth(Double.POSITIVE_INFINITY); GridPane.setHgrow(themeOptionsComboBox, Priority.ALWAYS); return themeOptionsPane; }
private Node buildQueueSettingsPane() { final GridPane queueSettingsPane = new GridPane(); queueSettingsPane.add(new Label("Maximum number of active torrents (upload or download): "), 0, 0); queueSettingsPane.add(activeTorrentsLimitField, 1, 0); queueSettingsPane.add(new Label("Maximum number of active downloads: "), 0, 1); queueSettingsPane.add(activeDownloadsLimitField, 1, 1); queueSettingsPane.add(new Label("Maximum number of active uploads: "), 0, 2); queueSettingsPane.add(activeUploadsLimitField, 1, 2); final ColumnConstraints firstColumn = new ColumnConstraints(); firstColumn.setHgrow(Priority.ALWAYS); final ColumnConstraints secondColumn = new ColumnConstraints(); secondColumn.setPrefWidth(60); secondColumn.setMinWidth(60); queueSettingsPane.getColumnConstraints().addAll(firstColumn, secondColumn); queueSettingsPane.setVgap(5); return queueSettingsPane; }
/** * Custom cloning of a grid ane * @param gridPane The grid pane to clone * @return Cloned grid ane */ private GridPane cloneGridPane(GridPane gridPane) { GridPane clone = new GridPane(); for (int i = 0; i < gridPane.getColumnConstraints().size(); i++) { clone.getColumnConstraints().add(new ColumnConstraints()); clone.getRowConstraints().add(new RowConstraints()); } //Takes all the CellButtons from the old grid and adds it to the new one for (Node n : gridPane.getChildren()) { CellButton btn = (CellButton) n; CellButton cellBtn = new CellButton(btn.getCoordinate()); cellBtn.setAttachedPlayer(btn.getAttachedPlayer()); clone.add(cellBtn, cellBtn.getCoordinate().column(), cellBtn.getCoordinate().row()); } return clone; }
/** * Initializes the grid pane that was passed in the constructor */ private void initializeGrid() { GRID_PANE.getColumnConstraints().clear(); GRID_PANE.getRowConstraints().clear(); GRID_PANE.setHgap(5); GRID_PANE.setVgap(5); GRID_PANE.setPadding(new Insets(5, 5, 5, 5)); //Adds the columns and rows depending on the grid dimension for (int i = 0; i < GRID_DIMENSION; i++) { GRID_PANE.getColumnConstraints().add(new ColumnConstraints()); GRID_PANE.getRowConstraints().add(new RowConstraints()); } }
/** * Adds a tab to the GUI with the specified gridpane information and title. * @param gridColumns * @param gridRows * @param name * @return */ public Tab addTab(int gridRows, int gridColumns, String name) { TimerTab tab = new TimerTab(name); tab.setClosable(false); GridPane gp = new GridPane(); gp.setHgap(8); gp.setVgap(8); gp.getStyleClass().add("gridPane"); for (int i = 0; i < gridColumns; i++) { ColumnConstraints cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); gp.getColumnConstraints().add(cc); } for (int i = 0; i < gridRows; i++) { RowConstraints rc = new RowConstraints(); rc.setVgrow(Priority.NEVER); gp.getRowConstraints().add(rc); } tab.setContent(gp); tabPane.getTabs().add(tab); gp.getChildren().clear(); return tab; }
public Tab addDefaultTab() { TimerTab tab = new TimerTab(ConfigManager.getInstance().getDefaultTabName()); tab.setClosable(false); GridPane gp = new GridPane(); gp.setHgap(8); gp.setVgap(8); gp.getStyleClass().add("gridPane"); for (int i = 0; i < ConfigManager.getInstance().getDefaultTabColumns(); i++) { ColumnConstraints cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); gp.getColumnConstraints().add(cc); } for (int i = 0; i < ConfigManager.getInstance().getDefaultTabRows(); i++) { RowConstraints rc = new RowConstraints(); rc.setVgrow(Priority.NEVER); gp.getRowConstraints().add(rc); } tab.setContent(gp); tabPane.getTabs().add(tab); gp.getChildren().clear(); return tab; }
/** * Sets the FX constraints. */ private void setConstraints() { // Column 1 has empty constraints. this.getColumnConstraints().add(new ColumnConstraints()); // Column 2 should grow to fill space. ColumnConstraints column2 = new ColumnConstraints(); column2.setHgrow(Priority.ALWAYS); this.getColumnConstraints().add(column2); // Rows 1-4 have empty constraints. this.getRowConstraints().add(new RowConstraints()); this.getRowConstraints().add(new RowConstraints()); this.getRowConstraints().add(new RowConstraints()); this.getRowConstraints().add(new RowConstraints()); // Row 5 should RowConstraints row5 = new RowConstraints(); row5.setVgrow(Priority.ALWAYS); this.getRowConstraints().add(row5); }
private void addOpenClosePricePart(ColumnConstraints titleColumn, ColumnConstraints valueColumn, ColumnConstraints titleColumn2, ColumnConstraints valueColumn2) { GridPane openClosePriceGridPane = new GridPane(); openClosePriceGridPane.setHgap(2); openClosePriceGridPane.getColumnConstraints().addAll(titleColumn, valueColumn, titleColumn2, valueColumn2); TagToggleButton closePriceLabel = new TagToggleButton("����"); closePriceLabel.priceProperty().bind(marketData.closePriceProperty()); openClosePriceGridPane.add(closePriceLabel, 0, 0); PriceToggleButton closePriceValue = new PriceToggleButton(); openClosePriceGridPane.add(closePriceValue, 1, 0); bindMarketPrice(closePriceValue, marketData.closePriceProperty(), marketData.closePriceProperty()); TagToggleButton openPriceLabel = new TagToggleButton("��"); openPriceLabel.priceProperty().bind(marketData.openPriceProperty()); openClosePriceGridPane.add(openPriceLabel, 2, 0); PriceToggleButton openPriceValue = new PriceToggleButton(); bindMarketPrice(openPriceValue, marketData.openPriceProperty(), marketData.closePriceProperty()); openClosePriceGridPane.add(openPriceValue, 3, 0); toggleGroup.getToggles().addAll(closePriceLabel, closePriceValue, openPriceLabel, openPriceValue); getChildren().add(Borders.wrap(openClosePriceGridPane).lineBorder().color(Color.GRAY).innerPadding(0).outerPadding(0).thickness(0, 1, 1, 1).buildAll()); }
private void addDailyLimitPart(ColumnConstraints titleColumn, ColumnConstraints valueColumn, ColumnConstraints titleColumn2, ColumnConstraints valueColumn2) { GridPane dailyLimitGridPane = new GridPane(); dailyLimitGridPane.setHgap(2); dailyLimitGridPane.getColumnConstraints().addAll(titleColumn, valueColumn, titleColumn2, valueColumn2); TagToggleButton nameLabel = new TagToggleButton("��ͣ"); nameLabel.priceProperty().bind(marketData.dailyUpLimitPriceProperty()); dailyLimitGridPane.add(nameLabel, 0, 0); PriceToggleButton priceLabel = new PriceToggleButton(); bindMarketPrice(priceLabel, marketData.dailyUpLimitPriceProperty(), marketData.closePriceProperty()); dailyLimitGridPane.add(priceLabel, 1, 0); TagToggleButton nameLabel2 = new TagToggleButton("��ͣ"); nameLabel2.priceProperty().bind(marketData.dailyDownLimitPriceProperty()); dailyLimitGridPane.add(nameLabel2, 2, 0); PriceToggleButton priceLabel2 = new PriceToggleButton(); bindMarketPrice(priceLabel2, marketData.dailyDownLimitPriceProperty(), marketData.closePriceProperty()); dailyLimitGridPane.add(priceLabel2, 3, 0); toggleGroup.getToggles().addAll(nameLabel, priceLabel); toggleGroup.getToggles().addAll(nameLabel2, priceLabel2); getChildren().add(Borders.wrap(dailyLimitGridPane).lineBorder().color(Color.GRAY).innerPadding(0).outerPadding(0).thickness(0, 1, 0, 1).buildAll()); }
private void initMarketDepthPart() { ColumnConstraints firstColumn = getColumnConstraints(40,HPos.LEFT); ColumnConstraints secondColumn = getColumnConstraints(80,HPos.RIGHT); ColumnConstraints lastColumn = getColumnConstraints(100,HPos.RIGHT); GridPane sellDepthGridPane = getGridPane(firstColumn, secondColumn, lastColumn); addMarketDepthPart(sellDepthGridPane, "����", 0, DepthSide.SELL, 4); addMarketDepthPart(sellDepthGridPane, "����", 1, DepthSide.SELL, 3); addMarketDepthPart(sellDepthGridPane, "����", 2, DepthSide.SELL, 2); addMarketDepthPart(sellDepthGridPane, "����", 3, DepthSide.SELL, 1); addMarketDepthPart(sellDepthGridPane, "����", 4, DepthSide.SELL, 0); getChildren().add(Borders.wrap(sellDepthGridPane).lineBorder().color(Color.GRAY).innerPadding(0).outerPadding(0).buildAll()); GridPane latestPriceGridPane = getGridPane(firstColumn, secondColumn, lastColumn); addLatestPricePart(latestPriceGridPane, "����"); getChildren().add(Borders.wrap(latestPriceGridPane).lineBorder().color(Color.GRAY).innerPadding(0).outerPadding(0).thickness(0, 1, 0, 1).buildAll()); GridPane buyDepthGridPane = getGridPane(firstColumn, secondColumn, lastColumn); addMarketDepthPart(buyDepthGridPane, "���", 0, DepthSide.BUY, 0); addMarketDepthPart(buyDepthGridPane, "���", 1, DepthSide.BUY, 1); addMarketDepthPart(buyDepthGridPane, "���", 2, DepthSide.BUY, 2); addMarketDepthPart(buyDepthGridPane, "���", 3, DepthSide.BUY, 3); addMarketDepthPart(buyDepthGridPane, "���", 4, DepthSide.BUY, 4); getChildren().add(Borders.wrap(buyDepthGridPane).lineBorder().color(Color.GRAY).innerPadding(0).outerPadding(0).buildAll()); }
public Node getEquiCellGrid(){ GridPane grid = new GridPane(); grid.setGridLinesVisible(true); //debug final int numRows = 10; final int numColumns = 6; for(int i = 0; i < numRows; i++) { RowConstraints row = new RowConstraints(); row.setPercentHeight(100/numRows); grid.getRowConstraints().add(row); } for(int i = 0; i < numRows; i++) { ColumnConstraints column = new ColumnConstraints(); column.setPercentWidth(100/numColumns); grid.getColumnConstraints().add(column); } // prevent grid from being resized larger so cells don't grow proportionally grid.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE); grid.addColumn(0, new Rectangle(75,75,Color.BLUE), new Rectangle(100,100,Color.RED)); grid.addRow(0, new Button("Blue"), new Button("Magenta")); return grid; }
private void initializeGrid() { grid.setHgap(10); grid.setVgap(5); grid.setPadding(new Insets(0, 10, 0, 10)); // icon column ColumnConstraints col1 = new ColumnConstraints(); col1.setFillWidth(false); col1.setHgrow(Priority.NEVER); grid.getColumnConstraints().add(col1); // title column: grows ColumnConstraints col2 = new ColumnConstraints(); col2.setFillWidth(true); col2.setHgrow(Priority.ALWAYS); grid.getColumnConstraints().add(col2); // date column ColumnConstraints col3 = new ColumnConstraints(); col3.setFillWidth(false); col3.setHgrow(Priority.NEVER); grid.getColumnConstraints().add(col3); }
@Override public void start(Stage stage) { Matcher.init(); env = new ClassEnvironment(); matcher = new Matcher(env); GridPane border = new GridPane(); ColumnConstraints colConstraint = new ColumnConstraints(); colConstraint.setPercentWidth(50); border.getColumnConstraints().addAll(colConstraint, colConstraint); RowConstraints defaultRowConstraints = new RowConstraints(); RowConstraints contentRowConstraints = new RowConstraints(); contentRowConstraints.setVgrow(Priority.ALWAYS); border.getRowConstraints().addAll(defaultRowConstraints, contentRowConstraints, defaultRowConstraints); MainMenuBar menu = new MainMenuBar(this); components.add(menu); border.add(menu, 0, 0, 2, 1); MatchPaneSrc srcPane = new MatchPaneSrc(this); components.add(srcPane); border.add(srcPane, 0, 1); MatchPaneDst dstPane = new MatchPaneDst(this, srcPane); components.add(dstPane); border.add(dstPane, 1, 1); BottomPane bottomPane = new BottomPane(this, srcPane, dstPane); components.add(bottomPane); border.add(bottomPane, 0, 2, 2, 1); scene = new Scene(border); stage.setScene(scene); stage.setTitle("Matcher"); stage.show(); }
public WebViewPane() { VBox.setVgrow(this, Priority.ALWAYS); setMaxWidth(Double.MAX_VALUE); setMaxHeight(Double.MAX_VALUE); WebView view = new WebView(); view.setMinSize(500, 400); view.setPrefSize(500, 400); final WebEngine eng = view.getEngine(); eng.load("http://www.oracle.com/us/index.html"); final TextField locationField = new TextField("http://www.oracle.com/us/index.html"); locationField.setMaxHeight(Double.MAX_VALUE); Button goButton = new Button("Go"); goButton.setDefaultButton(true); EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { eng.load(locationField.getText().startsWith("http://") ? locationField.getText() : "http://" + locationField.getText()); } }; goButton.setOnAction(goAction); locationField.setOnAction(goAction); eng.locationProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { locationField.setText(newValue); } }); GridPane grid = new GridPane(); grid.setVgap(5); grid.setHgap(5); GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES); GridPane.setConstraints(goButton,1,0); GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS); grid.getColumnConstraints().addAll( new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true), new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true) ); grid.getChildren().addAll(locationField, goButton, view); getChildren().add(grid); }