Java Code Examples for javafx.scene.control.ScrollPane#setFitToHeight()
The following examples show how to use
javafx.scene.control.ScrollPane#setFitToHeight() .
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: CommentBoxVBoxer.java From marathonv5 with Apache License 2.0 | 6 votes |
private Node createTextArea(boolean selectable, boolean editable) { textArea = new TextArea(); textArea.setPrefRowCount(4); textArea.setEditable(editable); textArea.textProperty().addListener((observable, oldValue, newValue) -> { item.setText(textArea.getText()); }); textArea.setText(item.getText()); ScrollPane scrollPane = new ScrollPane(textArea); scrollPane.setFitToWidth(true); scrollPane.setFitToHeight(true); scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS); HBox.setHgrow(scrollPane, Priority.ALWAYS); return scrollPane; }
Example 2
Source File: HistoryListPopup.java From arma-dialog-creator with MIT License | 6 votes |
public HistoryListPopup(@Nullable String popupTitle, @NotNull HistoryListProvider provider) { super(ArmaDialogCreator.getPrimaryStage(), new VBox(5), popupTitle); this.provider = provider; myRootElement.setPadding(new Insets(10)); final ScrollPane scrollPane = new ScrollPane(stackPaneWrapper); VBox.setVgrow(scrollPane, Priority.ALWAYS); scrollPane.setFitToHeight(true); scrollPane.setFitToWidth(true); scrollPane.setStyle("-fx-background-color:transparent"); myRootElement.getChildren().addAll(scrollPane, new Separator(Orientation.HORIZONTAL), getBoundResponseFooter(false, true, false)); gridPaneContent.setVgap(15); gridPaneContent.setHgap(5); ColumnConstraints constraints = new ColumnConstraints(-1, -1, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true); gridPaneContent.getColumnConstraints().addAll(constraints, constraints); myStage.setMinWidth(320); myStage.setMinHeight(320); myStage.setWidth(480); stackPaneWrapper.setPrefHeight(320); fillContent(); }
Example 3
Source File: ProposalDisplay.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
@SuppressWarnings("Duplicates") public ScrollPane getView() { ScrollPane scrollPane = new ScrollPane(); scrollPane.setFitToWidth(true); scrollPane.setFitToHeight(true); AnchorPane anchorPane = new AnchorPane(); scrollPane.setContent(anchorPane); gridPane.setHgap(5); gridPane.setVgap(5); ColumnConstraints columnConstraints1 = new ColumnConstraints(); columnConstraints1.setPercentWidth(100); gridPane.getColumnConstraints().addAll(columnConstraints1); AnchorPane.setBottomAnchor(gridPane, 10d); AnchorPane.setRightAnchor(gridPane, 10d); AnchorPane.setLeftAnchor(gridPane, 10d); AnchorPane.setTopAnchor(gridPane, 10d); anchorPane.getChildren().add(gridPane); return scrollPane; }
Example 4
Source File: FilterWindow.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
public void show() { if (headLine == null) headLine = Res.get("filterWindow.headline"); width = 968; createGridPane(); scrollPane = new ScrollPane(); scrollPane.setContent(gridPane); scrollPane.setFitToWidth(true); scrollPane.setFitToHeight(true); scrollPane.setMaxHeight(1000); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); addHeadLine(); addContent(); applyStyles(); display(); }
Example 5
Source File: LogWindow.java From PDF4Teachers with Apache License 2.0 | 5 votes |
public LogWindow(){ Pane root = new Pane(); Scene scene = new Scene(root, Main.SCREEN_BOUNDS.getWidth()-200 >= 1200 ? 1200 : Main.SCREEN_BOUNDS.getWidth()-200, Main.SCREEN_BOUNDS.getHeight()-200 >= 675 ? 675 : Main.SCREEN_BOUNDS.getHeight()-200); getIcons().add(new Image(getClass().getResource("/logo.png")+"")); setResizable(true); setTitle(TR.tr("PDF4Teachers - Console")); setScene(scene); setOnCloseRequest(e -> { updater.stop(); close(); }); new JMetro(scene, Style.DARK); Pane pane = new Pane(); root.setStyle("-fx-background-color: black;"); ScrollPane scrollPane = new ScrollPane(pane); scrollPane.setStyle("-fx-background-color: black;"); scrollPane.setFitToHeight(true); scrollPane.setFitToWidth(true); scrollPane.prefWidthProperty().bind(scene.widthProperty()); scrollPane.prefHeightProperty().bind(scene.heightProperty()); pane.minHeightProperty().bind(text.heightProperty()); root.getChildren().add(scrollPane); setupUi(pane); show(); }
Example 6
Source File: StringTable.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** Constructor * @param editable Allow user interaction (toolbar, edit), or just display data? */ public StringTable(final boolean editable) { table.setEditable(editable); table.setColumnResizePolicy(TableView.UNCONSTRAINED_RESIZE_POLICY); table.getSelectionModel().setCellSelectionEnabled(true); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); table.getSelectionModel().getSelectedIndices().addListener(this::selectionChanged); table.setPlaceholder(new Label()); if (editable) { // Check for keys in both toolbar and table addEventFilter(KeyEvent.KEY_PRESSED, this::handleKey); } updateStyle(); fillToolbar(); setTop(toolbar); // Scroll if table is larger than its screen space final ScrollPane scroll = new ScrollPane(table); scroll.setFitToWidth(true); scroll.setFitToHeight(true); setCenter(scroll); setData(Arrays.asList()); }
Example 7
Source File: RunTestsJavaFX.java From Lipi with MIT License | 5 votes |
public void testTomlEditor() { //inp = testsFolder + "/tomlConfigTest.toml"; inp = testsFolder + "/tomlConfigTest.toml"; HMDFileProcessor mdObject = new HMDFileProcessor(testsFolder + "/test.md"); mdObject.readHMdFile(); // TomlParser tomlParser = new TomlString(mdObject.getFrontMatter()); String tomlString; try { tomlString = FileHandler.readFile(inp); TomlEditorControl tomlEditor = new TomlEditorControl(tomlString); Button print = new Button("print"); print.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { mdObject.setFrontMatter(tomlEditor.getTomlString()); System.out.println(mdObject.getFrontMatter()); } }); tomlEditor.getChildren().add(print); ScrollPane sp = new ScrollPane(tomlEditor); sp.setFitToHeight(true); pane.getChildren().add(sp); primaryStage.setTitle("Toml Editor"); } catch (IOException e) { ExceptionAlerter.showException(e); } }
Example 8
Source File: MutableOfferView.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
private void addScrollPane() { scrollPane = new ScrollPane(); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setFitToWidth(true); scrollPane.setFitToHeight(true); AnchorPane.setLeftAnchor(scrollPane, 0d); AnchorPane.setTopAnchor(scrollPane, 0d); AnchorPane.setRightAnchor(scrollPane, 0d); AnchorPane.setBottomAnchor(scrollPane, 0d); root.getChildren().add(scrollPane); }
Example 9
Source File: TakeOfferView.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
private void addScrollPane() { scrollPane = new ScrollPane(); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setFitToWidth(true); scrollPane.setFitToHeight(true); AnchorPane.setLeftAnchor(scrollPane, 0d); AnchorPane.setTopAnchor(scrollPane, 0d); AnchorPane.setRightAnchor(scrollPane, 0d); AnchorPane.setBottomAnchor(scrollPane, 0d); root.getChildren().add(scrollPane); }
Example 10
Source File: UI.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
private Parent createRootNode() { VBox top = new VBox(); panelsScrollPane = new ScrollPane(panels); panelsScrollPane.getStyleClass().add("transparent-bg"); panelsScrollPane.setFitToHeight(true); panelsScrollPane.setVbarPolicy(ScrollBarPolicy.NEVER); HBox.setHgrow(panelsScrollPane, Priority.ALWAYS); menuBar = new MenuControl(this, panels, panelsScrollPane, prefs, mainStage); menuBar.setUseSystemMenuBar(true); HBox detailsBar = new HBox(); detailsBar.setAlignment(Pos.CENTER_LEFT); apiBox.getStyleClass().add("text-grey"); apiBox.setTooltip(new Tooltip("Remaining calls / Minutes to next refresh")); detailsBar.getChildren().add(apiBox); top.getChildren().addAll(menuBar, detailsBar); BorderPane root = new BorderPane(); root.setTop(top); root.setCenter(panelsScrollPane); root.setBottom((HTStatusBar) status); notificationPane = new NotificationPane(root); return notificationPane; }
Example 11
Source File: BaseInfoTab.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
BaseInfoTab() { setClosable(false); grid.getStyleClass().add("info-props"); grid.setAlignment(Pos.TOP_CENTER); ColumnConstraints column1 = new ColumnConstraints(); column1.setPercentWidth(25); ColumnConstraints column2 = new ColumnConstraints(); column2.setPercentWidth(75); grid.getColumnConstraints().addAll(column1, column2); ScrollPane scroll = new ScrollPane(grid); scroll.setFitToHeight(true); scroll.setFitToWidth(true); setContent(scroll); }
Example 12
Source File: KeywordsTab.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
KeywordsTab() { VBox content = new VBox(); content.getStyleClass().add("info-props"); setText(DefaultI18nContext.getInstance().i18n("Keywords")); setClosable(false); keywords.setWrapText(true); keywords.getStyleClass().add("info-property-value"); content.getChildren().add(keywords); ScrollPane scroll = new ScrollPane(content); scroll.setFitToHeight(true); scroll.setFitToWidth(true); setContent(scroll); eventStudio().addAnnotatedListeners(this); }
Example 13
Source File: SelectSongsDialog.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create a new imported songs dialog. * <p/> * @param text a list of lines to be shown in the dialog. * @param acceptText text to place on the accpet button. * @param checkboxText text to place in the column header for the * checkboxes. */ public SelectSongsDialog(String[] text, String acceptText, String checkboxText) { initModality(Modality.APPLICATION_MODAL); setTitle(LabelGrabber.INSTANCE.getLabel("select.songs.title")); checkBoxes = new ArrayList<>(); selectAllCheckBox = new CheckBox(); selectAllCheckBox.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) { for(CheckBox checkBox : checkBoxes) { checkBox.setSelected(t1); } } }); VBox mainPanel = new VBox(5); VBox textBox = new VBox(); for(String str : text) { textBox.getChildren().add(new Label(str)); } VBox.setMargin(textBox, new Insets(10)); mainPanel.getChildren().add(textBox); gridPane = new GridPane(); gridPane.setHgap(5); gridPane.setVgap(5); gridScroll = new ScrollPane(); VBox.setVgrow(gridScroll, Priority.ALWAYS); VBox scrollContent = new VBox(10); HBox topBox = new HBox(5); Label checkAllLabel = new Label(LabelGrabber.INSTANCE.getLabel("check.uncheck.all.text")); checkAllLabel.setStyle("-fx-font-weight: bold;"); topBox.getChildren().add(selectAllCheckBox); topBox.getChildren().add(checkAllLabel); scrollContent.getChildren().add(topBox); scrollContent.getChildren().add(gridPane); StackPane intermediatePane = new StackPane(); StackPane.setMargin(scrollContent, new Insets(10)); intermediatePane.getChildren().add(scrollContent); gridScroll.setContent(intermediatePane); gridScroll.setFitToWidth(true); gridScroll.setFitToHeight(true); mainPanel.getChildren().add(gridScroll); addButton = new Button(acceptText, new ImageView(new Image("file:icons/tick.png"))); StackPane stackAdd = new StackPane(); stackAdd.getChildren().add(addButton); VBox.setMargin(stackAdd, new Insets(10)); mainPanel.getChildren().add(stackAdd); Scene scene = new Scene(mainPanel, 800, 600); if (QueleaProperties.get().getUseDarkTheme()) { scene.getStylesheets().add("org/modena_dark.css"); } setScene(scene); }
Example 14
Source File: DiagramTab.java From JetUML with GNU General Public License v3.0 | 4 votes |
/** * Constructs a diagram tab initialized with pDiagram. * @param pDiagram The initial diagram */ public DiagramTab(Diagram pDiagram) { aDiagram = pDiagram; DiagramTabToolBar sideBar = new DiagramTabToolBar(pDiagram); UserPreferences.instance().addBooleanPreferenceChangeHandler(sideBar); aDiagramCanvas = new DiagramCanvas(pDiagram); UserPreferences.instance().addBooleanPreferenceChangeHandler(aDiagramCanvas); aDiagramCanvasController = new DiagramCanvasController(aDiagramCanvas, sideBar, this); aDiagramCanvas.setController(aDiagramCanvasController); aDiagramCanvas.paintPanel(); BorderPane layout = new BorderPane(); layout.setRight(sideBar); // We put the diagram in a fixed-size StackPane for the sole purpose of being able to // decorate it with CSS. The StackPane needs to have a fixed size so the border fits the // canvas and not the parent container. StackPane pane = new StackPane(aDiagramCanvas); final int buffer = 12; // (border insets + border width + 1)*2 pane.setMaxSize(aDiagramCanvas.getWidth() + buffer, aDiagramCanvas.getHeight() + buffer); final String cssDefault = "-fx-border-color: grey; -fx-border-insets: 4;" + "-fx-border-width: 1; -fx-border-style: solid;"; pane.setStyle(cssDefault); // We wrap pane within an additional, resizable StackPane that can grow to fit the parent // ScrollPane and thus center the decorated canvas. ScrollPane scroll = new ScrollPane(new StackPane(pane)); // The call below is necessary to removes the focus highlight around the Canvas // See issue #250 scroll.setStyle("-fx-focus-color: transparent; -fx-faint-focus-color: transparent;"); scroll.setFitToWidth(true); scroll.setFitToHeight(true); layout.setCenter(scroll); setTitle(); setContent(layout); setOnCloseRequest(pEvent -> { pEvent.consume(); EditorFrame editorFrame = (EditorFrame) getTabPane().getParent(); editorFrame.close(this); }); }
Example 15
Source File: TradeStepView.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
protected TradeStepView(PendingTradesViewModel model) { this.model = model; preferences = model.dataModel.preferences; trade = model.dataModel.getTrade(); checkNotNull(trade, "Trade must not be null at TradeStepView"); ScrollPane scrollPane = new ScrollPane(); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); scrollPane.setFitToHeight(true); scrollPane.setFitToWidth(true); AnchorPane.setLeftAnchor(scrollPane, 10d); AnchorPane.setRightAnchor(scrollPane, 10d); AnchorPane.setTopAnchor(scrollPane, 10d); AnchorPane.setBottomAnchor(scrollPane, 0d); getChildren().add(scrollPane); gridPane = new GridPane(); gridPane.setHgap(Layout.GRID_GAP); gridPane.setVgap(Layout.GRID_GAP); ColumnConstraints columnConstraints1 = new ColumnConstraints(); columnConstraints1.setHgrow(Priority.ALWAYS); ColumnConstraints columnConstraints2 = new ColumnConstraints(); columnConstraints2.setHgrow(Priority.ALWAYS); gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2); scrollPane.setContent(gridPane); AnchorPane.setLeftAnchor(this, 0d); AnchorPane.setRightAnchor(this, 0d); AnchorPane.setTopAnchor(this, -10d); AnchorPane.setBottomAnchor(this, 0d); addContent(); errorMessageListener = (observable, oldValue, newValue) -> { if (newValue != null) new Popup().error(newValue).show(); }; clockListener = new ClockWatcher.Listener() { @Override public void onSecondTick() { } @Override public void onMinuteTick() { updateTimeLeft(); } }; }
Example 16
Source File: FeatureTable.java From sis with Apache License 2.0 | 4 votes |
public FeatureTable(Resource res, int i) throws DataStoreException { TableView<AbstractFeature> ttv = new TableView<>(); final ScrollPane scroll = new ScrollPane(ttv); scroll.setFitToHeight(true); scroll.setFitToWidth(true); ttv.setColumnResizePolicy(TableView.UNCONSTRAINED_RESIZE_POLICY); ttv.setTableMenuButtonVisible(true); ttv.setFixedCellSize(100); scroll.setPrefSize(600, 400); scroll.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); setCenter(scroll); final List<AbstractFeature> list; if (res instanceof FeatureSet) { try (Stream<AbstractFeature> stream = ((FeatureSet) res).features(false)) { list = stream.collect(Collectors.toList()); ttv.setItems(FXCollections.observableArrayList(list)); for (AbstractIdentifiedType pt : list.get(0).getType().getProperties(false)) { final TableColumn<AbstractFeature, BorderPane> column = new TableColumn<>(generateFinalColumnName(pt)); column.setCellValueFactory((TableColumn.CellDataFeatures<AbstractFeature, BorderPane> param) -> { final Object val = param.getValue().getPropertyValue(pt.getName().toString()); if (val instanceof Geometry) { return new SimpleObjectProperty<>(new BorderPane(new Label("{geometry}"))); } else { SimpleObjectProperty<BorderPane> sop = new SimpleObjectProperty<>(); if (val instanceof CheckedArrayList<?>) { Iterator<String> it = ((CheckedArrayList<String>) val).iterator(); TreeItem<String> ti = new TreeItem<>(it.next()); while (it.hasNext()) { ti.getChildren().add(new TreeItem<>(it.next())); } BorderPane bp = new BorderPane(new TreeView<>(ti)); sop.setValue(bp); return sop; } else { sop.setValue(new BorderPane(new Label(String.valueOf(val)))); return sop; } } }); ttv.getColumns().add(column); } } } }