import java.awt.*;
import java.awt.event.*;
import java.util.*;

//swing classes
import javax.swing.text.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import javax.swing.tree.*;

public class RectButton extends JToggleButton implements Command
{
   Mediator med;

  public RectButton(ActionListener act, Mediator md)
  {
  super("R");
  //setSize(new Dimension(25,25));
  //setBorder(new EmptyBorder(5,5,5,5));
  setToolTipText("Draw rectangle");
  addActionListener(act);
  med = md;
  med.registerRectButton(this);
  }
//-------------------------------------------
  public void Execute()
  {
     if (isSelected()) 
        {
        med.startRectangle();
        }
  }
  
}

