
import java.awt.TextField;

public class Maler {

	protected TextField textField;
	public String name = "";
	

	protected void note(Vector note) {
		if (menu == null) {
			menu = new Menu(this);
			menu.setKoordinateImage((GAME_WIDTH + infoWidth) / 2, GAME_HEIGHT / 2);
			menu.setZeileAbstand(0);
			menu.setWaehlbar(false);
			menu.add(Sprach.HNOTE, 0);
			for (int i = 0; i < note.size(); i++) {
				menu.add(
						((Note) note.elementAt(i)).name + "----" + ((Note) note.elementAt(i)).note,
						0);
			}

		}
		menu.erscheinen(gTemp);
	}
	
	public void nameVergeben() {
		if (menu == null) {
			menu = new Menu(this);
			menu.add(Sprach.Name, 0);
			menu.setKoordinateImage((GAME_WIDTH + infoWidth) / 2, GAME_HEIGHT / 2);
			textField = new TextField();

			textField.setBackground(Color.black);
			textField.setForeground(Color.red);
			textField.setSize(100, 40);
			textField.setLocation((GAME_WIDTH + infoWidth) / 2 - 50, GAME_HEIGHT / 2);
			textField.addKeyListener(frame.getKeyListeners()[0]);
			textField.setFont(new Font("Arial", Font.PLAIN, 25));

			frame.add(textField);
			frame.add(BorderLayout.CENTER, this);
			frame.pack();
			textField.requestFocus();
		}
		menu.erscheinen(gTemp);
	}
	
	public void gameLose() {
		original();
		if (System.currentTimeMillis() - time > 3000) {
			gameManager.writeScore();
		}
	}
	
	protected void gameWin() {
		original();
		if (System.currentTimeMillis() - time > 3000) {
			gameManager.writeScore();
		}
	}
	
	public void menuBehandeln(String option) {
		original(option);
		if (option.equals(Sprach.Name)) {
			this.setStatus(GameManager.TANK_WAEHLEN);
			this.gameManager.setStatus(GameManager.TANK_WAEHLEN);
			this.name = textField.getText();
			this.requestFocus();
			textField.setVisible(false);
			menu = null;
		}
		if (option.equals(Sprach.MAIN_MENU)) {
			gameManager.writeScore();
		}
		if (option.equals(Sprach.START)) {
			this.setStatus(GameManager.NAME_VERGEBEN);
			this.gameManager.setStatus(GameManager.NAME_VERGEBEN);
			menu = null;
		}
			
		}
	public void mainMenuerstellen() {
		original();
		menu.add(Sprach.NOTE, 9);
	}
}