Example #1
0
  @SuppressWarnings("OverridableMethodCallInConstructor")
  public ScrollPane(Widget content) {
    this.scrollbarH = new Scrollbar(Scrollbar.Orientation.HORIZONTAL);
    this.scrollbarV = new Scrollbar(Scrollbar.Orientation.VERTICAL);
    this.contentArea = new Widget();

    Runnable cb =
        new Runnable() {
          public void run() {
            scrollContent();
          }
        };

    scrollbarH.addCallback(cb);
    scrollbarH.setVisible(false);
    scrollbarV.addCallback(cb);
    scrollbarV.setVisible(false);
    contentArea.setClip(true);
    contentArea.setTheme("");

    super.insertChild(contentArea, 0);
    super.insertChild(scrollbarH, 1);
    super.insertChild(scrollbarV, 2);
    setContent(content);
    setCanAcceptKeyboardFocus(true);
  }