类javafx.scene.control.ScrollPane.ScrollBarPolicy源码实例Demo

下面列出了怎么用javafx.scene.control.ScrollPane.ScrollBarPolicy的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: milkman   文件: ContentEditor.java
public ContentEditor() {
	getStyleClass().add("contentEditor");

	setupHeader();
	setupCodeArea();
	setupSearch();

	StackPane.setAlignment(search, Pos.TOP_RIGHT);
	// bug: scrollPane has some issue if it is rendered within a tab that
	// is not yet shown with content that needs a scrollbar
	// this leads to e.g. tabs not being updated, if triggered programmatically
	// switching to ALWAYS for scrollbars fixes this issue
	scrollPane = new VirtualizedScrollPane(codeArea, ScrollBarPolicy.ALWAYS,
			ScrollBarPolicy.ALWAYS);

	StackPane contentPane = new StackPane(scrollPane, search);
	VBox.setVgrow(contentPane, Priority.ALWAYS);

	getChildren().add(contentPane);
}
 
源代码2 项目: marathonv5   文件: CommentBoxVBoxer.java
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;
}
 
源代码3 项目: ShootOFF   文件: SessionViewerController.java
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);
	}
}
 
源代码4 项目: pdfsam   文件: WorkArea.java
@Inject
public WorkArea(List<Module> modules, QuickbarModuleButtonsPane modulesButtons) {
    getStyleClass().addAll(Style.CONTAINER.css());
    setId("work-area");
    for (Module module : modules) {
        this.modules.put(module.id(), module);
    }
    fade.setFromValue(0);
    fade.setToValue(1);
    center.setHbarPolicy(ScrollBarPolicy.NEVER);
    center.setFitToWidth(true);
    center.setFitToHeight(true);
    setCenter(center);
    setLeft(new QuickbarPane(modulesButtons));
    eventStudio().addAnnotatedListeners(this);
}
 
源代码5 项目: pdfsam   文件: NewsPanel.java
public NewsPanel() {
    getStyleClass().add("news-panel");
    getStyleClass().addAll(Style.CONTAINER.css());
    Button closeButton = FontAwesomeIconFactory.get().createIconButton(FontAwesomeIcon.TIMES);
    closeButton.getStyleClass().addAll("close-button");
    closeButton.setOnAction(e -> eventStudio().broadcast(HideNewsPanelRequest.INSTANCE));
    Label titleLabel = new Label(DefaultI18nContext.getInstance().i18n("What's new"));
    titleLabel.setPrefWidth(Integer.MAX_VALUE);
    titleLabel.getStyleClass().add("news-panel-title");

    StackPane top = new StackPane(titleLabel, closeButton);
    top.setAlignment(Pos.TOP_RIGHT);

    scroll.getStyleClass().add("scrollable-news");
    scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
    scroll.setFitToHeight(true);
    scroll.setFitToWidth(true);
    getChildren().addAll(top, scroll);

    eventStudio().addAnnotatedListeners(this);
}
 
源代码6 项目: oim-fx   文件: OnlyScrollPaneSkin.java
/**
 * Computes the size that should be reserved for horizontal scrollbar in
 * size hints (min/pref height)
 */
private double computeHsbSizeHint(ScrollPane sp) {
	return ((sp.getHbarPolicy() == ScrollBarPolicy.ALWAYS) ||
			(sp.getHbarPolicy() == ScrollBarPolicy.AS_NEEDED && (sp.getPrefViewportHeight() > 0 || sp.getMinViewportHeight() > 0)))
					? hsb.prefHeight(ScrollBar.USE_COMPUTED_SIZE)
					: 0;
}
 
源代码7 项目: oim-fx   文件: OnlyScrollPaneSkin.java
/**
 * Computes the size that should be reserved for vertical scrollbar in size
 * hints (min/pref width)
 */
private double computeVsbSizeHint(ScrollPane sp) {
	return ((sp.getVbarPolicy() == ScrollBarPolicy.ALWAYS) ||
			(sp.getVbarPolicy() == ScrollBarPolicy.AS_NEEDED && (sp.getPrefViewportWidth() > 0
					|| sp.getMinViewportWidth() > 0)))
							? vsb.prefWidth(ScrollBar.USE_COMPUTED_SIZE)
							: 0;
}
 
