package express.awt;

import java.awt.*;
import java.awt.event.*;

public class ChoiceBox extends Component {
	
	ChoiceBox(Color c) {
		setForeground(c);	
	}

	ChoiceBox() {
	//	setBackground(Color.black);
		setForeground(Color.darkGray);
	}
	
	public void paint(Graphics g) {

		g.setColor(getForeground());
		g.fillRect(0, 2, this.getSize().width/2, this.getSize().height-4);
	}
	
	public void paintCorners() {
		Color tempColor = this.getBackground();
		int red = 255-tempColor.getRed(); 
		int green = 255-tempColor.getGreen(); 
		int blue = 255-tempColor.getBlue(); 
		tempColor = new Color(red,green,blue);

		Graphics g = this.getGraphics();
		g.setColor(tempColor);

		g.fillRect(this.getSize().width/2-2, 0, 4, 4);
		g.fillRect(this.getSize().width/2-2, this.getSize().height-4, 4, 4);	
	}

	public void eraseCorners() {		
		Graphics g = this.getGraphics();
		g.setColor(this.getBackground());

		g.fillRect(this.getSize().width/2-2, 0, 4, 4);
		g.fillRect(this.getSize().width/2-2, this.getSize().height-4, 4, 4);

		g.setColor(getForeground());

		g.fillRect(0, 2, this.getSize().width/2, this.getSize().height-4);

	}

	public void update(Graphics g) {
		paint(g);
	}
	
	public Dimension getPreferredSize() {
		return new Dimension(20, 20);
	}
}


