Exemplo n.º 1
0
  /** Creates a control panel for adjusting the number of histogram classes */
  private void createNumClassesPanel() {

    int numClasses = getModel().getSettings().getNumClasses();
    fldNumClasses = (new InputPanelW(null, app, -1, false)).getTextComponent();
    fldNumClasses.setEditable(false);
    fldNumClasses.setOpaque(true);
    fldNumClasses.setColumns(2);
    fldNumClasses.setVisible(false);

    sliderNumClasses = new Slider(3, 20);
    sliderNumClasses.setValue(numClasses);

    sliderNumClasses.setMajorTickSpacing(1);

    sliderNumClasses.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            getModel().getSettings().setNumClasses(sliderNumClasses.getValue());
            fldNumClasses.setText(("" + getModel().getSettings().getNumClasses()));
            getModel().updatePlot(true);
          }
        });

    numClassesPanel = new FlowPanel();
    numClassesPanel.add(sliderNumClasses);
    numClassesPanel.add(fldNumClasses);
  }
Exemplo n.º 2
0
 /** @param value {@code int} */
 public void setSliderValue(int value) {
   if (mySlider == null) {
     return;
   }
   mySlider.setValue(value);
   sliderLabel.setText(value + "");
   updateGUI();
 }