源代码8 项目: oim-fx   文件: OnlyScrollPaneSkin.java
private boolean determineHorizontalSBVisible() {
	final ScrollPane sp = getSkinnable();

	if (IS_TOUCH_SUPPORTED) {
		return (tempVisibility && (nodeWidth > contentWidth));
	} else {
		// RT-17395: ScrollBarPolicy might be null. If so, treat it as
		// "AS_NEEDED", which is the default
		ScrollBarPolicy hbarPolicy = sp.getHbarPolicy();
		return (ScrollBarPolicy.NEVER == hbarPolicy) ? false
				: ((ScrollBarPolicy.ALWAYS == hbarPolicy) ? true : ((sp.isFitToWidth() && scrollNode != null ? scrollNode.isResizable() : false) ? (nodeWidth > contentWidth && scrollNode.minWidth(-1) > contentWidth) : (nodeWidth > contentWidth)));
	}
}
 
源代码9 项目: oim-fx   文件: OnlyScrollPaneSkin.java
private boolean determineVerticalSBVisible() {
	final ScrollPane sp = getSkinnable();

	if (IS_TOUCH_SUPPORTED) {
		return (tempVisibility && (nodeHeight > contentHeight));
	} else {
		// RT-17395: ScrollBarPolicy might be null. If so, treat it as
		// "AS_NEEDED", which is the default
		ScrollBarPolicy vbarPolicy = sp.getVbarPolicy();
		return (ScrollBarPolicy.NEVER == vbarPolicy) ? false
				: ((ScrollBarPolicy.ALWAYS == vbarPolicy) ? true : ((sp.isFitToHeight() && scrollNode != null ? scrollNode.isResizable() : false) ? (nodeHeight > contentHeight && scrollNode.minHeight(-1) > contentHeight) : (nodeHeight > contentHeight)));
	}
}
 
源代码10 项目: marathonv5   文件: FunctionStage.java
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);
}
 
源代码11 项目: marathonv5   文件: FailureNoteVBoxer.java
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;
}
 
源代码12 项目: htm.java-examples   文件: BreakingNewsDemo.java
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();
}
 
源代码13 项目: HubTurbo   文件: UI.java
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;
    }
 
源代码14 项目: pdfsam   文件: DashboardItemPane.java
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);
}
 
源代码15 项目: constellation   文件: JavaFxTopComponent.java
@Override
protected final void initContent() {
    this.setLayout(new BorderLayout());
    this.setPreferredSize(new Dimension(500, 500));
    Platform.setImplicitExit(false);
    Platform.runLater(() -> {
        this.content = createContent();

        this.scrollPane = new ScrollPane(content);

        this.scene = new Scene(scrollPane);
        scene.getStylesheets().add(JavafxStyleManager.getMainStyleSheet());
        if (createStyle() != null) {
            scene.getStylesheets().add(getClass().getResource(createStyle()).toExternalForm());
        }

        scrollPane.setHbarPolicy(getHorizontalScrollPolicy());
        if (getHorizontalScrollPolicy() == ScrollBarPolicy.NEVER) {
            scrollPane.setFitToWidth(true);
        } else {
            scrollPane.viewportBoundsProperty().addListener((observable, oldValue, newValue) -> {
                // TODO: fix a bug where the width of the scroll can grow infinitely
                scrollPane.setFitToWidth(content.prefWidth(-1) <= newValue.getWidth());
            });
        }
        scrollPane.setVbarPolicy(getVerticalScrollPolicy());
        if (getVerticalScrollPolicy() == ScrollBarPolicy.NEVER) {
            scrollPane.setFitToHeight(true);
        } else {
            scrollPane.viewportBoundsProperty().addListener((observable, oldValue, newValue) -> {
                scrollPane.setFitToHeight(content.prefHeight(-1) <= newValue.getHeight());
            });
        }

        // set the font on initialise
        updateFont();

        jfxContainer.setScene(scene);
        jfxContainer.setBackground(Color.red);
        SwingUtilities.invokeLater(() -> {
            add(jfxContainer, BorderLayout.CENTER);
            validate();
        });
    });
}
 
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();
}
 
