loginConfirmButton Action Listener implemented
parent
9bdae273d8
commit
11db856157
|
@ -189,7 +189,7 @@ public class Main extends JFrame {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
cardLayout.show(panelLayout, "2");
|
cardLayout.show(panelLayout, "2");
|
||||||
jframe.setSize(new Dimension(400, 150));
|
jframe.setSize(new Dimension(400, 150));
|
||||||
// implementiere einlesen der textfelder des Panels
|
// implementiere einlesen der textfelder des Panles
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -234,9 +234,15 @@ public class Main extends JFrame {
|
||||||
loginConfirmButton.addActionListener(new ActionListener() {
|
loginConfirmButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
String nameTXT = getTextfieldContent(loginName, "loginNameText");
|
||||||
|
String passwordTXT = getTextfieldContent(loginPassword, "loginPasswordText");
|
||||||
|
if(facade.sign_in_user(nameTXT, passwordTXT)) {
|
||||||
cardLayout.show(panelLayout, "4");
|
cardLayout.show(panelLayout, "4");
|
||||||
jframe.setSize(new Dimension(500, 500));
|
jframe.setSize(new Dimension(500, 500));
|
||||||
// implementiere einlesen der textfelder des Panles
|
}
|
||||||
|
else{
|
||||||
|
//vllt zukünftig implementiert
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -431,6 +437,15 @@ public class Main extends JFrame {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getTextfieldContent(JPanel panel, String name) {
|
||||||
|
for (Component component : panel.getComponents()) {
|
||||||
|
if (component instanceof JTextField && name.equals(component.getName())) {
|
||||||
|
return component.getText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public ImageIcon png(String path, int sizeX, int sizeY) { // umständlich und png nicht transparent
|
public ImageIcon png(String path, int sizeX, int sizeY) { // umständlich und png nicht transparent
|
||||||
ImageIcon icon = new ImageIcon(getClass().getResource(path)); // Path des PNGs muss angegeben werden
|
ImageIcon icon = new ImageIcon(getClass().getResource(path)); // Path des PNGs muss angegeben werden
|
||||||
Image img = icon.getImage();
|
Image img = icon.getImage();
|
||||||
|
|
Loading…
Reference in New Issue