// created: 29.12.00
// modified:

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

class WeightPanel extends JPanel
 {
 
 WeightChanger textChanger;
 WeightChanger imagesChanger;
 WeightChanger tablesChanger;
 WeightChanger linksChanger;
 WeightChanger downloadsChanger;
 WeightChanger framesChanger;
 WeightChanger extensionChanger;

 WeightPanel()
  {
 
  // instantiate the components
  textChanger = new WeightChanger();
  imagesChanger = new WeightChanger();
  tablesChanger = new WeightChanger();
  linksChanger = new WeightChanger();
  downloadsChanger = new WeightChanger();
  framesChanger = new WeightChanger();  
  extensionChanger = new WeightChanger();

  // set preferred sizes
  setPreferredSize(new Dimension(125,290));
  /*textChanger.setPreferredSize(new Dimension(125,20));
  imagesChanger.setPreferredSize(new Dimension(125,20));
  tablesChanger.setPreferredSize(new Dimension(125,20));
  linksChanger.setPreferredSize(new Dimension(125,20));
  downloadsChanger.setPreferredSize(new Dimension(125,20));
  framesChanger.setPreferredSize(new Dimension(125,20));
  extensionChanger.setPreferredSize(new Dimension(125,20));*/

  // set up this panel
  setBorder(BorderFactory.createTitledBorder("weights"));
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));

  // add components
  add(textChanger);
  add(imagesChanger);
  add(tablesChanger);
  add(linksChanger);
  add(downloadsChanger);
  JPanel panel = new JPanel();
  panel.setPreferredSize(new Dimension(125,20));
  add(panel);
  add(framesChanger); 
  add(extensionChanger);
  }

 public void setEnabled(boolean bool)
  {
  super.setEnabled(bool);
  textChanger.setEnabled(bool);
  imagesChanger.setEnabled(bool);
  tablesChanger.setEnabled(bool);
  linksChanger.setEnabled(bool);
  downloadsChanger.setEnabled(bool);
  framesChanger.setEnabled(bool);
  extensionChanger.setEnabled(bool);
  }

 /*********************/
 /* method getWeights */
 /*********************/

 int [] getWeights()
  {
  int [] weights = new int [7];
  weights[0] = textChanger.getWeight();
  weights[1] = imagesChanger.getWeight();
  weights[2] = tablesChanger.getWeight();
  weights[3] = linksChanger.getWeight();
  weights[4] = downloadsChanger.getWeight();
  weights[5] = framesChanger.getWeight();  
  weights[6] = extensionChanger.getWeight();
  return weights;
  }

 }