源代码17 项目: phoebus   文件: EmbeddedDisplayRepresentation.java
@Override
public void updateChanges()
{
    // Late update after disposal?
    if (inner == null)
        return;
    super.updateChanges();
    if (dirty_sizes.checkAndClear())
    {
        final Integer width = model_widget.propWidth().getValue();
        final Integer height = model_widget.propHeight().getValue();
        scroll.setPrefSize(width, height);

        final Resize resize = model_widget.propResize().getValue();
        if (resize == Resize.None)
        {
            zoom.setX(1.0);
            zoom.setY(1.0);
            scroll.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
            scroll.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        }
        else if (resize == Resize.Crop)
        {
            zoom.setX(1.0);
            zoom.setY(1.0);
            scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
            scroll.setVbarPolicy(ScrollBarPolicy.NEVER);
        }
        else if (resize == Resize.ResizeContent  ||  resize == Resize.StretchContent )
        {
            zoom.setX(zoom_factor_x);
            zoom.setY(zoom_factor_y);
            scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
            scroll.setVbarPolicy(ScrollBarPolicy.NEVER);
        }
        else // SizeToContent
        {
            zoom.setX(1.0);
            zoom.setY(1.0);
            scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
            scroll.setVbarPolicy(ScrollBarPolicy.NEVER);
        }
    }
    if (dirty_background.checkAndClear())
        inner.setBackground(inner_background);
}
 
源代码18 项目: phoebus   文件: Palette.java
/** Create UI elements
 *  @return Top-level Node of the UI
 */
@SuppressWarnings("unchecked")
public Node create()
{
    final VBox palette = new VBox();

    final Map<WidgetCategory, Pane> palette_groups = createWidgetCategoryPanes(palette);
    groups = palette_groups.values();
    createWidgetEntries(palette_groups);

    final ScrollPane palette_scroll = new ScrollPane(palette);
    palette_scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
    palette_scroll.setFitToWidth(true);

    // TODO Determine the correct size for the main node
    // Using 2*PREFERRED_WIDTH was determined by trial and error
    palette_scroll.setMinWidth(PREFERRED_WIDTH + 12);
    palette_scroll.setPrefWidth(PREFERRED_WIDTH);

    // Copy the widgets, i.e. the children of each palette_group,
    // to the userData.
    // Actual children are now updated based on search by widget name
    palette_groups.values().forEach(group -> group.setUserData(new ArrayList<Node>(group.getChildren())));

    final TextField searchField = new ClearingTextField();
    searchField.setPromptText(Messages.SearchTextField);
    searchField.setTooltip(new Tooltip(Messages.WidgetFilterTT));
    searchField.setPrefColumnCount(9);
    searchField.textProperty().addListener( ( observable, oldValue, search_text ) ->
    {
        final String search = search_text.toLowerCase().trim();
        palette_groups.values().stream().forEach(group ->
        {
            group.getChildren().clear();
            final List<Node> all_widgets = (List<Node>)group.getUserData();
            if (search.isEmpty())
                group.getChildren().setAll(all_widgets);
            else
                group.getChildren().setAll(all_widgets.stream()
                                                      .filter(node ->
                                                      {
                                                         final String text = ((ToggleButton) node).getText().toLowerCase();
                                                         return text.contains(search);
                                                      })
                                                     .collect(Collectors.toList()));
        });
    });
    HBox.setHgrow(searchField, Priority.NEVER);

    final HBox toolsPane = new HBox(6);
    toolsPane.setAlignment(Pos.CENTER_RIGHT);
    toolsPane.setPadding(new Insets(6));
    toolsPane.getChildren().add(searchField);

    BorderPane paletteContainer = new BorderPane();
    paletteContainer.setTop(toolsPane);
    paletteContainer.setCenter(palette_scroll);

    return paletteContainer;
}
 
源代码19 项目: gef   文件: InfiniteCanvas.java
@Override
public void changed(
		ObservableValue<? extends ScrollBarPolicy> observable,
		ScrollBarPolicy oldValue, ScrollBarPolicy newValue) {
	updateScrollBars();
}
 
