Browse Source

Commit_37 setBenutzername() implementiert

Mohamed
Adah Boukhari 5 years ago
parent
commit
422805acc5
  1. BIN
      Budget Projekt/bin/MeinBudgetView/LoginFrame.class
  2. BIN
      Budget Projekt/bin/MeinBudgetView/MyTest.class
  3. 22
      Budget Projekt/src/MeinBudgetView/LoginFrame.java
  4. 5
      Budget Projekt/src/MeinBudgetView/MyTest.java

BIN
Budget Projekt/bin/MeinBudgetView/LoginFrame.class

BIN
Budget Projekt/bin/MeinBudgetView/MyTest.class

22
Budget Projekt/src/MeinBudgetView/LoginFrame.java

@ -22,8 +22,8 @@ import java.awt.Color;
public class LoginFrame extends JFrame implements ActionListener {
public JPanel contentPane;
public JPasswordField passwordField;
public JTextField textField;
public static JPasswordField passwordField;
public static JTextField benutzername;
public JButton anmelden;
/**
@ -64,10 +64,10 @@ public class LoginFrame extends JFrame implements ActionListener {
passwordField.setBounds(147, 137, 132, 20);
contentPane.add(passwordField);
textField = new JTextField();
textField.setBounds(147, 106, 132, 20);
contentPane.add(textField);
textField.setColumns(10);
benutzername = new JTextField();
benutzername.setBounds(147, 106, 132, 20);
contentPane.add(benutzername);
benutzername.setColumns(10);
JLabel labaelBenutzername = new JLabel("Benutzername:");
labaelBenutzername.setBounds(48, 106, 89, 20);
@ -93,16 +93,20 @@ public class LoginFrame extends JFrame implements ActionListener {
this.anmelden.addActionListener(this);
this.passwordField.addActionListener(this);
this.textField.addActionListener(this);
this.benutzername.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == this.anmelden
&& (this.textField.getText().length() == 0 || this.passwordField.getText().length() == 0)) {
&& (benutzername.getText().length() == 0 || passwordField.getText().length() == 0)) {
JOptionPane.showMessageDialog(anmelden, "Bitte geben Sie die richtigen Daten ein!");
System.out.println("Dah");
}
}
public static String setBenutzername() {
String result = String.valueOf(benutzername);
return result;
}
}

5
Budget Projekt/src/MeinBudgetView/MyTest.java

@ -45,5 +45,10 @@ class MyTest {
assertNotEquals("-" + 4321.0 + "€", MeinGui.setExpensesView());
}
@Test
public void testSetBenutzername() {
String result = String.valueOf(LoginFrame.benutzername);
assertEquals(result, LoginFrame.setBenutzername());
}
}
Loading…
Cancel
Save