Java Code Examples for javafx.scene.control.ScrollPane#setVbarPolicy()

The following examples show how to use javafx.scene.control.ScrollPane#setVbarPolicy() . 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 vote down vote up
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: SessionViewerController.java    From ShootOFF with GNU General Public License v3.0 6 votes vote down vote up
private void updateCameraTabs() {
	cameraTabPane.getTabs().clear();
	cameraGroups.clear();
	eventSelectionsPerTab.clear();

	for (final String cameraName : currentSession.getEvents().keySet()) {
		final Group canvas = new Group();
		final ScrollPane scrollPane = new ScrollPane(canvas);
		scrollPane.setPrefSize(cameraTabPane.getPrefWidth(), cameraTabPane.getPrefHeight());
		scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
		scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
		cameraGroups.put(cameraName, new SessionCanvasManager(canvas, config));

		final Tab cameraTab = new Tab(cameraName);
		cameraTab.setContent(scrollPane);
		cameraTabPane.getTabs().add(cameraTab);
	}
}
 
Example 3
Source File: QualityControlViewPane.java    From constellation with Apache License 2.0 5 votes vote down vote up
/**
 * Display a dialog containing all Rule objects registered with the Quality
 * Control View and which matched for a given identifier.
 *
 * @param owner The owner Node
 * @param identifier The identifier of the graph node being displayed.
 * @param rules The list of rules measured against this graph node.
 */
private static void showRuleDialog(final Node owner, final String identifier, final List<Pair<Integer, String>> rules) {
    final ScrollPane sp = new ScrollPane();
    sp.setPrefHeight(512);
    sp.setPrefWidth(512);
    sp.setFitToWidth(true);
    sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
    sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);

    final VBox vbox = new VBox();
    vbox.prefWidthProperty().bind(sp.widthProperty());
    vbox.setPadding(Insets.EMPTY);
    for (final Pair<Integer, String> rule : rules) {
        final String[] t = rule.getValue().split("ยง");

        final String quality = rule.getKey() == 0 ? Bundle.MSG_NotApplicable() : "" + rule.getKey();
        final String title = String.format("%s - %s", quality, t[0]);

        final Text content = new Text(t[1]);
        content.wrappingWidthProperty().bind(sp.widthProperty().subtract(16)); // Subtract a random number to avoid the vertical scrollbar.

        final TitledPane tp = new TitledPane(title, content);
        tp.prefWidthProperty().bind(vbox.widthProperty());
        tp.setExpanded(false);
        tp.setWrapText(true);

        vbox.getChildren().add(tp);
    }
    sp.setContent(vbox);

    final Alert alert = new Alert(Alert.AlertType.INFORMATION);
    alert.setHeaderText(String.format(Bundle.MSG_QualtyControlRules(), identifier));
    alert.getDialogPane().setContent(sp);
    alert.setResizable(true);
    alert.show();
}
 
Example 4
Source File: AttributeEditorPanel.java    From constellation with Apache License 2.0 5 votes vote down vote up
/**
 * multi value pane showing multiple values for an attribute
 *
 * @param attribute
 * @param attributePane
 * @param values
 */
private void createMultiValuePane(final AttributeData attribute, final TitledPane attributePane, final Object[] values) {
    final VBox dataAndMoreButtonBox = new VBox(5); // 5 = spacing

    final ScrollPane multiValuePane = new ScrollPane();

    multiValuePane.setFitToWidth(true);

    final ObservableList<Object> listData = FXCollections.observableArrayList();

    if (values.length > VISIBLE_ROWS) {
        for (int i = 0; i < VISIBLE_ROWS; i++) {
            listData.add(values[i]);
        }
    } else {
        listData.addAll(values);
    }
    final ListView<Object> listView = createListView(attribute, listData);
    final boolean moreToLoad = values.length > VISIBLE_ROWS;
    int visibleRow = moreToLoad ? VISIBLE_ROWS : listData.size();
    listView.setPrefHeight((CELL_HEIGHT * visibleRow) + 2); // +2 because if it is == then there is still a scrollbar.
    multiValuePane.setPrefHeight((CELL_HEIGHT * visibleRow) + 1);
    multiValuePane.setContent(listView);
    multiValuePane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    dataAndMoreButtonBox.setAlignment(Pos.CENTER);
    dataAndMoreButtonBox.setPadding(new Insets(0, 0, 5, 0));
    dataAndMoreButtonBox.getChildren().add(multiValuePane);
    if (moreToLoad) {
        Button loadMoreButton = createLoadMoreButton(dataAndMoreButtonBox, attribute);
        dataAndMoreButtonBox.getChildren().add(loadMoreButton);
    }
    dataAndMoreButtonBox.addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent event) -> {
        if (event.isShortcutDown() && (event.getCode() == KeyCode.A)) {
            listView.getSelectionModel().selectAll();
            event.consume();
        }
    });
    attributePane.setContent(dataAndMoreButtonBox);
}
 