源代码20 项目: gef   文件: InfiniteCanvas.java
/**
 * Updates the {@link ScrollBar}s' visibilities, value ranges and value
 * increments based on the {@link #computeContentBoundsInLocal() content
 * bounds} and the {@link #computeScrollableBoundsInLocal() scrollable
 * bounds}. The update is not done if any of the {@link ScrollBar}s is
 * currently in use.
 */
protected void updateScrollBars() {
	// do not update while a scrollbar is pressed, so that the scrollable
	// area does not change while using a scrollbar
	if (horizontalScrollBar.isPressed() || verticalScrollBar.isPressed()) {
		return;
	}

	// determine current content bounds
	double[] oldContentBounds = Arrays.copyOf(contentBounds,
			contentBounds.length);
	contentBounds = computeContentBoundsInLocal();
	if (!Arrays.equals(oldContentBounds, contentBounds)) {
		contentBoundsBinding.invalidate();
	}

	// show/hide horizontal scrollbar
	ScrollBarPolicy hbarPolicy = horizontalScrollBarPolicyProperty.get();
	boolean hbarIsNeeded = contentBounds[0] < -0.01
			|| contentBounds[2] > getWidth() + 0.01;
	if (hbarPolicy.equals(ScrollBarPolicy.ALWAYS)
			|| hbarPolicy.equals(ScrollBarPolicy.AS_NEEDED)
					&& hbarIsNeeded) {
		horizontalScrollBar.setVisible(true);
	} else {
		horizontalScrollBar.setVisible(false);
	}

	// show/hide vertical scrollbar
	ScrollBarPolicy vbarPolicy = verticalScrollBarPolicyProperty.get();
	boolean vbarIsNeeded = contentBounds[1] < -0.01
			|| contentBounds[3] > getHeight() + 0.01;
	if (vbarPolicy.equals(ScrollBarPolicy.ALWAYS)
			|| vbarPolicy.equals(ScrollBarPolicy.AS_NEEDED)
					&& vbarIsNeeded) {
		verticalScrollBar.setVisible(true);
	} else {
		verticalScrollBar.setVisible(false);
	}

	// determine current scrollable bounds
	double[] oldScrollableBounds = Arrays.copyOf(scrollableBounds,
			scrollableBounds.length);
	scrollableBounds = computeScrollableBoundsInLocal();
	if (!Arrays.equals(oldScrollableBounds, scrollableBounds)) {
		scrollableBoundsBinding.invalidate();
	}

	// update scrollbar ranges
	horizontalScrollBar.setMin(scrollableBounds[0]);
	horizontalScrollBar.setMax(scrollableBounds[2]);
	horizontalScrollBar.setVisibleAmount(getWidth());
	horizontalScrollBar.setBlockIncrement(getWidth() / 2);
	horizontalScrollBar.setUnitIncrement(getWidth() / 10);
	verticalScrollBar.setMin(scrollableBounds[1]);
	verticalScrollBar.setMax(scrollableBounds[3]);
	verticalScrollBar.setVisibleAmount(getHeight());
	verticalScrollBar.setBlockIncrement(getHeight() / 2);
	verticalScrollBar.setUnitIncrement(getHeight() / 10);

	// compute scrollbar values from canvas translation (in case the
	// scrollbar values are incorrect)
	// XXX: Remove scroll bar value listeners when adapting the values to
	// prevent infinite recursion.
	horizontalScrollBar.valueProperty()
			.removeListener(horizontalScrollBarValueChangeListener);
	verticalScrollBar.valueProperty()
			.removeListener(verticalScrollBarValueChangeListener);

	horizontalScrollBar
			.setValue(computeHv(getScrolledPane().getTranslateX()));
	verticalScrollBar
			.setValue(computeVv(getScrolledPane().getTranslateY()));

	horizontalScrollBar.valueProperty()
			.addListener(horizontalScrollBarValueChangeListener);
	verticalScrollBar.valueProperty()
			.addListener(verticalScrollBarValueChangeListener);
}
 
