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

/**
 * MiniDraw_StateBar
 * <p>
 *   <b>History</b> :
 *   <ul>
 *      <li>Version 0.1 : Initial version</li>
 *   </ul>
 * </p>
 * @author Pierrick Calvet & Florian Delclaux
 */
public class MiniDraw_StateBar extends JPanel{

  private JLabel lblShape;
  private JLabel lblFilled;
  private JPanel pnlColor;
  private JLabel lblPosition;

/**
 * Build MiniDraw_StateBar's object
 */
  public MiniDraw_StateBar() {
    setLayout(new GridLayout(1,4));

    lblShape = new JLabel("Circle");              /* Default shape */

    if(MiniDraw.DEFAULT_FILLED)
      lblFilled = new JLabel("Filled");
    else
      lblFilled = new JLabel("Not Filled");

    pnlColor = new JPanel();
    pnlColor.setBackground(MiniDraw.DEFAULT_COLOR);

    lblPosition = new JLabel("0,0");

    add(lblShape);
    add(lblFilled);
    add(lblPosition);
    add(pnlColor);
  }

/**
 * Refresh selected color
 * @param c Selected Color
 */
  public void refresh(Color c){
    pnlColor.setBackground(c);
  }

/**
 * Refresh selected shape
 * @param s Selected shape
 */
  public void refresh(String s){
    lblShape.setText(s);
  }

/**
 * Refresh filled/not filled
 * @param b State of chkFilled
 */
  public void refresh(boolean b){
    if(b)
      lblFilled.setText("Filled");
    else
      lblFilled.setText("Not Filled");
  }

/**
 * Refresh (x,y) coordinates
 * @param x Cursor's x coordinate
 * @param y Cursor's y coordinate
 */
  public void refresh(int x, int y){
    lblPosition.setText(x + "," + y);
  }
}
