package express.awt;

import java.awt.*;
import java.awt.event.*;

public class NumberBox extends Component {


	int n;
	Color interfaceColor = new Color(130,130,190);
	Color chosenColor = Color.white;

	Font font = new Font("Helvetica", Font.BOLD, 14);
		
	boolean chosen = false;


	NumberBox(int n) {
		this.n = n;
	}
	
	public void paint(Graphics g) {

		String number = String.valueOf(n);	

	//	if (number.length() == 1) this.number = "0" + number ;
	//	else this.number = number;

		FontMetrics ftmet = this.getFontMetrics(font);
		int stringWidth = ftmet.stringWidth(number);
		int stringHeight = ftmet.getHeight();
		g.setFont(font);
		
		if (chosen) g.setColor(chosenColor);
		else g.setColor(interfaceColor);

		g.drawString(number, 6, this.getSize().height-6);
		
		g.drawRect(0, this.getSize().height-5-stringHeight, this.getSize().width-3, stringHeight);

		
	}

	

	//	g.fillRect(0, 0, 4, 4);
	//	g.fillRect(0, this.getSize().height-4, 4, 4);
	//	g.fillRect(this.getSize().width-8, 0, 4, 4);
	//	g.fillRect(this.getSize().width-8, this.getSize().height-4, 4, 4);	


	
	public void update(Graphics g) {
		paint(g);
	}
	
	public Dimension getPreferredSize() {
		return new Dimension(20, 20);
	}
}




			
		

	