源代码21 项目: constellation   文件: JavaFxTopComponent.java
/**
 * A JavaFxTopComponent will have a ScrollPane by default, as it cannot know
 * the expected layout of the given pane. If you wish to remove the
 * horizontal scroll bar, you can override this method to return
 * ScrollBarPolicy.NEVER.
 *
 * @return a {@link ScrollBarPolicy} representing the desired horizontal
 * scroll bar policy.
 */
protected ScrollBarPolicy getHorizontalScrollPolicy() {
    return ScrollBarPolicy.NEVER;
}
 
源代码22 项目: constellation   文件: JavaFxTopComponent.java
/**
 * A JavaFxTopComponent will have a ScrollPane by default, as it cannot know
 * the expected layout of the given pane. If you wish to remove the vertical
 * scroll bar, you can override this method to return ScrollBarPolicy.NEVER.
 *
 * @return a {@link ScrollBarPolicy} representing the desired vertical
 * scroll bar policy.
 */
protected ScrollBarPolicy getVerticalScrollPolicy() {
    return ScrollBarPolicy.NEVER;
}
 
源代码23 项目: gef   文件: InfiniteCanvas.java
/**
 * Returns the {@link ScrollBarPolicy} that is currently used to decide when
 * to show a horizontal scrollbar.
 *
 * @return The {@link ScrollBarPolicy} that is currently used to decide when
 *         to show a horizontal scrollbar.
 */
public ScrollBarPolicy getHorizontalScrollBarPolicy() {
	return horizontalScrollBarPolicyProperty.get();
}
 
源代码24 项目: gef   文件: InfiniteCanvas.java
/**
 * Returns the {@link ScrollBarPolicy} that is currently used to decide when
 * to show a vertical scrollbar.
 *
 * @return The {@link ScrollBarPolicy} that is currently used to decide when
 *         to show a vertical scrollbar.
 */
public ScrollBarPolicy getVerticalScrollBarPolicy() {
	return verticalScrollBarPolicyProperty.get();
}
 
源代码25 项目: gef   文件: InfiniteCanvas.java
/**
 * Returns the {@link ObjectProperty} that controls the
 * {@link ScrollBarPolicy} that decides when to show a horizontal scrollbar.
 *
 * @return The {@link ObjectProperty} that controls the
 *         {@link ScrollBarPolicy} that decides when to show a horizontal
 *         scrollbar.
 */
public ObjectProperty<ScrollBarPolicy> horizontalScrollBarPolicyProperty() {
	return horizontalScrollBarPolicyProperty;
}
 
源代码26 项目: gef   文件: InfiniteCanvas.java
/**
 * Sets the value of the {@link #horizontalScrollBarPolicyProperty()} to the
 * given {@link ScrollBarPolicy}.
 *
 * @param horizontalScrollBarPolicy
 *            The new {@link ScrollBarPolicy} for the horizontal scrollbar.
 */
public void setHorizontalScrollBarPolicy(
		ScrollBarPolicy horizontalScrollBarPolicy) {
	horizontalScrollBarPolicyProperty.set(horizontalScrollBarPolicy);
}
 
源代码27 项目: gef   文件: InfiniteCanvas.java
/**
 * Sets the value of the {@link #verticalScrollBarPolicyProperty()} to the
 * given {@link ScrollBarPolicy}.
 *
 * @param verticalScrollBarPolicy
 *            The new {@link ScrollBarPolicy} for the vertical scrollbar.
 */
public void setVerticalScrollBarPolicy(
		ScrollBarPolicy verticalScrollBarPolicy) {
	verticalScrollBarPolicyProperty.set(verticalScrollBarPolicy);
}
 
源代码28 项目: gef   文件: InfiniteCanvas.java
/**
 * Returns the {@link ObjectProperty} that controls the
 * {@link ScrollBarPolicy} that decides when to show a vertical scrollbar.
 *
 * @return The {@link ObjectProperty} that controls the
 *         {@link ScrollBarPolicy} that decides when to show a vertical
 *         scrollbar.
 */
public ObjectProperty<ScrollBarPolicy> verticalScrollBarPolicyProperty() {
	return verticalScrollBarPolicyProperty;
}
 
 类所在包
 类方法
 同包方法