How to Preserve the Scrollbar Policy

Questions & Answers

Summary

Some view mode classes may reset the scrollbar policy on the Graph2DView.
For a better user experience, please go to the integrated documentation viewer to read this article.

Description

Graph2DView Scrollbar Policies

Whenever an instance of class y.view.EditMode (or one of its subclasses) gets activated as the view mode for a Graph2DView, the setting for the view's scrollbar policy is reset to its defaults (VERTICAL_SCROLLBAR_AS_NEEDED / HORIZONTAL_SCROLLBAR_AS_NEEDED). This happens, for example, when the Graph2DView's current view mode switches from NavigationMode to EditMode.

In order to preserve the scrollbar policies you have set, use

EditMode.setAdjustScrollBarPolicy(boolean) on such EditMode instances as follows:

// 'myEditMode' is of type y.view.EditMode.
myEditMode.setAdjustScrollBarPolicy(false);

Categories this article belongs to:
yFiles for Java > yFiles Viewer > Displaying and Editing Graphs > User Interaction
yFiles for Java > yFiles Viewer > Displaying and Editing Graphs > View Implementations
Applies to:
yFiles for Java 2: 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.10, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18
Keywords:
scrollbar - scroll - bar - scrollbars - policy - vertical - horizontal - ScrollPaneConstants - VERTICAL_SCROLLBAR_AS_NEEDED - HORIZONTAL_SCROLLBAR_AS_NEEDED - EditMode - ViewMode - Graph2DView - setAdjustScrollBarPolicy