Package de.lessvoid.nifty.controls

Examples of de.lessvoid.nifty.controls.Scrollbar


  @NiftyEventSubscriber(id="scrollbarH_WorldMax_Textfield")
  public void onMaxValueChanged(final String id, final TextFieldChangedEvent event) {
    try {
      float f = Float.valueOf(event.getText());
      Scrollbar scrollbar = getScrollbar("scrollbarH");
      scrollbar.setWorldMax(f);
    } catch (NumberFormatException e) {
    }
  }
View Full Code Here


  @NiftyEventSubscriber(id="scrollbarH_ViewMax_Textfield")
  public void onViewMaxValueChanged(final String id, final TextFieldChangedEvent event) {
    try {
      float f = Float.valueOf(event.getText());
      Scrollbar scrollbar = getScrollbar("scrollbarH");
      scrollbar.setWorldPageSize(f);
    } catch (NumberFormatException e) {
    }
  }
View Full Code Here

  @NiftyEventSubscriber(id="scrollbarH_CurrentValue_Textfield")
  public void onCurrentValueChanged(final String id, final TextFieldChangedEvent event) {
    try {
      float f = Float.valueOf(event.getText());
      Scrollbar scrollbar = getScrollbar("scrollbarH");
      scrollbar.setValue(f);
    } catch (NumberFormatException e) {
    }
  }
View Full Code Here

  @NiftyEventSubscriber(id="scrollbarH_ButtonStepSize_Textfield")
  public void onButtonStepSizeChanged(final String id, final TextFieldChangedEvent event) {
    try {
      float f = Float.valueOf(event.getText());
      Scrollbar scrollbar = getScrollbar("scrollbarH");
      scrollbar.setButtonStepSize(f);
    } catch (NumberFormatException e) {
    }
  }
View Full Code Here

  @NiftyEventSubscriber(id="scrollbarH_PageStepSize_Textfield")
  public void onPageStepSizeChanged(final String id, final TextFieldChangedEvent event) {
    try {
      float f = Float.valueOf(event.getText());
      Scrollbar scrollbar = getScrollbar("scrollbarH");
      scrollbar.setPageStepSize(f);
    } catch (NumberFormatException e) {
    }
  }
View Full Code Here

  public void onStartScreen() {
  }

  public void mouseWheel(final Element e, final NiftyMouseInputEvent inputEvent) {
    int mouseWheel = inputEvent.getMouseWheel();
    Scrollbar scrollbar = getVerticalScrollbar();
    if (scrollbar != null) {
      float currentValue = scrollbar.getValue();
      if (mouseWheel < 0) {
        scrollbar.setValue(currentValue - scrollbar.getButtonStepSize() * mouseWheel);
      } else if (mouseWheel > 0) {
        scrollbar.setValue(currentValue - scrollbar.getButtonStepSize() * mouseWheel);
      }
    }
  }
View Full Code Here

    getElement().layoutElements();
  }

  @Override
  public void scrollTo(final int newPosition) {
    Scrollbar verticalS = getVerticalScrollbar();
    if (verticalS != null) {
      verticalS.setValue(newPosition * labelTemplateHeight);
    }
  }
View Full Code Here

      }
    }
  }

  private void initializeHorizontalScrollbar() {
    Scrollbar horizontalS = getHorizontalScrollbar();
    if (horizontalS != null && horizontalS.isBound()) {
      horizontalS.setWorldMax(lastMaxWidth);
      horizontalS.setWorldPageSize(listBoxPanelElement.getWidth());
    }
  }
View Full Code Here

      horizontalS.setWorldPageSize(listBoxPanelElement.getWidth());
    }
  }

  private void initializeVerticalScrollbar(final Screen screen, final float labelTemplateHeight, final int itemCount) {
    Scrollbar verticalS = getVerticalScrollbar();
    if (verticalS != null && verticalS.isBound()) {
      verticalS.setWorldMax(itemCount * labelTemplateHeight);
      verticalS.setWorldPageSize(displayItems * labelTemplateHeight);
      verticalS.setButtonStepSize(labelTemplateHeight);
    }
  }
View Full Code Here

      if (elements.isEmpty()) {
        return;
      }
      final Element scrollElement = elements.get(0);
      if (scrollElement != null) {
        Scrollbar horizontalS = getElement().findNiftyControl("#nifty-internal-horizontal-scrollbar", Scrollbar.class);
        if (horizontalS != null) {
          horizontalS.setWorldMax(scrollElement.getWidth());
          horizontalS.setWorldPageSize(horizontalS.getWidth());
          updateWorldH();
        }

        Scrollbar verticalS = getElement().findNiftyControl("#nifty-internal-vertical-scrollbar", Scrollbar.class);
        if (verticalS != null) {
          verticalS.setWorldMax(scrollElement.getHeight());
          verticalS.setWorldPageSize(verticalS.getHeight());
          updateWorldV();
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of de.lessvoid.nifty.controls.Scrollbar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.