private void setSliderEnable() {
   if (movementType.getSelectedItem().equals(STATIONARY_TEXT)) {
     mySpeedSlider.setEnabled(false);
     myDurationSlider.setEnabled(false);
   } else {
     mySpeedSlider.setEnabled(true);
     myDurationSlider.setEnabled(true);
   }
   myHitPointsSlider.setEnabled(true);
 }
 public ObjectStats exportStats() {
   return new ObjectStats(
       (String) objectType.getSelectedItem(),
       myCollisionID,
       (String) movementType.getSelectedItem(),
       mySpeedSlider.getValue(),
       myDurationSlider.getValue(),
       cameraBox.isSelected(),
       myLevelEditor.getMover().getImageName(),
       floaterBox.isSelected(),
       myHitPointsSlider.getValue());
 }
 /**
  * Sets the stats of the ObjectStats object to the values found in this panel.
  *
  * @param objectStats ObjectStats object to be changed.
  */
 public void setStats(ObjectStats objectStats) {
   if (objectStats != null) {
     mySpeedSlider.setValue(objectStats.mySpeed);
     myDurationSlider.setValue(objectStats.myDuration);
     objectType.setSelectedItem(objectStats.myColType);
     movementType.setSelectedItem(objectStats.myMovementPattern);
     floaterBox.setSelected(objectStats.isFloating);
     cameraBox.setSelected(objectStats.isCameraFollow);
     myHitPointsSlider.setValue(objectStats.hitPoints);
   }
   setSliderEnable();
 }
  private void createSliders() {
    JPanel sliderPanel = new JPanel();
    sliderPanel.setLayout(new BoxLayout(sliderPanel, BoxLayout.Y_AXIS));
    mySpeedSlider = new SliderObject(MOVEMENT_SPEED_SLIDER_NAME, 0, SLIDER_RANGE);
    mySpeedSlider.addChangeListener(new SpeedListener());
    mySpeedSlider.setEnabled(false);

    myDurationSlider = new SliderObject(MOVEMENT_DURATION_SLIDER_NAME, 0, SLIDER_RANGE);
    myDurationSlider.addChangeListener(new DurationListener());
    myDurationSlider.setEnabled(false);

    myHitPointsSlider = new SliderObject(HIT_POINTS_FOR_OBJECT_TEXT, 1, SLIDER_RANGE);
    myHitPointsSlider.addChangeListener(new DurationListener());
    myHitPointsSlider.setEnabled(false);

    sliderPanel.add(mySpeedSlider);
    sliderPanel.add(myDurationSlider);
    sliderPanel.add(myHitPointsSlider);

    sliderPanel.setPreferredSize(SLIDER_PANEL_SIZE);
    sliderPanel.setMaximumSize(SLIDER_PANEL_SIZE);

    homePanel.add(sliderPanel);
  }
 /**
  * Gets the value in the duration slider.
  *
  * @return The value in the duration slider.
  */
 public int getMovementDuration() {
   return myDurationSlider.getValue();
 }
 /**
  * Gets the value in the speed slider.
  *
  * @return The value of the speed slider.
  */
 public int getMovementSpeed() {
   return mySpeedSlider.getValue();
 }
 public int getHitPoints() {
   return myHitPointsSlider.getValue();
 }