Browse Source

Konflikt behoben

master
Adah Boukhari 5 years ago
parent
commit
ed72108975
  1. BIN
      Budget Projekt/Image/login-icon.png
  2. BIN
      Budget Projekt/bin/MeinBudgetView/LoginFrame$1.class
  3. BIN
      Budget Projekt/bin/MeinBudgetView/LoginFrame.class
  4. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui$2.class
  5. BIN
      Budget Projekt/bin/MeinBudgetView/MyMain.class
  6. BIN
      Budget Projekt/bin/MeinBudgetView/MyTest.class
  7. BIN
      Budget Projekt/bin/login-icon.png
  8. 116
      Budget Projekt/src/MeinBudgetView/LoginFrame.java
  9. 20
      Budget Projekt/src/MeinBudgetView/MeinGui.java
  10. 10
      Budget Projekt/src/MeinBudgetView/MyMain.java
  11. 18
      Budget Projekt/src/MeinBudgetView/MyTest.java

BIN
Budget Projekt/Image/login-icon.png

After

Width: 48  |  Height: 48  |  Size: 4.5 KiB

BIN
Budget Projekt/bin/MeinBudgetView/LoginFrame$1.class

BIN
Budget Projekt/bin/MeinBudgetView/LoginFrame.class

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui$2.class

BIN
Budget Projekt/bin/MeinBudgetView/MyMain.class

BIN
Budget Projekt/bin/MeinBudgetView/MyTest.class

BIN
Budget Projekt/bin/login-icon.png

After

Width: 48  |  Height: 48  |  Size: 4.5 KiB

116
Budget Projekt/src/MeinBudgetView/LoginFrame.java

@ -2,71 +2,103 @@ package MeinBudgetView;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Color;
public class LoginFrame extends JFrame {
private JPanel contentPane;
private JPasswordField passwordField;
private JTextField textField;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
LoginFrame frame = new LoginFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public class LoginFrame extends JFrame implements ActionListener {
public JPanel contentPane;
public static JPasswordField passwordField;
public static JTextField benutzername;
public JButton anmelden;
/**
* Create the frame.
*/
public LoginFrame() {
setTitle("Anmelden");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBackground(Color.WHITE);
contentPane.setBackground(Color.orange);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JButton anmelden = new JButton("Anmelden");
anmelden = new JButton("Anmelden");
anmelden.setBounds(182, 168, 97, 23);
contentPane.add(anmelden);
passwordField = new JPasswordField();
passwordField.setBounds(147, 137, 132, 20);
contentPane.add(passwordField);
textField = new JTextField();
textField.setBounds(147, 106, 132, 20);
contentPane.add(textField);
textField.setColumns(10);
JLabel lblNewLabel = new JLabel("Benutzername:");
lblNewLabel.setBounds(48, 106, 89, 20);
contentPane.add(lblNewLabel);
JLabel lblNewLabel_1 = new JLabel("Password: ");
lblNewLabel_1.setBounds(61, 140, 76, 14);
contentPane.add(lblNewLabel_1);
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);
contentPane.add(labaelBenutzername);
JLabel labelPassword = new JLabel("Password: ");
labelPassword.setBounds(61, 140, 76, 14);
contentPane.add(labelPassword);
JLabel loginImage = new JLabel("");
loginImage.setBounds(313, 106, 56, 51);
Image image1 = new ImageIcon(this.getClass().getResource("/login-icon.png")).getImage();
loginImage.setIcon(new ImageIcon(image1));
loginImage.setFont(new Font("Tahoma", Font.BOLD, 13));
contentPane.add(loginImage);
JLabel loginHauptImage = new JLabel("");
loginHauptImage.setBounds(10, 11, 56, 51);
Image image2 = new ImageIcon(this.getClass().getResource("/budgetapp.png")).getImage();
loginHauptImage.setIcon(new ImageIcon(image2));
loginHauptImage.setFont(new Font("Tahoma", Font.BOLD, 13));
contentPane.add(loginHauptImage);
this.anmelden.addActionListener(this);
passwordField.addActionListener(this);
benutzername.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == this.anmelden
&& (benutzername.getText().length() == 0 || passwordField.getText().length() == 0)) {
JOptionPane.showMessageDialog(anmelden, "Bitte geben Sie die richtigen Daten ein!");
}
if (ae.getSource() == this.anmelden && benutzername.getText().length() > 0
&& passwordField.getText().length() > 0) {
MeinGui run = new MeinGui();
run.setVisible(true);
}
}
public static String setBenutzername() {
String result = String.valueOf(benutzername);
return result;
}
public static String setPassword() {
String result = String.valueOf(benutzername);
return result;
}
}

20
Budget Projekt/src/MeinBudgetView/MeinGui.java

@ -55,30 +55,12 @@ public class MeinGui extends JFrame implements ActionListener {
private static JLabel budgetBetrag;
private static JTable myTable;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MeinGui frame = new MeinGui();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MeinGui() {
setTitle("Budget");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 654, 368);
contentPane = new JPanel();
contentPane.setBackground(Color.orange);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);

10
Budget Projekt/src/MeinBudgetView/MyMain.java

@ -0,0 +1,10 @@
package MeinBudgetView;
public class MyMain {
public static void main(String[] args) {
LoginFrame myFrame = new LoginFrame();
myFrame.setVisible(true);
}
}

18
Budget Projekt/src/MeinBudgetView/MyTest.java

@ -46,4 +46,22 @@ class MyTest {
}
@Test
public void testSetBenutzername() {
String result = String.valueOf(LoginFrame.benutzername);
assertEquals(result, LoginFrame.setBenutzername());
assertNotEquals(result + " ", LoginFrame.setBenutzername());
assertNotEquals(null, LoginFrame.setBenutzername());
}
@Test
public void testSetPassword() {
String result = String.valueOf(LoginFrame.passwordField);
assertEquals(result, LoginFrame.setPassword());
assertNotEquals(result + " ", LoginFrame.setPassword());
assertNotEquals(null, LoginFrame.setPassword());
}
}
Loading…
Cancel
Save