/** Called when ever either min, max or value changes, so thumb's layoutX, Y is recomputed. */
  void positionThumb() {
    ScrollBar s = getSkinnable();
    double clampedValue = Utils.clamp(s.getMin(), s.getValue(), s.getMax());
    trackPos =
        (s.getMax() - s.getMin() > 0)
            ? ((trackLength - thumbLength)
                * (clampedValue - s.getMin())
                / (s.getMax() - s.getMin()))
            : (0.0F);

    if (!IS_TOUCH_SUPPORTED) {
      if (s.getOrientation() == Orientation.VERTICAL) {
        trackPos += decButton.prefHeight(-1);
      } else {
        trackPos += decButton.prefWidth(-1);
      }
    }

    thumb.setTranslateX(
        snapPosition(
            s.getOrientation() == Orientation.VERTICAL
                ? snappedLeftInset()
                : trackPos + snappedLeftInset()));
    thumb.setTranslateY(
        snapPosition(
            s.getOrientation() == Orientation.VERTICAL
                ? trackPos + snappedTopInset()
                : snappedTopInset()));
  }
 @Override
 protected double computeMinHeight(
     double width, double topInset, double rightInset, double bottomInset, double leftInset) {
   if (getSkinnable().getOrientation() == Orientation.VERTICAL) {
     if (!IS_TOUCH_SUPPORTED) {
       return decButton.minHeight(-1)
           + incButton.minHeight(-1)
           + minTrackLength()
           + topInset
           + bottomInset;
     } else {
       return minTrackLength() + topInset + bottomInset;
     }
   } else {
     return getBreadth();
   }
 }
 /*
  * Gets the breadth of the scrollbar. The "breadth" is the distance
  * across the scrollbar, i.e. if vertical the width, otherwise the height.
  * On desktop this is determined by the greater of the breadths of the end-buttons.
  * Embedded doesn't have end-buttons, so currently we use a default breadth.
  * We should change this when we get width/height css properties.
  */
 double getBreadth() {
   if (!IS_TOUCH_SUPPORTED) {
     if (getSkinnable().getOrientation() == Orientation.VERTICAL) {
       return Math.max(decButton.prefWidth(-1), incButton.prefWidth(-1))
           + snappedLeftInset()
           + snappedRightInset();
     } else {
       return Math.max(decButton.prefHeight(-1), incButton.prefHeight(-1))
           + snappedTopInset()
           + snappedBottomInset();
     }
   } else {
     if (getSkinnable().getOrientation() == Orientation.VERTICAL) {
       return Math.max(DEFAULT_EMBEDDED_SB_BREADTH, DEFAULT_EMBEDDED_SB_BREADTH)
           + snappedLeftInset()
           + snappedRightInset();
     } else {
       return Math.max(DEFAULT_EMBEDDED_SB_BREADTH, DEFAULT_EMBEDDED_SB_BREADTH)
           + snappedTopInset()
           + snappedBottomInset();
     }
   }
 }
  /**
   * This method is called from within the init() method to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    bg = new javax.swing.JPanel();
    Keypad = new javax.swing.JPanel();
    Number1 = new EButton(Parent);
    Number2 = new EButton(Parent);
    Number3 = new EButton(Parent);
    Number4 = new EButton(Parent);
    Number5 = new EButton(Parent);
    Number6 = new EButton(Parent);
    Number7 = new EButton(Parent);
    Number8 = new EButton(Parent);
    Number9 = new EButton(Parent);
    NumberClear = new EButton(Parent);
    Number0 = new EButton(Parent);
    NumberPlusOne = new EButton(Parent);
    NumberPlusTen = new EButton(Parent);
    NumberMinusOne = new EButton(Parent);
    NumberMinus10 = new EButton(Parent);
    BackspaceButton = new EButton(Parent);
    DelButton = new EButton(Parent);
    NumberPanel = new javax.swing.JPanel();
    VarName = new javax.swing.JLabel();
    NumberField = new javax.swing.JTextField();
    EndButton = new EButton(Parent);
    RightButton = new EButton(Parent);
    LeftButton = new EButton(Parent);
    Pos1Button = new EButton(Parent);
    Validation = new javax.swing.JLabel();
    ConfirmationPanel = new javax.swing.JPanel();
    SettingsCancelButton = new EButton(Parent);
    SettingsOKButton = new EButton(Parent);

    bg.setBackground(new java.awt.Color(0, 0, 0));
    bg.setPreferredSize(new java.awt.Dimension(1024, 600));

    Keypad.setBackground(new java.awt.Color(0, 0, 0));

    Number1.setText("1");
    Number1.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Number1.setPreferredSize(new java.awt.Dimension(100, 60));
    Number1.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Number1ActionPerformed(evt);
          }
        });

    Number2.setText("2");
    Number2.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Number2.setPreferredSize(new java.awt.Dimension(100, 60));
    Number2.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Number2ActionPerformed(evt);
          }
        });

    Number3.setText("3");
    Number3.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Number3.setPreferredSize(new java.awt.Dimension(100, 60));
    Number3.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Number3ActionPerformed(evt);
          }
        });

    Number4.setText("4");
    Number4.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Number4.setPreferredSize(new java.awt.Dimension(100, 60));
    Number4.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Number4ActionPerformed(evt);
          }
        });

    Number5.setText("5");
    Number5.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Number5.setPreferredSize(new java.awt.Dimension(100, 60));
    Number5.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Number5ActionPerformed(evt);
          }
        });

    Number6.setText("6");
    Number6.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Number6.setPreferredSize(new java.awt.Dimension(100, 60));
    Number6.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Number6ActionPerformed(evt);
          }
        });

    Number7.setText("7");
    Number7.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Number7.setPreferredSize(new java.awt.Dimension(100, 60));
    Number7.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Number7ActionPerformed(evt);
          }
        });

    Number8.setText("8");
    Number8.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Number8.setPreferredSize(new java.awt.Dimension(100, 60));
    Number8.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Number8ActionPerformed(evt);
          }
        });

    Number9.setText("9");
    Number9.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Number9.setPreferredSize(new java.awt.Dimension(100, 60));
    Number9.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Number9ActionPerformed(evt);
          }
        });

    NumberClear.setText("Clear");
    NumberClear.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    NumberClear.setPreferredSize(new java.awt.Dimension(100, 60));
    NumberClear.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            NumberClearActionPerformed(evt);
          }
        });

    Number0.setText("0");
    Number0.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Number0.setPreferredSize(new java.awt.Dimension(100, 60));
    Number0.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Number0ActionPerformed(evt);
          }
        });

    NumberPlusOne.setText("+1");
    NumberPlusOne.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    NumberPlusOne.setPreferredSize(new java.awt.Dimension(100, 60));
    NumberPlusOne.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            NumberPlusOneActionPerformed(evt);
          }
        });

    NumberPlusTen.setText("+10");
    NumberPlusTen.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    NumberPlusTen.setPreferredSize(new java.awt.Dimension(100, 60));
    NumberPlusTen.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            NumberPlusTenActionPerformed(evt);
          }
        });

    NumberMinusOne.setText("-1");
    NumberMinusOne.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    NumberMinusOne.setPreferredSize(new java.awt.Dimension(100, 60));
    NumberMinusOne.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            NumberMinusOneActionPerformed(evt);
          }
        });

    NumberMinus10.setText("-10");
    NumberMinus10.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    NumberMinus10.setPreferredSize(new java.awt.Dimension(100, 60));
    NumberMinus10.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            NumberMinus10ActionPerformed(evt);
          }
        });

    BackspaceButton.setText("Backspace");
    BackspaceButton.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    BackspaceButton.setPreferredSize(new java.awt.Dimension(100, 60));
    BackspaceButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            BackspaceButtonActionPerformed(evt);
          }
        });

    DelButton.setText("Del");
    DelButton.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    DelButton.setPreferredSize(new java.awt.Dimension(100, 60));
    DelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            DelButtonActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout KeypadLayout = new javax.swing.GroupLayout(Keypad);
    Keypad.setLayout(KeypadLayout);
    KeypadLayout.setHorizontalGroup(
        KeypadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                KeypadLayout.createSequentialGroup()
                    .addGroup(
                        KeypadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(
                                KeypadLayout.createParallelGroup(
                                        javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(
                                        KeypadLayout.createSequentialGroup()
                                            .addComponent(
                                                Number1,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(
                                                Number2,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(
                                                Number3,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(
                                        KeypadLayout.createSequentialGroup()
                                            .addComponent(
                                                Number4,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(
                                                Number5,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(
                                                Number6,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(
                                KeypadLayout.createSequentialGroup()
                                    .addGroup(
                                        KeypadLayout.createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(
                                                Number0,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(
                                                KeypadLayout.createSequentialGroup()
                                                    .addContainerGap()
                                                    .addComponent(
                                                        Number7,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        Short.MAX_VALUE)))
                                    .addGap(18, 18, 18)
                                    .addComponent(
                                        Number8,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addGroup(
                                        KeypadLayout.createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(
                                                NumberClear,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                Number9,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGap(18, 18, 18)
                    .addGroup(
                        KeypadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                NumberMinus10,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(
                                KeypadLayout.createSequentialGroup()
                                    .addGroup(
                                        KeypadLayout.createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(
                                                NumberPlusOne,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                NumberPlusTen,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(74, 74, 74)
                                    .addGroup(
                                        KeypadLayout.createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addComponent(
                                                DelButton,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .addComponent(
                                                BackspaceButton,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                121,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(
                                NumberMinusOne,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));
    KeypadLayout.setVerticalGroup(
        KeypadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                KeypadLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        KeypadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(
                                KeypadLayout.createSequentialGroup()
                                    .addComponent(
                                        BackspaceButton,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(
                                        DelButton,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                KeypadLayout.createSequentialGroup()
                                    .addGroup(
                                        KeypadLayout.createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                Number2,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                Number3,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                Number1,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                NumberPlusTen,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(18, 18, 18)
                                    .addGroup(
                                        KeypadLayout.createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                Number5,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                Number6,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                Number4,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                NumberPlusOne,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGap(18, 18, 18)
                    .addGroup(
                        KeypadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                Number8,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                Number9,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                NumberMinusOne,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                Number7,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(
                        KeypadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                Number0,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                NumberClear,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                NumberMinus10,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    NumberPanel.setBackground(java.awt.Color.black);

    VarName.setFont(new java.awt.Font("DejaVu Sans", 1, 18));
    VarName.setForeground(new java.awt.Color(255, 255, 255));
    VarName.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    VarName.setText("Name");
    VarName.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
    VarName.setAlignmentY(0.0F);
    VarName.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
    VarName.setIconTextGap(0);
    VarName.setInheritsPopupMenu(false);
    VarName.setRequestFocusEnabled(false);
    VarName.setVerifyInputWhenFocusTarget(false);
    VarName.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

    NumberField.setBackground(new java.awt.Color(0, 0, 0));
    NumberField.setFont(new java.awt.Font("Bitstream Vera Sans Mono", 0, 18));
    NumberField.setForeground(new java.awt.Color(255, 255, 255));
    NumberField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
    NumberField.setBorder(
        javax.swing.BorderFactory.createLineBorder(new java.awt.Color(148, 148, 148)));
    NumberField.setCaretColor(new java.awt.Color(255, 255, 255));
    NumberField.addCaretListener(
        new javax.swing.event.CaretListener() {
          public void caretUpdate(javax.swing.event.CaretEvent evt) {
            NumberFieldCaretUpdate(evt);
          }
        });

    EndButton.setText("End");
    EndButton.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    EndButton.setPreferredSize(new java.awt.Dimension(100, 60));
    EndButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            EndButtonActionPerformed(evt);
          }
        });

    RightButton.setText("->");
    RightButton.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    RightButton.setPreferredSize(new java.awt.Dimension(100, 60));
    RightButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            RightButtonActionPerformed(evt);
          }
        });

    LeftButton.setText("<-");
    LeftButton.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    LeftButton.setPreferredSize(new java.awt.Dimension(100, 60));
    LeftButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            LeftButtonActionPerformed(evt);
          }
        });

    Pos1Button.setText("Pos1");
    Pos1Button.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
    Pos1Button.setPreferredSize(new java.awt.Dimension(100, 60));
    Pos1Button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            Pos1ButtonActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout NumberPanelLayout = new javax.swing.GroupLayout(NumberPanel);
    NumberPanel.setLayout(NumberPanelLayout);
    NumberPanelLayout.setHorizontalGroup(
        NumberPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                NumberPanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        NumberPanelLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(VarName)
                            .addGroup(
                                NumberPanelLayout.createParallelGroup(
                                        javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(
                                        NumberPanelLayout.createSequentialGroup()
                                            .addComponent(
                                                Pos1Button,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                60,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(
                                                LeftButton,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                60,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(
                                                RightButton,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                60,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(
                                                EndButton,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                60,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(
                                        NumberField,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        294,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(191, Short.MAX_VALUE)));
    NumberPanelLayout.setVerticalGroup(
        NumberPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                NumberPanelLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(VarName)
                    .addGap(18, 18, 18)
                    .addComponent(
                        NumberField,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        52,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        NumberPanelLayout.createParallelGroup(
                                javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                Pos1Button,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                LeftButton,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                RightButton,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                EndButton,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    Validation.setForeground(new java.awt.Color(180, 1, 1));

    ConfirmationPanel.setBackground(java.awt.Color.black);

    SettingsCancelButton.setText("Cancel");
    SettingsCancelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            SettingsCancelButtonActionPerformed(evt);
          }
        });

    SettingsOKButton.setText("OK");
    SettingsOKButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            SettingsOKButtonActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout ConfirmationPanelLayout =
        new javax.swing.GroupLayout(ConfirmationPanel);
    ConfirmationPanel.setLayout(ConfirmationPanelLayout);
    ConfirmationPanelLayout.setHorizontalGroup(
        ConfirmationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                ConfirmationPanelLayout.createSequentialGroup()
                    .addComponent(
                        SettingsOKButton,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        SettingsCancelButton,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)));
    ConfirmationPanelLayout.setVerticalGroup(
        ConfirmationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                ConfirmationPanelLayout.createParallelGroup(
                        javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(
                        SettingsOKButton,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(
                        SettingsCancelButton,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)));

    javax.swing.GroupLayout bgLayout = new javax.swing.GroupLayout(bg);
    bg.setLayout(bgLayout);
    bgLayout.setHorizontalGroup(
        bgLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                bgLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        NumberPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        Validation,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        220,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(283, Short.MAX_VALUE))
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                bgLayout
                    .createSequentialGroup()
                    .addContainerGap(922, Short.MAX_VALUE)
                    .addComponent(
                        ConfirmationPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            .addGroup(
                bgLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        Keypad,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(339, Short.MAX_VALUE)));
    bgLayout.setVerticalGroup(
        bgLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                bgLayout
                    .createSequentialGroup()
                    .addGroup(
                        bgLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                bgLayout
                                    .createSequentialGroup()
                                    .addContainerGap()
                                    .addComponent(
                                        NumberPanel,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                bgLayout
                                    .createSequentialGroup()
                                    .addGap(42, 42, 42)
                                    .addComponent(
                                        Validation,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        33,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        Keypad,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
                    .addComponent(
                        ConfirmationPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                bg,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                bg,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE));
  } // </editor-fold>//GEN-END:initComponents
  /**
   * Initializes the ScrollBarSkin. Creates the scene and sets up all the bindings for the group.
   */
  private void initialize() {

    track = new StackPane();
    track.getStyleClass().setAll("track");

    trackBackground = new StackPane();
    trackBackground.getStyleClass().setAll("track-background");

    thumb =
        new StackPane() {
          @Override
          public Object queryAccessibleAttribute(
              AccessibleAttribute attribute, Object... parameters) {
            switch (attribute) {
              case VALUE:
                return getSkinnable().getValue();
              default:
                return super.queryAccessibleAttribute(attribute, parameters);
            }
          }
        };
    thumb.getStyleClass().setAll("thumb");
    thumb.setAccessibleRole(AccessibleRole.THUMB);

    if (!IS_TOUCH_SUPPORTED) {

      incButton =
          new EndButton("increment-button", "increment-arrow") {
            @Override
            public void executeAccessibleAction(AccessibleAction action, Object... parameters) {
              switch (action) {
                case FIRE:
                  getSkinnable().increment();
                  break;
                default:
                  super.executeAccessibleAction(action, parameters);
              }
            }
          };
      incButton.setAccessibleRole(AccessibleRole.INCREMENT_BUTTON);
      incButton.setOnMousePressed(
          me -> {
            /*
             ** if the tracklenght isn't greater than do nothing....
             */
            if (!thumb.isVisible() || trackLength > thumbLength) {
              getBehavior().incButtonPressed();
            }
            me.consume();
          });
      incButton.setOnMouseReleased(
          me -> {
            /*
             ** if the tracklenght isn't greater than do nothing....
             */
            if (!thumb.isVisible() || trackLength > thumbLength) {
              getBehavior().incButtonReleased();
            }
            me.consume();
          });

      decButton =
          new EndButton("decrement-button", "decrement-arrow") {
            @Override
            public void executeAccessibleAction(AccessibleAction action, Object... parameters) {
              switch (action) {
                case FIRE:
                  getSkinnable().decrement();
                  break;
                default:
                  super.executeAccessibleAction(action, parameters);
              }
            }
          };
      decButton.setAccessibleRole(AccessibleRole.DECREMENT_BUTTON);
      decButton.setOnMousePressed(
          me -> {
            /*
             ** if the tracklenght isn't greater than do nothing....
             */
            if (!thumb.isVisible() || trackLength > thumbLength) {
              getBehavior().decButtonPressed();
            }
            me.consume();
          });
      decButton.setOnMouseReleased(
          me -> {
            /*
             ** if the tracklenght isn't greater than do nothing....
             */
            if (!thumb.isVisible() || trackLength > thumbLength) {
              getBehavior().decButtonReleased();
            }
            me.consume();
          });
    }

    track.setOnMousePressed(
        me -> {
          if (!thumb.isPressed() && me.getButton() == MouseButton.PRIMARY) {
            if (getSkinnable().getOrientation() == Orientation.VERTICAL) {
              if (trackLength != 0) {
                getBehavior().trackPress(me.getY() / trackLength);
                me.consume();
              }
            } else {
              if (trackLength != 0) {
                getBehavior().trackPress(me.getX() / trackLength);
                me.consume();
              }
            }
          }
        });

    track.setOnMouseReleased(
        me -> {
          getBehavior().trackRelease();
          me.consume();
        });

    thumb.setOnMousePressed(
        me -> {
          if (me.isSynthesized()) {
            // touch-screen events handled by Scroll handler
            me.consume();
            return;
          }
          /*
           ** if max isn't greater than min then there is nothing to do here
           */
          if (getSkinnable().getMax() > getSkinnable().getMin()) {
            dragStart = thumb.localToParent(me.getX(), me.getY());
            double clampedValue =
                Utils.clamp(
                    getSkinnable().getMin(), getSkinnable().getValue(), getSkinnable().getMax());
            preDragThumbPos =
                (clampedValue - getSkinnable().getMin())
                    / (getSkinnable().getMax() - getSkinnable().getMin());
            me.consume();
          }
        });

    thumb.setOnMouseDragged(
        me -> {
          if (me.isSynthesized()) {
            // touch-screen events handled by Scroll handler
            me.consume();
            return;
          }
          /*
           ** if max isn't greater than min then there is nothing to do here
           */
          if (getSkinnable().getMax() > getSkinnable().getMin()) {
            /*
             ** if the tracklength isn't greater then do nothing....
             */
            if (trackLength > thumbLength) {
              Point2D cur = thumb.localToParent(me.getX(), me.getY());
              if (dragStart == null) {
                // we're getting dragged without getting a mouse press
                dragStart = thumb.localToParent(me.getX(), me.getY());
              }
              double dragPos =
                  getSkinnable().getOrientation() == Orientation.VERTICAL
                      ? cur.getY() - dragStart.getY()
                      : cur.getX() - dragStart.getX();
              getBehavior().thumbDragged(preDragThumbPos + dragPos / (trackLength - thumbLength));
            }

            me.consume();
          }
        });

    thumb.setOnScrollStarted(
        se -> {
          if (se.isDirect()) {
            /*
             ** if max isn't greater than min then there is nothing to do here
             */
            if (getSkinnable().getMax() > getSkinnable().getMin()) {
              dragStart = thumb.localToParent(se.getX(), se.getY());
              double clampedValue =
                  Utils.clamp(
                      getSkinnable().getMin(), getSkinnable().getValue(), getSkinnable().getMax());
              preDragThumbPos =
                  (clampedValue - getSkinnable().getMin())
                      / (getSkinnable().getMax() - getSkinnable().getMin());
              se.consume();
            }
          }
        });

    thumb.setOnScroll(
        event -> {
          if (event.isDirect()) {
            /*
             ** if max isn't greater than min then there is nothing to do here
             */
            if (getSkinnable().getMax() > getSkinnable().getMin()) {
              /*
               ** if the tracklength isn't greater then do nothing....
               */
              if (trackLength > thumbLength) {
                Point2D cur = thumb.localToParent(event.getX(), event.getY());
                if (dragStart == null) {
                  // we're getting dragged without getting a mouse press
                  dragStart = thumb.localToParent(event.getX(), event.getY());
                }
                double dragPos =
                    getSkinnable().getOrientation() == Orientation.VERTICAL
                        ? cur.getY() - dragStart.getY()
                        : cur.getX() - dragStart.getX();
                getBehavior()
                    .thumbDragged(/*todo*/ preDragThumbPos + dragPos / (trackLength - thumbLength));
              }

              event.consume();
              return;
            }
          }
        });

    getSkinnable()
        .addEventHandler(
            ScrollEvent.SCROLL,
            event -> {
              /*
               ** if the tracklength isn't greater then do nothing....
               */
              if (trackLength > thumbLength) {

                double dx = event.getDeltaX();
                double dy = event.getDeltaY();

                /*
                 ** in 2.0 a horizontal scrollbar would scroll on a vertical
                 ** drag on a tracker-pad. We need to keep this behavior.
                 */
                dx = (Math.abs(dx) < Math.abs(dy) ? dy : dx);

                /*
                 ** we only consume an event that we've used.
                 */
                ScrollBar sb = (ScrollBar) getSkinnable();

                double delta = (getSkinnable().getOrientation() == Orientation.VERTICAL ? dy : dx);

                /*
                 ** RT-22941 - If this is either a touch or inertia scroll
                 ** then we move to the position of the touch point.
                 *
                 * TODO: this fix causes RT-23406 ([ScrollBar, touch] Dragging scrollbar from the
                 * track on touchscreen causes flickering)
                 */
                if (event.isDirect()) {
                  if (trackLength > thumbLength) {
                    getBehavior()
                        .thumbDragged(
                            (getSkinnable().getOrientation() == Orientation.VERTICAL
                                    ? event.getY()
                                    : event.getX())
                                / trackLength);
                    event.consume();
                  }
                } else {
                  if (delta > 0.0 && sb.getValue() > sb.getMin()) {
                    sb.decrement();
                    event.consume();
                  } else if (delta < 0.0 && sb.getValue() < sb.getMax()) {
                    sb.increment();
                    event.consume();
                  }
                }
              }
            });

    getChildren().clear();
    if (!IS_TOUCH_SUPPORTED) {
      getChildren().addAll(trackBackground, incButton, decButton, track, thumb);
    } else {
      getChildren().addAll(track, thumb);
    }
  }
  @Override
  protected void layoutChildren(final double x, final double y, final double w, final double h) {

    final ScrollBar s = getSkinnable();

    /**
     * Compute the percentage length of thumb as (visibleAmount/range) if max isn't greater than min
     * then there is nothing to do here
     */
    double visiblePortion;
    if (s.getMax() > s.getMin()) {
      visiblePortion = s.getVisibleAmount() / (s.getMax() - s.getMin());
    } else {
      visiblePortion = 1.0;
    }

    if (s.getOrientation() == Orientation.VERTICAL) {
      if (!IS_TOUCH_SUPPORTED) {
        double decHeight = snapSize(decButton.prefHeight(-1));
        double incHeight = snapSize(incButton.prefHeight(-1));

        decButton.resize(w, decHeight);
        incButton.resize(w, incHeight);

        trackLength = snapSize(h - (decHeight + incHeight));
        thumbLength =
            snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));

        trackBackground.resizeRelocate(
            snapPosition(x), snapPosition(y), w, trackLength + decHeight + incHeight);
        decButton.relocate(snapPosition(x), snapPosition(y));
        incButton.relocate(snapPosition(x), snapPosition(y + h - incHeight));
        track.resizeRelocate(snapPosition(x), snapPosition(y + decHeight), w, trackLength);
        thumb.resize(
            snapSize(x >= 0 ? w : w + x),
            thumbLength); // Account for negative padding (see also RT-10719)
        positionThumb();
      } else {
        trackLength = snapSize(h);
        thumbLength =
            snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));

        track.resizeRelocate(snapPosition(x), snapPosition(y), w, trackLength);
        thumb.resize(
            snapSize(x >= 0 ? w : w + x),
            thumbLength); // Account for negative padding (see also RT-10719)
        positionThumb();
      }
    } else {
      if (!IS_TOUCH_SUPPORTED) {
        double decWidth = snapSize(decButton.prefWidth(-1));
        double incWidth = snapSize(incButton.prefWidth(-1));

        decButton.resize(decWidth, h);
        incButton.resize(incWidth, h);

        trackLength = snapSize(w - (decWidth + incWidth));
        thumbLength =
            snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));

        trackBackground.resizeRelocate(
            snapPosition(x), snapPosition(y), trackLength + decWidth + incWidth, h);
        decButton.relocate(snapPosition(x), snapPosition(y));
        incButton.relocate(snapPosition(x + w - incWidth), snapPosition(y));
        track.resizeRelocate(snapPosition(x + decWidth), snapPosition(y), trackLength, h);
        thumb.resize(
            thumbLength,
            snapSize(y >= 0 ? h : h + y)); // Account for negative padding (see also RT-10719)
        positionThumb();
      } else {
        trackLength = snapSize(w);
        thumbLength =
            snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));

        track.resizeRelocate(snapPosition(x), snapPosition(y), trackLength, h);
        thumb.resize(
            thumbLength,
            snapSize(y >= 0 ? h : h + y)); // Account for negative padding (see also RT-10719)
        positionThumb();
      }

      s.resize(snapSize(s.getWidth()), snapSize(s.getHeight()));
    }

    // things should be invisible only when well below minimum length
    if (s.getOrientation() == Orientation.VERTICAL
            && h
                >= (computeMinHeight(
                        -1, (int) y, snappedRightInset(), snappedBottomInset(), (int) x)
                    - (y + snappedBottomInset()))
        || s.getOrientation() == Orientation.HORIZONTAL
            && w
                >= (computeMinWidth(-1, (int) y, snappedRightInset(), snappedBottomInset(), (int) x)
                    - (x + snappedRightInset()))) {
      trackBackground.setVisible(true);
      track.setVisible(true);
      thumb.setVisible(true);
      if (!IS_TOUCH_SUPPORTED) {
        incButton.setVisible(true);
        decButton.setVisible(true);
      }
    } else {
      trackBackground.setVisible(false);
      track.setVisible(false);
      thumb.setVisible(false);

      if (!IS_TOUCH_SUPPORTED) {
        /*
         ** once the space is big enough for one button we
         ** can look at drawing
         */
        if (h >= decButton.computeMinWidth(-1)) {
          decButton.setVisible(true);
        } else {
          decButton.setVisible(false);
        }
        if (h >= incButton.computeMinWidth(-1)) {
          incButton.setVisible(true);
        } else {
          incButton.setVisible(false);
        }
      }
    }
  }