package de.ip.Terminverwaltung;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Hashtable;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class Testdriver extends JFrame
{
private static int kundenId = 0;
private Hashtable kunden = new Hashtable();
public Testdriver()
{
super("GUI");
getContentPane().setLayout( new BorderLayout() );
// tab pane
JTabbedPane tabPane = new JTabbedPane();
JPanel kundenPanel = new JPanel();
kundenPanel.setLayout( new GridLayout(6, 2) );
tabPane.add(kundenPanel);
// eingabe feld
final JTextField vornameField = new JTextField();
final JTextField nachnameField = new JTextField();
final JTextField strasseField = new JTextField();
final JTextField ortField = new JTextField();
final JTextField plzField = new JTextField();
final JButton buttonKundeOk = new JButton("ok");
kundenPanel.add(new JLabel("Name: "));
kundenPanel.add(vornameField);
kundenPanel.add(new JLabel("Nachname: "));
kundenPanel.add(nachnameField);
kundenPanel.add(new JLabel("Strasse: "));
kundenPanel.add(strasseField);
kundenPanel.add(new JLabel("Ort: "));
kundenPanel.add(ortField);
kundenPanel.add(new JLabel( "PLZ: " ) );
kundenPanel.add(plzField);
kundenPanel.add(new JLabel( "eintragen: " ) );
kundenPanel.add(buttonKundeOk);
// dozenten Panel
JPanel dozentenPanel = new JPanel();
dozentenPanel.setLayout( new GridLayout( 6,2 ) );
dozentenPanel.add( new JLabel( "Dozenten" ) );
tabPane.add(dozentenPanel);
getContentPane().add( tabPane, BorderLayout.NORTH );
ActionListener buttonListener = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if( e.getSource().equals(buttonKundeOk) )
{
String vorname = vornameField.getText();
vornameField.setText(vorname);
}
}
};
buttonKundeOk.addActionListener(buttonListener);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setVisible(true);
}
public void addKunde(String name)
{
Kunde k = new Kunde();
k.setPersonId(kundenId);
k.setName(name);
kunden.put( new Integer(kundenId), k );
kunden.get( new Integer(5));
}
public static void main(String args[])
{
new Testdriver();
}
}