Example 5
Source File: TaskBar.java    From desktoppanefx with Apache License 2.0 5 votes vote down vote up
public TaskBar() {
    taskBarContentPane = new HBox();
    taskBarContentPane.setSpacing(3);
    taskBarContentPane.setMaxHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
    taskBarContentPane.setMinHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
    taskBarContentPane.setAlignment(Pos.CENTER_LEFT);

    taskBar = new ScrollPane(taskBarContentPane);
    taskBar.setMaxHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
    taskBar.setMinHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
    taskBar.setVbarPolicy(javafx.scene.control.ScrollPane.ScrollBarPolicy.NEVER);
    taskBar.setVmax(0);
    taskBar.getStyleClass().add("desktoppane-taskbar");

    taskBar.visibleProperty().bind(visible);
    taskBar.managedProperty().bind(visible);

    taskBarContentPane.widthProperty().addListener((o, v, n) -> {
        Platform.runLater(() -> {
            if (n.doubleValue() <= taskBar.getWidth()) {
                taskBar.setMaxHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
                taskBar.setPrefHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
                taskBar.setMinHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
            } else {
                taskBar.setMaxHeight(TASKBAR_HEIGHT_WITH_SCROLL);
                taskBar.setPrefHeight(TASKBAR_HEIGHT_WITH_SCROLL);
                taskBar.setMinHeight(TASKBAR_HEIGHT_WITH_SCROLL);
            }
        });
    });
}
 
Example 6
Source File: ImagePanel.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void initComponents() {
    createLeftPane();
    createRightPane();
    scrollPane = new ScrollPane(anchorPane);
    scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    getItems().addAll(scrollPane, annotationTable);
    setDividerPositions(0.7);

}
 
Example 7
Source File: FunctionStage.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void initComponents() {
    mainSplitPane.setDividerPositions(0.35);
    mainSplitPane.getItems().addAll(createTree(), functionSplitPane);

    expandAllBtn.setOnAction((e) -> expandAll());
    collapseAllBtn.setOnAction((e) -> collapseAll());
    refreshButton.setOnAction((e) -> refresh());
    topButtonBar.setId("topButtonBar");
    topButtonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
    topButtonBar.getButtons().addAll(expandAllBtn, collapseAllBtn, refreshButton);

    functionSplitPane.setDividerPositions(0.4);
    functionSplitPane.setOrientation(Orientation.VERTICAL);
    documentArea = functionInfo.getEditorProvider().get(false, 0, IEditorProvider.EditorType.OTHER, false);
    Platform.runLater(() -> {
        documentArea.setEditable(false);
        documentArea.setMode("ruby");
    });

    argumentPane = new VBox();
    ScrollPane scrollPane = new ScrollPane(argumentPane);
    scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
    scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    functionSplitPane.getItems().addAll(documentArea.getNode(), scrollPane);

    okButton.setOnAction(new OkHandler());
    okButton.setDisable(true);
    cancelButton.setOnAction((e) -> dispose());
    buttonBar.getButtons().addAll(okButton, cancelButton);
    buttonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
}
 
Example 8
Source File: FailureNoteVBoxer.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private Node createTextArea(boolean selectable, boolean editable) {
    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.setHbarPolicy(ScrollBarPolicy.NEVER);
    scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
    HBox.setHgrow(scrollPane, Priority.ALWAYS);
    return scrollPane;
}
 
Example 9
Source File: PannableView.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/** @return a ScrollPane which scrolls the layout. */
private ScrollPane createScrollPane(Pane layout) {
  ScrollPane scroll = new ScrollPane();
  scroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
  scroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
  scroll.setPannable(true);
  scroll.setPrefSize(800, 600);
  scroll.setContent(layout);
  return scroll;
}
 
