Browse Source

Commit_42 (Bugfix) KeyListener in LoginFrame_Class hinzugefuegt. Enter_Key bei Anmelden

Mohamed
Adah Boukhari 5 years ago
parent
commit
6e1f2eb3c5
  1. BIN
      Budget Projekt/bin/MeinBudgetView/LoginFrame.class
  2. 19
      Budget Projekt/src/MeinBudgetView/LoginFrame.java

BIN
Budget Projekt/bin/MeinBudgetView/LoginFrame.class

19
Budget Projekt/src/MeinBudgetView/LoginFrame.java

@ -74,9 +74,11 @@ public class LoginFrame extends JFrame implements ActionListener, KeyListener {
contentPane.add(loginHauptImage); contentPane.add(loginHauptImage);
this.anmelden.addActionListener(this); this.anmelden.addActionListener(this);
this.anmelden.addKeyListener(this);
passwordField.addActionListener(this); passwordField.addActionListener(this);
benutzername.addActionListener(this); benutzername.addActionListener(this);
this.anmelden.addKeyListener(this);
benutzername.addKeyListener(this);
passwordField.addKeyListener(this);
} }
@Override @Override
@ -107,17 +109,20 @@ public class LoginFrame extends JFrame implements ActionListener, KeyListener {
@Override @Override
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
if (e.getSource() == this.anmelden) {
MeinGui run = new MeinGui();
run.setVisible(true);
}
// TODO Auto-generated method stub
} }
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (benutzername.getText().length() > 0 && passwordField.getText().length() > 0) {
MeinGui run = new MeinGui();
run.setVisible(true);
} else {
JOptionPane.showMessageDialog(this.anmelden, "Bitte geben Sie die richtigen Daten ein!");
}
}
} }
@Override @Override

Loading…
Cancel
Save