N
!nDeX
Gast
Hallo Leute vielleicht könnt ihr mir helfen...ich versuche schon verzweifelt meine Datenbank in diese Klasse einzufügen...die Daten sollen dann in die einzelnen Textfelder eingelesen werden...nur leider versteh ich nicht wie...habe auch schon sämtliche Tuts durchgelesen und bin da nicht ganz durchgestiegen.
Ich poste ich mal die Klasse.
Ich hoffe ihr könnt mir helfen...
mfg
ich
Ich poste ich mal die Klasse.
Code:
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class Banking2 extends JFrame implements ActionListener {
JButton button, button2;
public static void main(String[] args) {
new Banking2( "Bankmanagement");
}
public Banking2( String titel )
{
super(titel);
this.setSize(1024,768);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
erzeugeAnsicht();
this.show();
}
void erzeugeAnsicht()
{
this.getContentPane().setLayout(null);
JLabel ueberschrift = new JLabel("Anmeldung");
ueberschrift.setFont(new Font("Verdana", Font.PLAIN,20));
ueberschrift.setBounds(10,10,150,50);
JLabel ueberschrift2 = new JLabel("_____________________________________");
ueberschrift2.setFont(new Font("Verdana", Font.PLAIN,20));
ueberschrift2.setBounds(10,15,600,50);
JLabel kto = new JLabel("Kontonummer:");
kto.setFont(new Font("Verdana", Font.PLAIN,12));
kto.setBounds(10,80,100,20);
JTextField text1 = new JTextField();
text1.setBounds(110,80,100,20);
JLabel pin = new JLabel("PIN Nummmer:");
pin.setFont(new Font("Verdana", Font.PLAIN,12));
pin.setBounds(10,120,100,20);
JPasswordField text2 = new JPasswordField();
text2.setEchoChar('*');
text2.setBounds(110,120,100,20);
button = new JButton("Neuen Account");
button.setBounds(160,650,150,30);
button2 = new JButton("Login");
button2.setBounds(10,650,150,30);
//JComboBox menu = new JComboBox();
// menu.setBounds(10,150,100,30);
getContentPane().setBackground(new Color(255,230,150));
this.getContentPane().add(ueberschrift);
this.getContentPane().add(ueberschrift2);
this.getContentPane().add(kto);
this.getContentPane().add(text1);
this.getContentPane().add(pin);
this.getContentPane().add(text2);
this.getContentPane().add(button);
this.getContentPane().add(button2);
//this.getContentPane().add(menu);
text2.addActionListener(this);
text1.addActionListener(this);
button.addActionListener(this);
button2.addActionListener(this);
}
public void actionPerformed(ActionEvent arg0) {
JButton j = (JButton)arg0.getSource();
int erg, account;
if(j == button2)
{
erg = JOptionPane.showConfirmDialog(Banking2.this, "Sind Sie sicher das sie sich einloggen möchten?", "Bestätigung",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
if( erg == JOptionPane.YES_OPTION)
{
new Kontenauswahl2( "Bankmanagement");
}
}
else
{
account = JOptionPane.showConfirmDialog(Banking2.this, "Sind Sie sicher das sie einen neuen Account anlegen möchten?", "Bestätigung",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
if( account == JOptionPane.YES_OPTION)
{
new Account( "Bankmanagement");
}
}
}
}
Ich hoffe ihr könnt mir helfen...
mfg
ich