Example 10
Source File: BreakingNewsDemo.java    From htm.java-examples with GNU Affero General Public License v3.0 5 votes vote down vote up
public void configureView() {
    view = new BreakingNewsDemoView();
    view.autoModeProperty().addListener((v, o, n) -> { this.mode = n; });
    this.mode = view.autoModeProperty().get();
    view.startActionProperty().addListener((v, o, n) -> {
        if(n) {
            if(mode == Mode.AUTO) cursor++;
            start();
        }else{
            stop();
        }
    });
    view.runOneProperty().addListener((v, o, n) -> {
        this.cursor += n.intValue();
        runOne(jsonList.get(cursor), cursor);
    });
    view.flipStateProperty().addListener((v, o, n) -> {
        view.flipPaneProperty().get().flip();
    });

    view.setPrefSize(1370, 1160);
    view.setMinSize(1370, 1160);

    mainViewScroll  = new ScrollPane();
    mainViewScroll.setViewportBounds(new BoundingBox(0, 0, 1370, 1160));

    mainViewScroll.setHbarPolicy(ScrollBarPolicy.NEVER);
    mainViewScroll.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    mainViewScroll.setContent(view);
    mainViewScroll.viewportBoundsProperty().addListener((v, o, n) -> {
        view.setPrefSize(Math.max(1370, n.getMaxX()), Math.max(1160, n.getMaxY()));//1370, 1160);
    });

    createDataStream();
    createAlgorithm();
}
 
Example 11
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
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 12
Source File: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
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 13
Source File: UI.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 14
Source File: DashboardItemPane.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
DashboardItemPane(DashboardItem item) {
    requireNotNullArg(item, "Dashboard item cannot be null");
    this.item = item;
    this.item.pane().getStyleClass().addAll(Style.DEAULT_CONTAINER.css());
    this.item.pane().getStyleClass().addAll(Style.CONTAINER.css());
    ScrollPane scroll = new ScrollPane(this.item.pane());
    scroll.getStyleClass().addAll(Style.DEAULT_CONTAINER.css());
    scroll.setFitToWidth(true);
    scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
    scroll.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    setCenter(scroll);
    eventStudio().add(SetActiveModuleRequest.class, enableFooterListener, Integer.MAX_VALUE,
            ReferenceStrength.STRONG);
}
 
Example 15
Source File: SpectraIdentificationResultsWindowFX.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
public SpectraIdentificationResultsWindowFX() {
  super();

  pnMain = new BorderPane();
  this.setScene(new Scene(pnMain));
  getScene().getStylesheets()
      .addAll(MZmineCore.getDesktop().getMainWindow().getScene().getStylesheets());

  pnMain.setPrefSize(1000, 600);
  pnMain.setMinSize(700, 500);
  setMinWidth(700);
  setMinHeight(500);

  setTitle("Processing...");

  pnGrid = new GridPane();
  // any number of rows

  noMatchesFound = new Label("I'm working on it");
  noMatchesFound.setFont(headerFont);
  // yellow
  noMatchesFound.setTextFill(Color.web("0xFFCC00"));
  pnGrid.add(noMatchesFound, 0, 0);
  pnGrid.setVgap(5);

  // Add the Windows menu
  MenuBar menuBar = new MenuBar();
  // menuBar.add(new WindowsMenu());

  Menu menu = new Menu("Menu");

  // set font size of chart
  MenuItem btnSetup = new MenuItem("Setup dialog");
  btnSetup.setOnAction(e -> {
    Platform.runLater(() -> {
      if (MZmineCore.getConfiguration()
          .getModuleParameters(SpectraIdentificationResultsModule.class)
          .showSetupDialog(true) == ExitCode.OK) {
        showExportButtonsChanged();
      }
    });
  });

  menu.getItems().add(btnSetup);

  CheckMenuItem cbCoupleZoomY = new CheckMenuItem("Couple y-zoom");
  cbCoupleZoomY.setSelected(true);
  cbCoupleZoomY.setOnAction(e -> setCoupleZoomY(cbCoupleZoomY.isSelected()));
  menu.getItems().add(cbCoupleZoomY);

  menuBar.getMenus().add(menu);
  pnMain.setTop(menuBar);

  scrollPane = new ScrollPane(pnGrid);
  pnMain.setCenter(scrollPane);
  scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
  scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);

  totalMatches = new ArrayList<>();
  matchPanels = new HashMap<>();
  setCoupleZoomY(true);

  show();
}
 
Example 16
Source File: TradeStepView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
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();
        }
    };
}