Example #1
0
 private void updateHeight() {
   if (getHeight() == 0) {
     setHeight(DEFAULT_SIZE);
     return;
   }
   if (orientation == HORIZONTAL) {
     incButton.setHeight(Math.min(getHeight(), incButton.getHeight()));
     decButton.setHeight(Math.min(getHeight(), decButton.getHeight()));
     slider.setHeight(Math.min(getHeight(), slider.getHeight()));
     slider.setY(getHeight() / 2f - slider.getHeight() / 2f);
     incButton.setY(getHeight() / 2f - incButton.getHeight() / 2f);
     decButton.setY(getHeight() / 2f - incButton.getHeight() / 2f);
   } else { // VERTICAL
     decButton.setY(getHeight() - decButton.getHeight());
     slider.setY(incButton.getHeight());
     slider.setHeight(getHeight() - (incButton.getHeight() + decButton.getHeight()));
   }
 }
Example #2
0
 protected void updateBackground() {
   if (items.size() * (_myItemHeight + spacing) < _myOriginalBackgroundHeight) {
     _myBackgroundHeight = items.size() * (_myItemHeight + spacing);
   }
   if (buttons.size() < items.size()) {
     _myScrollbar.setHeight(_myBackgroundHeight - spacing);
     _myScrollbar.show();
   } else {
     _myScrollbar.hide();
   }
   updateButtonWidth();
 }