// created: 29.12.00
// modified:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;

class WeightChanger extends JPanel implements ChangeListener
 {
 
 JSlider theSlider;
 JTextField theField;

 WeightChanger()
  {  
  theSlider = new JSlider();
  theField = new JTextField(String.valueOf(theSlider.getValue()),3);
  theField.setEditable(false);

  theSlider.addChangeListener(this);

  setLayout(new GridLayout(1,2));
  setPreferredSize(new Dimension(125,20));
  theSlider.setPreferredSize(new Dimension(95,20));
  theField.setPreferredSize(new Dimension(30,20));

  add(theSlider);
  add(theField);
  } 

 /***********************/
 /* method stateChanged */
 /***********************/

 public void stateChanged(ChangeEvent e) 
  {
  theField.setText(String.valueOf(theSlider.getValue()));
  }

 /*********************/
 /* method setEnabled */
 /*********************/
 
 public void setEnabled(boolean bool)
  {
  super.setEnabled(bool);
  theSlider.setEnabled(bool);
  theField.setEnabled(bool);
  }

        
 /********************/
 /* method getWeight */
 /********************/

 int getWeight()
  { 
  return Integer.valueOf(theField.getText()).intValue();
  }

 }