00001 package dionarap;
00002
00003 import java.awt.BorderLayout;
00004 import java.awt.Color;
00005
00006 import javax.swing.BorderFactory;
00007 import javax.swing.JButton;
00008 import javax.swing.JFrame;
00009 import javax.swing.JLabel;
00010 import javax.swing.JPanel;
00011 import javax.swing.JTextField;
00012 import javax.swing.JWindow;
00013
00021 public class Navigator extends JWindow {
00025 private static final long serialVersionUID = 8928980690535128687L;
00026
00030 JTextField tPunktestand = new JTextField();
00031
00036 JButton bNewGame = new JButton("Neues Spiel");
00037
00044 public Navigator(JFrame parent) {
00045 super(parent);
00046
00047 this.tPunktestand.setEditable(false);
00048 this.bNewGame.addActionListener(new ListenerNewGame());
00049
00050 JLabel lblPunktestand = new JLabel("Puntestand:");
00051 lblPunktestand.setOpaque(true);
00052 lblPunktestand.setVisible(true);
00053
00054 JPanel panelBottom = new JPanel();
00055 panelBottom.setLayout(new BorderLayout());
00056 panelBottom.add(lblPunktestand, BorderLayout.NORTH);
00057 panelBottom.add(this.tPunktestand, BorderLayout.SOUTH);
00058
00059 JPanel rahmen = new JPanel();
00060 rahmen.setLayout(new BorderLayout());
00061 rahmen.setBorder(BorderFactory.createLineBorder(Color.red, 2));
00062
00063 rahmen.add(new Tastatur(), BorderLayout.NORTH);
00064 rahmen.add(panelBottom);
00065 rahmen.add(this.bNewGame, BorderLayout.SOUTH);
00066
00067 this.getContentPane().add(rahmen);
00068
00069 this.updateLocation();
00070 this.pack();
00071 }
00072
00078 public void setNewGameButtonStatus(boolean enabled) {
00079 this.bNewGame.setEnabled(enabled);
00080 }
00081
00085 public void updateLocation() {
00086 this.setLocation((int)this.getParent().getLocation().getX() + this.getParent().getWidth() + 20,
00087 (int)this.getParent().getLocation().getY());
00088 }
00089
00095 public void setPoints(int points) {
00096 this.tPunktestand.setText(Integer.toString(points));
00097 }
00098 }