Browse Source

Commit_41 KeyListener in LoginFrame_Class hinzugefuegt. Enter_Key bei Anmelden

Mohamed
Adah Boukhari 5 years ago
parent
commit
7ae1fac1e7
  1. BIN
      Budget Projekt/bin/MeinBudgetView/LoginFrame.class
  2. 26
      Budget Projekt/src/MeinBudgetView/LoginFrame.java

BIN
Budget Projekt/bin/MeinBudgetView/LoginFrame.class

26
Budget Projekt/src/MeinBudgetView/LoginFrame.java

@ -6,6 +6,8 @@ import java.awt.Font;
import java.awt.Image; import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -19,7 +21,7 @@ import javax.swing.JOptionPane;
import java.awt.Color; import java.awt.Color;
public class LoginFrame extends JFrame implements ActionListener {
public class LoginFrame extends JFrame implements ActionListener, KeyListener {
public JPanel contentPane; public JPanel contentPane;
public static JPasswordField passwordField; public static JPasswordField passwordField;
@ -72,6 +74,7 @@ public class LoginFrame extends JFrame implements ActionListener {
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);
} }
@ -101,4 +104,25 @@ public class LoginFrame extends JFrame implements ActionListener {
String result = String.valueOf(benutzername); String result = String.valueOf(benutzername);
return result; return result;
} }
@Override
public void keyTyped(KeyEvent e) {
if (e.getSource() == this.anmelden) {
MeinGui run = new MeinGui();
run.setVisible(true);
}
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
} }
Loading…
Cancel
Save