From 30d805e17dab563aa8d2da82f0d374d616674946 Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 14:12:33 +0200 Subject: [PATCH 01/28] initial GUI --- src/main/java/de/hs_mannheim/ui/Main.java | 48 ++++++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 69779b1..0e21b87 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -1,6 +1,50 @@ package de.hs_mannheim.ui; -public class Main { +import de.hs_mannheim.facade.Application; + +import java.awt.*; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; + +public class Main extends JFrame { + public static void main(String[] args) { + } -} \ No newline at end of file + + private Application facade; + + private JFrame jframe; + private CardLayout cardLayout; + private JPanel panelLayout; + + private JPanel logRegScreen; + private JButton loginButton; + private JButton registerButton; + + private JPanel loginScreen; + private JPanel loginName; + private JPanel loginPassword; + private JButton loginConfirmButton; + + private JPanel registerScreen; // Backend muss PLZ und Ort prüfen, sonst kann die Entfernung in Zukunft nicht + // berechnet werden + private JPanel registerName; + private JPanel registerPassword; + private JPanel registerOrt; + private JPanel registerPLZ; + private JPanel registerCarSpeed; + private JPanel registerBikeSpeed; + private JButton registerConfirmButton; + private JLabel errorMessage; // mal gucken, vllt auch nicht + + private JPanel menu; + private JPanel searchPLZ; + private JPanel searchOrt; + private JButton searchConfirmButton; + private JButton threeRandomDestinationsButton; + private JButton logOutButton; +} + From 4a3c4dbcea27fe2df2b4a6c8428a125c92d314d2 Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 14:53:23 +0200 Subject: [PATCH 02/28] TODO Methods generated, initialize method preplaned, constructor implemented --- src/main/java/de/hs_mannheim/ui/Main.java | 135 +++++++++++++++++++++- 1 file changed, 131 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 0e21b87..d678e19 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -9,11 +9,9 @@ import javax.swing.JLabel; import javax.swing.JPanel; public class Main extends JFrame { - public static void main(String[] args) { - + Main main = new Main("35a75437476f12302f72e55d368485db"); } - private Application facade; private JFrame jframe; @@ -46,5 +44,134 @@ public class Main extends JFrame { private JButton searchConfirmButton; private JButton threeRandomDestinationsButton; private JButton logOutButton; -} + public Main(String api_key) { + this.facade = new Application(api_key); + initialize(); + } + + public void initialize() { + jframe = new JFrame(); + cardLayout = new CardLayout(); + panelLayout = new JPanel(cardLayout); + panelLayout.setLayout(cardLayout); + jframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE); + + logRegScreen = new JPanel(new BorderLayout()); + loginButtonCreate(); + registerButtonCreate(); + + loginScreen = new JPanel(new BorderLayout()); + loginNameCreate(); + loginPasswortCreate(); + loginConfirmButtonCreate(); + + registerScreenCreate(); + registerNameCreate(); + registerPasswortCreate(); + registerOrtCreate(); + registerPLZCreate(); + registerCarSpeed(); + registerBikeSpeed(); + registerConfirmButton(); + + menu = new JPanel(new BorderLayout()); + searchPLZCreate(); + searchOrtCreate(); + searchConfirmButton(); + threeRandomDestinationsButtonCreate(); + logOutButtonCreate(); + + } + + private void loginButtonCreate() { + // TODO Auto-generated method stub + + } + + private void registerButtonCreate() { + // TODO Auto-generated method stub + + } + + private void loginNameCreate() { + // TODO Auto-generated method stub + + } + + private void loginPasswortCreate() { + // TODO Auto-generated method stub + + } + + private void loginConfirmButtonCreate() { + // TODO Auto-generated method stub + + } + + private void registerScreenCreate() { + // TODO Auto-generated method stub + + } + + private void registerNameCreate() { + // TODO Auto-generated method stub + + } + + private void registerPasswortCreate() { + // TODO Auto-generated method stub + + } + + private void registerOrtCreate() { + // TODO Auto-generated method stub + + } + + private void registerPLZCreate() { + // TODO Auto-generated method stub + + } + + private void registerCarSpeed() { + // TODO Auto-generated method stub + + } + + private void registerBikeSpeed() { + // TODO Auto-generated method stub + + } + + private void registerConfirmButton() { + // TODO Auto-generated method stub + + } + + private void searchPLZCreate() { + // TODO Auto-generated method stub + + } + + private void searchOrtCreate() { + // TODO Auto-generated method stub + + } + + private void searchConfirmButton() { + // TODO Auto-generated method stub + + } + + private void threeRandomDestinationsButtonCreate() { + // TODO Auto-generated method stub + + } + + private void logOutButtonCreate() { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file From 8d83fc784c85f37495354a9d4e862d8ddb785c07 Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 14:55:21 +0200 Subject: [PATCH 03/28] organized PanleLayout and initialized attributes in corresponding methods --- src/main/java/de/hs_mannheim/ui/Main.java | 88 ++++++++++++++--------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index d678e19..3cf3270 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -12,6 +12,7 @@ public class Main extends JFrame { public static void main(String[] args) { Main main = new Main("35a75437476f12302f72e55d368485db"); } + private Application facade; private JFrame jframe; @@ -60,117 +61,134 @@ public class Main extends JFrame { logRegScreen = new JPanel(new BorderLayout()); loginButtonCreate(); registerButtonCreate(); + logRegScreen.add(loginButton, BorderLayout.WEST); + logRegScreen.add(registerButton, BorderLayout.EAST); loginScreen = new JPanel(new BorderLayout()); loginNameCreate(); - loginPasswortCreate(); + loginPasswordCreate(); loginConfirmButtonCreate(); + loginScreen.add(loginName, BorderLayout.NORTH); + loginScreen.add(loginPassword, BorderLayout.CENTER); + loginScreen.add(loginConfirmButton, BorderLayout.SOUTH); - registerScreenCreate(); + registerScreen = new JPanel(new FlowLayout()); // flowLayout muss angepasst werden, um nicht scheiße auszusehen registerNameCreate(); - registerPasswortCreate(); + registerPasswordCreate(); registerOrtCreate(); registerPLZCreate(); - registerCarSpeed(); - registerBikeSpeed(); - registerConfirmButton(); + registerCarSpeedCreate(); + registerBikeSpeedCreate(); + registerConfirmButtonCreate(); + registerScreen.add(registerName); + registerScreen.add(registerPassword); + registerScreen.add(registerOrt); + registerScreen.add(registerCarSpeed); + registerScreen.add(registerBikeSpeed); + registerScreen.add(registerConfirmButton); menu = new JPanel(new BorderLayout()); searchPLZCreate(); searchOrtCreate(); - searchConfirmButton(); + searchConfirmButtonCreate(); threeRandomDestinationsButtonCreate(); logOutButtonCreate(); + // muss noch konzepiert werden + panelLayout.add(logRegScreen, "1"); + panelLayout.add(loginScreen, "2"); + panelLayout.add(registerScreen, "3"); + panelLayout.add(menu, "4"); + cardLayout.show(panelLayout, "1"); + jframe.add(panelLayout); + jframe.setResizable(false); + jframe.setSize(500, 500); + jframe.setLocationRelativeTo(null); + jframe.setVisible(true); } private void loginButtonCreate() { - // TODO Auto-generated method stub + loginButton = new JButton(); } private void registerButtonCreate() { - // TODO Auto-generated method stub + registerButton = new JButton(); } private void loginNameCreate() { - // TODO Auto-generated method stub + loginName = new JPanel(); } - private void loginPasswortCreate() { - // TODO Auto-generated method stub + private void loginPasswordCreate() { + loginPassword = new JPanel(); } private void loginConfirmButtonCreate() { - // TODO Auto-generated method stub - - } - - private void registerScreenCreate() { - // TODO Auto-generated method stub + loginConfirmButton = new JButton(); } private void registerNameCreate() { - // TODO Auto-generated method stub + registerName = new JPanel(); } - private void registerPasswortCreate() { - // TODO Auto-generated method stub + private void registerPasswordCreate() { + registerPassword = new JPanel(); } private void registerOrtCreate() { - // TODO Auto-generated method stub + registerOrt = new JPanel(); } private void registerPLZCreate() { - // TODO Auto-generated method stub + registerPLZ = new JPanel(); } - private void registerCarSpeed() { - // TODO Auto-generated method stub + private void registerCarSpeedCreate() { + registerCarSpeed = new JPanel(); } - private void registerBikeSpeed() { - // TODO Auto-generated method stub + private void registerBikeSpeedCreate() { + registerBikeSpeed = new JPanel(); } - private void registerConfirmButton() { - // TODO Auto-generated method stub + private void registerConfirmButtonCreate() { + registerConfirmButton = new JButton(); } private void searchPLZCreate() { - // TODO Auto-generated method stub + searchPLZ = new JPanel(); } private void searchOrtCreate() { - // TODO Auto-generated method stub + searchOrt = new JPanel(); } - private void searchConfirmButton() { - // TODO Auto-generated method stub + private void searchConfirmButtonCreate() { + searchConfirmButton = new JButton(); } private void threeRandomDestinationsButtonCreate() { - // TODO Auto-generated method stub + threeRandomDestinationsButton = new JButton(); } private void logOutButtonCreate() { - // TODO Auto-generated method stub + logOutButton = new JButton(); } From 609002928420bbc628d9a490ccf5d27e88d8939b Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 14:59:21 +0200 Subject: [PATCH 04/28] completed LogReg Panel and its components --- src/main/java/de/hs_mannheim/ui/Main.java | 32 ++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 3cf3270..bb35900 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -3,16 +3,19 @@ package de.hs_mannheim.ui; import de.hs_mannheim.facade.Application; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JTextField; public class Main extends JFrame { public static void main(String[] args) { Main main = new Main("35a75437476f12302f72e55d368485db"); } - private Application facade; private JFrame jframe; @@ -58,7 +61,7 @@ public class Main extends JFrame { panelLayout.setLayout(cardLayout); jframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE); - logRegScreen = new JPanel(new BorderLayout()); + logRegScreen = new JPanel(new FlowLayout()); loginButtonCreate(); registerButtonCreate(); logRegScreen.add(loginButton, BorderLayout.WEST); @@ -102,19 +105,36 @@ public class Main extends JFrame { cardLayout.show(panelLayout, "1"); jframe.add(panelLayout); jframe.setResizable(false); - jframe.setSize(500, 500); + jframe.setSize(450, 140); jframe.setLocationRelativeTo(null); jframe.setVisible(true); } private void loginButtonCreate() { - loginButton = new JButton(); + loginButton = new JButton("Login"); + loginButton.setPreferredSize(new Dimension(150, 50)); + loginButton.setFocusable(false); + loginButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "2"); + jframe.setSize(new Dimension(500, 500)); + } + }); } private void registerButtonCreate() { - registerButton = new JButton(); - + registerButton = new JButton("Register"); + registerButton.setPreferredSize(new Dimension(150, 50)); + registerButton.setFocusable(false); + registerButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "3"); + jframe.setSize(new Dimension(500, 500)); + } + }); } private void loginNameCreate() { From 8f5211a5eff6ba73ed4e6c3e6693ad53b514bb6a Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 15:03:13 +0200 Subject: [PATCH 05/28] completed Login Panel and its components --- src/main/java/de/hs_mannheim/ui/Main.java | 37 +++++++++++++++++------ 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index bb35900..27d204f 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -67,13 +67,13 @@ public class Main extends JFrame { logRegScreen.add(loginButton, BorderLayout.WEST); logRegScreen.add(registerButton, BorderLayout.EAST); - loginScreen = new JPanel(new BorderLayout()); + loginScreen = new JPanel(new FlowLayout()); loginNameCreate(); loginPasswordCreate(); loginConfirmButtonCreate(); - loginScreen.add(loginName, BorderLayout.NORTH); - loginScreen.add(loginPassword, BorderLayout.CENTER); - loginScreen.add(loginConfirmButton, BorderLayout.SOUTH); + loginScreen.add(loginName); + loginScreen.add(loginPassword); + loginScreen.add(loginConfirmButton); registerScreen = new JPanel(new FlowLayout()); // flowLayout muss angepasst werden, um nicht scheiße auszusehen registerNameCreate(); @@ -118,7 +118,8 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "2"); - jframe.setSize(new Dimension(500, 500)); + jframe.setSize(new Dimension(500, 120)); + // implementiere einlesen der textfelder des Panles } }); @@ -133,23 +134,41 @@ public class Main extends JFrame { public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "3"); jframe.setSize(new Dimension(500, 500)); + // implementiere einlesen der textfelder des Panles } }); } private void loginNameCreate() { loginName = new JPanel(); - + JLabel jl = new JLabel("Name"); + JTextField tf = new JTextField(10); + tf.setName("loginNameText"); + loginName.add(jl); + loginName.add(tf); } private void loginPasswordCreate() { loginPassword = new JPanel(); - + JLabel jl = new JLabel("Passwort"); + JTextField tf = new JTextField(10); + tf.setName("loginPasswordText"); + loginPassword.add(jl); + loginPassword.add(tf); } private void loginConfirmButtonCreate() { - loginConfirmButton = new JButton(); - + loginConfirmButton = new JButton("Confirm"); + loginConfirmButton.setPreferredSize(new Dimension(80, 20)); + loginConfirmButton.setFocusable(false); + loginConfirmButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "4"); + jframe.setSize(new Dimension(500, 500)); + // implementiere einlesen der textfelder des Panles + } + }); } private void registerNameCreate() { From f8c35aca983d9f2461fce7970ec3613e6fcce564 Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 15:05:47 +0200 Subject: [PATCH 06/28] completed Register Panel and its components --- src/main/java/de/hs_mannheim/ui/Main.java | 52 +++++++++++++++++++---- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 27d204f..0676aa5 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -133,7 +133,7 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "3"); - jframe.setSize(new Dimension(500, 500)); + jframe.setSize(new Dimension(500, 120)); // implementiere einlesen der textfelder des Panles } }); @@ -173,37 +173,71 @@ public class Main extends JFrame { private void registerNameCreate() { registerName = new JPanel(); - + JLabel jl = new JLabel("Name"); + JTextField tf = new JTextField(10); + tf.setName("loginPasswordText"); + registerName.add(jl); + registerName.add(tf); } private void registerPasswordCreate() { registerPassword = new JPanel(); - + JLabel jl = new JLabel("Passwort"); + JTextField tf = new JTextField(10); + tf.setName("loginPasswordText"); + registerPassword.add(jl); + registerPassword.add(tf); } private void registerOrtCreate() { registerOrt = new JPanel(); - + JLabel jl = new JLabel("Ort"); + JTextField tf = new JTextField(10); + tf.setName("loginPasswordText"); + registerOrt.add(jl); + registerOrt.add(tf); } private void registerPLZCreate() { registerPLZ = new JPanel(); - + JLabel jl = new JLabel("PLZ"); + JTextField tf = new JTextField(10); + tf.setName("loginPasswordText"); + registerPLZ.add(jl); + registerPLZ.add(tf); } private void registerCarSpeedCreate() { registerCarSpeed = new JPanel(); - + JLabel jl = new JLabel("Auto km/h"); + JTextField tf = new JTextField(10); + tf.setName("loginPasswordText"); + registerCarSpeed.add(jl); + registerCarSpeed.add(tf); } private void registerBikeSpeedCreate() { registerBikeSpeed = new JPanel(); - + JLabel jl = new JLabel("Bike km/h"); + JTextField tf = new JTextField(10); + tf.setName("bikeSpeedText"); + registerBikeSpeed.add(jl); + registerBikeSpeed.add(tf); } private void registerConfirmButtonCreate() { registerConfirmButton = new JButton(); - + registerConfirmButton = new JButton("Confirm"); + registerConfirmButton.setPreferredSize(new Dimension(80, 20)); + registerConfirmButton.setFocusable(false); + registerConfirmButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "4"); + jframe.setSize(new Dimension(500, 500)); + // implementiere einlesen der textfelder des Panles + } + }); } private void searchPLZCreate() { @@ -231,4 +265,4 @@ public class Main extends JFrame { } -} \ No newline at end of file +} From 1e7bb5cdfe54e3886c2461ae3fc2f09ace95028a Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 15:13:59 +0200 Subject: [PATCH 07/28] completed App Panel and its components --- src/main/java/de/hs_mannheim/ui/Main.java | 63 ++++++++++++++++++----- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 0676aa5..0306886 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -13,9 +13,6 @@ import javax.swing.JPanel; import javax.swing.JTextField; public class Main extends JFrame { - public static void main(String[] args) { - Main main = new Main("35a75437476f12302f72e55d368485db"); - } private Application facade; private JFrame jframe; @@ -90,13 +87,22 @@ public class Main extends JFrame { registerScreen.add(registerBikeSpeed); registerScreen.add(registerConfirmButton); - menu = new JPanel(new BorderLayout()); + menu = new JPanel(null); searchPLZCreate(); searchOrtCreate(); searchConfirmButtonCreate(); threeRandomDestinationsButtonCreate(); logOutButtonCreate(); - // muss noch konzepiert werden + searchPLZ.setBounds(160, 0, 200, 200); + searchOrt.setBounds(0, 0, 200, 200); + searchConfirmButton.setBounds(360, 5, 90, 20); + threeRandomDestinationsButton.setBounds(360, 40, 90, 20); + logOutButton.setBounds(380, 420, 90, 30); + menu.add(searchPLZ); + menu.add(searchOrt); + menu.add(searchConfirmButton); + menu.add(threeRandomDestinationsButton); + menu.add(logOutButton); panelLayout.add(logRegScreen, "1"); panelLayout.add(loginScreen, "2"); @@ -242,27 +248,58 @@ public class Main extends JFrame { private void searchPLZCreate() { searchPLZ = new JPanel(); - + JLabel jl = new JLabel("PLZ"); + JTextField tf = new JTextField(10); + tf.setName("plzSuche"); + searchPLZ.add(jl); + searchPLZ.add(tf); } private void searchOrtCreate() { searchOrt = new JPanel(); - + JLabel jl = new JLabel("Ort"); + JTextField tf = new JTextField(10); + tf.setName("ortSuche"); + searchOrt.add(jl); + searchOrt.add(tf); } private void searchConfirmButtonCreate() { - searchConfirmButton = new JButton(); - + searchConfirmButton = new JButton("Suche"); + searchConfirmButton.setPreferredSize(new Dimension(150, 50)); + searchConfirmButton.setFocusable(false); + searchConfirmButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // implementiere Änderung vom Panel + } + }); } private void threeRandomDestinationsButtonCreate() { - threeRandomDestinationsButton = new JButton(); - + threeRandomDestinationsButton = new JButton("Kurztrip"); + threeRandomDestinationsButton.setPreferredSize(new Dimension(150, 50)); + threeRandomDestinationsButton.setFocusable(false); + threeRandomDestinationsButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // implementiere Änderung vom Panel + } + }); } private void logOutButtonCreate() { - logOutButton = new JButton(); - + logOutButton = new JButton("Logout"); + logOutButton.setPreferredSize(new Dimension(150, 50)); + logOutButton.setFocusable(false); + logOutButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "1"); + jframe.setSize(new Dimension(450, 120)); + // implementiere Ausloggen im Backend + } + }); } } From d803f6df2a13762fcbaba43dbc420daa325ec23a Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 16:02:25 +0200 Subject: [PATCH 08/28] Added components to App Panel --- src/main/java/de/hs_mannheim/ui/Main.java | 136 ++++++++++++++++++---- 1 file changed, 115 insertions(+), 21 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 0306886..ee4a4f8 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -13,12 +13,19 @@ import javax.swing.JPanel; import javax.swing.JTextField; public class Main extends JFrame { + public static void main(String[] args) { + Main main = new Main("35a75437476f12302f72e55d368485db"); + } private Application facade; private JFrame jframe; private CardLayout cardLayout; private JPanel panelLayout; + //Wird in mehreren Labels benutzt (reg und log) + private JPanel errorMessage; // mal gucken, vllt auch nicht + private JPanel profile; //wird nach registrieren oder login kreiert + private JPanel logRegScreen; private JButton loginButton; private JButton registerButton; @@ -27,23 +34,26 @@ public class Main extends JFrame { private JPanel loginName; private JPanel loginPassword; private JButton loginConfirmButton; + private JButton loginZurückButton; - private JPanel registerScreen; // Backend muss PLZ und Ort prüfen, sonst kann die Entfernung in Zukunft nicht - // berechnet werden + private JPanel registerScreen; // Backend muss PLZ und Ort prüfen, sonst kann die Entfernung in Zukunft nicht berechnet werden private JPanel registerName; private JPanel registerPassword; private JPanel registerOrt; private JPanel registerPLZ; + private JPanel registerCarName; private JPanel registerCarSpeed; + private JPanel registerCarCO2; private JPanel registerBikeSpeed; private JButton registerConfirmButton; - private JLabel errorMessage; // mal gucken, vllt auch nicht + private JButton registerZurückButton; private JPanel menu; private JPanel searchPLZ; private JPanel searchOrt; private JButton searchConfirmButton; - private JButton threeRandomDestinationsButton; + private JButton randDestinationsCarButton; + private JButton randDestinationsBikeButton; private JButton logOutButton; public Main(String api_key) { @@ -58,6 +68,8 @@ public class Main extends JFrame { panelLayout.setLayout(cardLayout); jframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE); + errorMessageCreate();//wahrscheinlich muss individuell angepasst werden + logRegScreen = new JPanel(new FlowLayout()); loginButtonCreate(); registerButtonCreate(); @@ -68,40 +80,52 @@ public class Main extends JFrame { loginNameCreate(); loginPasswordCreate(); loginConfirmButtonCreate(); + loginZurückButtonCreate(); loginScreen.add(loginName); loginScreen.add(loginPassword); loginScreen.add(loginConfirmButton); + loginScreen.add(loginZurückButton); + loginScreen.add(loginZurückButton); registerScreen = new JPanel(new FlowLayout()); // flowLayout muss angepasst werden, um nicht scheiße auszusehen registerNameCreate(); registerPasswordCreate(); registerOrtCreate(); registerPLZCreate(); + registerCarNameCreate(); registerCarSpeedCreate(); + registerCarCO2Create(); registerBikeSpeedCreate(); registerConfirmButtonCreate(); + registerZurückButtonCreate(); registerScreen.add(registerName); registerScreen.add(registerPassword); registerScreen.add(registerOrt); + registerScreen.add(registerPLZ); registerScreen.add(registerCarSpeed); registerScreen.add(registerBikeSpeed); registerScreen.add(registerConfirmButton); + registerScreen.add(registerZurückButton); + registerScreen.add(registerZurückButton); menu = new JPanel(null); searchPLZCreate(); searchOrtCreate(); searchConfirmButtonCreate(); - threeRandomDestinationsButtonCreate(); + randDestinationsCarButtonCreate(); + randDestinationsBikeButtonCreate(); logOutButtonCreate(); searchPLZ.setBounds(160, 0, 200, 200); searchOrt.setBounds(0, 0, 200, 200); searchConfirmButton.setBounds(360, 5, 90, 20); - threeRandomDestinationsButton.setBounds(360, 40, 90, 20); + randDestinationsCarButton.setBounds(360, 40, 90, 20); + randDestinationsBikeButton.setBounds(360, 75, 90, 20); logOutButton.setBounds(380, 420, 90, 30); menu.add(searchPLZ); menu.add(searchOrt); menu.add(searchConfirmButton); - menu.add(threeRandomDestinationsButton); + menu.add(randDestinationsCarButton); + menu.add(randDestinationsBikeButton); menu.add(logOutButton); panelLayout.add(logRegScreen, "1"); @@ -116,6 +140,20 @@ public class Main extends JFrame { jframe.setVisible(true); } + private void profileCreate() { + profile = new JPanel(); + JLabel jl = new JLabel("Profil"); + searchOrt.add(jl); + //Backend soll DatenLiefern + } + + private void errorMessageCreate() { + errorMessage = new JPanel(); + JLabel jl = new JLabel("Daten sind falsch oder unvollständig!"); + errorMessage.add(jl); + } + + private void loginButtonCreate() { loginButton = new JButton("Login"); loginButton.setPreferredSize(new Dimension(150, 50)); @@ -124,8 +162,8 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "2"); - jframe.setSize(new Dimension(500, 120)); - // implementiere einlesen der textfelder des Panles + jframe.setSize(new Dimension(500, 180)); + // implementiere einlesen der textfelder des Panels } }); @@ -139,7 +177,7 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "3"); - jframe.setSize(new Dimension(500, 120)); + jframe.setSize(new Dimension(520, 180)); // implementiere einlesen der textfelder des Panles } }); @@ -177,11 +215,24 @@ public class Main extends JFrame { }); } + private void loginZurückButtonCreate() { + loginZurückButton = new JButton("Back"); + loginZurückButton.setPreferredSize(new Dimension(80, 20)); + loginZurückButton.setFocusable(false); + loginZurückButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "1"); + jframe.setSize(new Dimension(450, 140)); + } + }); + } + private void registerNameCreate() { registerName = new JPanel(); JLabel jl = new JLabel("Name"); JTextField tf = new JTextField(10); - tf.setName("loginPasswordText"); + tf.setName("registerPasswordText"); registerName.add(jl); registerName.add(tf); } @@ -190,7 +241,7 @@ public class Main extends JFrame { registerPassword = new JPanel(); JLabel jl = new JLabel("Passwort"); JTextField tf = new JTextField(10); - tf.setName("loginPasswordText"); + tf.setName("registerPasswordText"); registerPassword.add(jl); registerPassword.add(tf); } @@ -199,7 +250,7 @@ public class Main extends JFrame { registerOrt = new JPanel(); JLabel jl = new JLabel("Ort"); JTextField tf = new JTextField(10); - tf.setName("loginPasswordText"); + tf.setName("registerOrtText"); registerOrt.add(jl); registerOrt.add(tf); } @@ -208,25 +259,43 @@ public class Main extends JFrame { registerPLZ = new JPanel(); JLabel jl = new JLabel("PLZ"); JTextField tf = new JTextField(10); - tf.setName("loginPasswordText"); + tf.setName("registerPLZText"); registerPLZ.add(jl); registerPLZ.add(tf); } + private void registerCarNameCreate() { + registerCarName = new JPanel(); + JLabel jl = new JLabel("Auto km/h"); + JTextField tf = new JTextField(10); + tf.setName("registerCarNameText"); + registerCarName.add(jl); + registerCarName.add(tf); + } + private void registerCarSpeedCreate() { registerCarSpeed = new JPanel(); JLabel jl = new JLabel("Auto km/h"); JTextField tf = new JTextField(10); - tf.setName("loginPasswordText"); + tf.setName("registerCarSpeedText"); registerCarSpeed.add(jl); registerCarSpeed.add(tf); } + private void registerCarCO2Create() { + registerCarCO2 = new JPanel(); + JLabel jl = new JLabel("Auto km/h"); + JTextField tf = new JTextField(10); + tf.setName("registerCarCO2Text"); + registerCarCO2.add(jl); + registerCarCO2.add(tf); + } + private void registerBikeSpeedCreate() { registerBikeSpeed = new JPanel(); JLabel jl = new JLabel("Bike km/h"); JTextField tf = new JTextField(10); - tf.setName("bikeSpeedText"); + tf.setName("registerBikeSpeedText"); registerBikeSpeed.add(jl); registerBikeSpeed.add(tf); } @@ -246,6 +315,19 @@ public class Main extends JFrame { }); } + private void registerZurückButtonCreate() { + registerZurückButton = new JButton("Back"); + registerZurückButton.setPreferredSize(new Dimension(80, 20)); + registerZurückButton.setFocusable(false); + registerZurückButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "1"); + jframe.setSize(new Dimension(450, 140)); + } + }); + } + private void searchPLZCreate() { searchPLZ = new JPanel(); JLabel jl = new JLabel("PLZ"); @@ -276,11 +358,23 @@ public class Main extends JFrame { }); } - private void threeRandomDestinationsButtonCreate() { - threeRandomDestinationsButton = new JButton("Kurztrip"); - threeRandomDestinationsButton.setPreferredSize(new Dimension(150, 50)); - threeRandomDestinationsButton.setFocusable(false); - threeRandomDestinationsButton.addActionListener(new ActionListener() { + private void randDestinationsCarButtonCreate() { //Auto Icon hinzufügen + randDestinationsCarButton = new JButton("Kurztrip"); + randDestinationsCarButton.setPreferredSize(new Dimension(150, 50)); + randDestinationsCarButton.setFocusable(false); + randDestinationsCarButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // implementiere Änderung vom Panel + } + }); + } + + private void randDestinationsBikeButtonCreate() { //Fahrrad Icon hinzufügen + randDestinationsBikeButton = new JButton("Kurztrip"); + randDestinationsBikeButton.setPreferredSize(new Dimension(150, 50)); + randDestinationsBikeButton.setFocusable(false); + randDestinationsBikeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // implementiere Änderung vom Panel From 316222e8b5e97b393e7f57682c0e22d2f613a022 Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 16:05:05 +0200 Subject: [PATCH 09/28] Cosmetic changes to most panels --- src/main/java/de/hs_mannheim/ui/Main.java | 134 +++++++++++++--------- 1 file changed, 80 insertions(+), 54 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index ee4a4f8..faa69ad 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -6,11 +6,14 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.BorderFactory; +import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; public class Main extends JFrame { public static void main(String[] args) { @@ -24,18 +27,20 @@ public class Main extends JFrame { //Wird in mehreren Labels benutzt (reg und log) private JPanel errorMessage; // mal gucken, vllt auch nicht - private JPanel profile; //wird nach registrieren oder login kreiert + private JLabel mainMenuLabel; private JPanel logRegScreen; private JButton loginButton; private JButton registerButton; + private JLabel loginLabel; private JPanel loginScreen; private JPanel loginName; private JPanel loginPassword; private JButton loginConfirmButton; private JButton loginZurückButton; + private JLabel registerLabel; private JPanel registerScreen; // Backend muss PLZ und Ort prüfen, sonst kann die Entfernung in Zukunft nicht berechnet werden private JPanel registerName; private JPanel registerPassword; @@ -48,12 +53,13 @@ public class Main extends JFrame { private JButton registerConfirmButton; private JButton registerZurückButton; + private JLabel menuLabel; private JPanel menu; - private JPanel searchPLZ; - private JPanel searchOrt; + private JPanel searchPLZ_ORT; private JButton searchConfirmButton; private JButton randDestinationsCarButton; private JButton randDestinationsBikeButton; + private JPanel profile; private JButton logOutButton; public Main(String api_key) { @@ -71,23 +77,30 @@ public class Main extends JFrame { errorMessageCreate();//wahrscheinlich muss individuell angepasst werden logRegScreen = new JPanel(new FlowLayout()); + mainMenuLabel = new JLabel(" Hauptmenü "); + mainMenuLabel.setFont(new Font("Arial", Font.PLAIN, 24)); loginButtonCreate(); registerButtonCreate(); + logRegScreen.add(mainMenuLabel); logRegScreen.add(loginButton, BorderLayout.WEST); logRegScreen.add(registerButton, BorderLayout.EAST); loginScreen = new JPanel(new FlowLayout()); + loginLabel = new JLabel(" Einloggen "); + loginLabel.setFont(new Font("Arial", Font.PLAIN, 24)); loginNameCreate(); loginPasswordCreate(); loginConfirmButtonCreate(); loginZurückButtonCreate(); + loginScreen.add(loginLabel); loginScreen.add(loginName); loginScreen.add(loginPassword); loginScreen.add(loginConfirmButton); loginScreen.add(loginZurückButton); - loginScreen.add(loginZurückButton); registerScreen = new JPanel(new FlowLayout()); // flowLayout muss angepasst werden, um nicht scheiße auszusehen + registerLabel = new JLabel("Registrieren"); + registerLabel.setFont(new Font("Arial", Font.PLAIN, 24)); registerNameCreate(); registerPasswordCreate(); registerOrtCreate(); @@ -98,31 +111,34 @@ public class Main extends JFrame { registerBikeSpeedCreate(); registerConfirmButtonCreate(); registerZurückButtonCreate(); + registerScreen.add(registerLabel); registerScreen.add(registerName); registerScreen.add(registerPassword); registerScreen.add(registerOrt); registerScreen.add(registerPLZ); + registerScreen.add(registerCarName); registerScreen.add(registerCarSpeed); + registerScreen.add(registerCarCO2); registerScreen.add(registerBikeSpeed); registerScreen.add(registerConfirmButton); registerScreen.add(registerZurückButton); - registerScreen.add(registerZurückButton); menu = new JPanel(null); - searchPLZCreate(); - searchOrtCreate(); + menuLabel = new JLabel("Gugl Maps"); + menuLabel.setFont(new Font("Arial", Font.PLAIN, 24)); + searchPLZ_ORTCreate(); searchConfirmButtonCreate(); randDestinationsCarButtonCreate(); randDestinationsBikeButtonCreate(); logOutButtonCreate(); - searchPLZ.setBounds(160, 0, 200, 200); - searchOrt.setBounds(0, 0, 200, 200); - searchConfirmButton.setBounds(360, 5, 90, 20); - randDestinationsCarButton.setBounds(360, 40, 90, 20); - randDestinationsBikeButton.setBounds(360, 75, 90, 20); - logOutButton.setBounds(380, 420, 90, 30); - menu.add(searchPLZ); - menu.add(searchOrt); + menuLabel.setBounds(180, -125, 300, 300); + searchPLZ_ORT.setBounds(20, 50, 300, 100); + searchConfirmButton.setBounds(346, 70, 110, 30); + randDestinationsCarButton.setBounds(346, 115, 110, 30); + randDestinationsBikeButton.setBounds(346, 160, 110, 30); + logOutButton.setBounds(346, 420, 110, 30); + menu.add(menuLabel); + menu.add(searchPLZ_ORT); menu.add(searchConfirmButton); menu.add(randDestinationsCarButton); menu.add(randDestinationsBikeButton); @@ -135,18 +151,11 @@ public class Main extends JFrame { cardLayout.show(panelLayout, "1"); jframe.add(panelLayout); jframe.setResizable(false); - jframe.setSize(450, 140); + jframe.setSize(450, 160); jframe.setLocationRelativeTo(null); jframe.setVisible(true); } - private void profileCreate() { - profile = new JPanel(); - JLabel jl = new JLabel("Profil"); - searchOrt.add(jl); - //Backend soll DatenLiefern - } - private void errorMessageCreate() { errorMessage = new JPanel(); JLabel jl = new JLabel("Daten sind falsch oder unvollständig!"); @@ -162,7 +171,7 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "2"); - jframe.setSize(new Dimension(500, 180)); + jframe.setSize(new Dimension(400, 150)); // implementiere einlesen der textfelder des Panels } }); @@ -177,7 +186,7 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "3"); - jframe.setSize(new Dimension(520, 180)); + jframe.setSize(new Dimension(260, 390)); // implementiere einlesen der textfelder des Panles } }); @@ -230,7 +239,7 @@ public class Main extends JFrame { private void registerNameCreate() { registerName = new JPanel(); - JLabel jl = new JLabel("Name"); + JLabel jl = new JLabel(" Name"); JTextField tf = new JTextField(10); tf.setName("registerPasswordText"); registerName.add(jl); @@ -239,7 +248,7 @@ public class Main extends JFrame { private void registerPasswordCreate() { registerPassword = new JPanel(); - JLabel jl = new JLabel("Passwort"); + JLabel jl = new JLabel(" Passwort"); JTextField tf = new JTextField(10); tf.setName("registerPasswordText"); registerPassword.add(jl); @@ -248,7 +257,7 @@ public class Main extends JFrame { private void registerOrtCreate() { registerOrt = new JPanel(); - JLabel jl = new JLabel("Ort"); + JLabel jl = new JLabel(" Ort"); JTextField tf = new JTextField(10); tf.setName("registerOrtText"); registerOrt.add(jl); @@ -257,7 +266,7 @@ public class Main extends JFrame { private void registerPLZCreate() { registerPLZ = new JPanel(); - JLabel jl = new JLabel("PLZ"); + JLabel jl = new JLabel(" PLZ"); JTextField tf = new JTextField(10); tf.setName("registerPLZText"); registerPLZ.add(jl); @@ -266,7 +275,7 @@ public class Main extends JFrame { private void registerCarNameCreate() { registerCarName = new JPanel(); - JLabel jl = new JLabel("Auto km/h"); + JLabel jl = new JLabel(" Auto Name"); JTextField tf = new JTextField(10); tf.setName("registerCarNameText"); registerCarName.add(jl); @@ -275,7 +284,7 @@ public class Main extends JFrame { private void registerCarSpeedCreate() { registerCarSpeed = new JPanel(); - JLabel jl = new JLabel("Auto km/h"); + JLabel jl = new JLabel(" Auto km/h"); JTextField tf = new JTextField(10); tf.setName("registerCarSpeedText"); registerCarSpeed.add(jl); @@ -284,7 +293,7 @@ public class Main extends JFrame { private void registerCarCO2Create() { registerCarCO2 = new JPanel(); - JLabel jl = new JLabel("Auto km/h"); + JLabel jl = new JLabel("Verbrauch/100km"); JTextField tf = new JTextField(10); tf.setName("registerCarCO2Text"); registerCarCO2.add(jl); @@ -293,7 +302,7 @@ public class Main extends JFrame { private void registerBikeSpeedCreate() { registerBikeSpeed = new JPanel(); - JLabel jl = new JLabel("Bike km/h"); + JLabel jl = new JLabel(" Bike km/h"); JTextField tf = new JTextField(10); tf.setName("registerBikeSpeedText"); registerBikeSpeed.add(jl); @@ -328,28 +337,25 @@ public class Main extends JFrame { }); } - private void searchPLZCreate() { - searchPLZ = new JPanel(); - JLabel jl = new JLabel("PLZ"); - JTextField tf = new JTextField(10); - tf.setName("plzSuche"); - searchPLZ.add(jl); - searchPLZ.add(tf); - } - - private void searchOrtCreate() { - searchOrt = new JPanel(); - JLabel jl = new JLabel("Ort"); - JTextField tf = new JTextField(10); + private void searchPLZ_ORTCreate() { + searchPLZ_ORT = new JPanel(); + JLabel jl = new JLabel("Plz oder Ort"); + JTextField tf = new JTextField(28); tf.setName("ortSuche"); - searchOrt.add(jl); - searchOrt.add(tf); + searchPLZ_ORT.add(jl); + searchPLZ_ORT.add(tf); } private void searchConfirmButtonCreate() { - searchConfirmButton = new JButton("Suche"); - searchConfirmButton.setPreferredSize(new Dimension(150, 50)); + searchConfirmButton = new JButton(); + searchConfirmButton.setPreferredSize(new Dimension(150, 80)); searchConfirmButton.setFocusable(false); + + ImageIcon icon = png("lupe.png", 20, 20); + searchConfirmButton.setIcon(icon); + searchConfirmButton.setText(" Suche"); + searchConfirmButton.setIconTextGap(3); + searchConfirmButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -359,9 +365,15 @@ public class Main extends JFrame { } private void randDestinationsCarButtonCreate() { //Auto Icon hinzufügen - randDestinationsCarButton = new JButton("Kurztrip"); - randDestinationsCarButton.setPreferredSize(new Dimension(150, 50)); + randDestinationsCarButton = new JButton(); + randDestinationsCarButton.setPreferredSize(new Dimension(150, 80)); randDestinationsCarButton.setFocusable(false); + + ImageIcon icon = png("auto.png", 20, 20); + randDestinationsCarButton.setIcon(icon); + randDestinationsCarButton.setText("Kurztrip"); + randDestinationsCarButton.setIconTextGap(3); + randDestinationsCarButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -371,9 +383,15 @@ public class Main extends JFrame { } private void randDestinationsBikeButtonCreate() { //Fahrrad Icon hinzufügen - randDestinationsBikeButton = new JButton("Kurztrip"); - randDestinationsBikeButton.setPreferredSize(new Dimension(150, 50)); + randDestinationsBikeButton = new JButton(); + randDestinationsBikeButton.setPreferredSize(new Dimension(150, 80)); randDestinationsBikeButton.setFocusable(false); + + ImageIcon icon = png("fahrrad.png", 20, 20); + randDestinationsBikeButton.setIcon(icon); + randDestinationsBikeButton.setText("Kurztrip"); + randDestinationsBikeButton.setIconTextGap(3); + randDestinationsBikeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -396,4 +414,12 @@ public class Main extends JFrame { }); } + 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 + Image img = icon.getImage(); + Image newimg = img.getScaledInstance(sizeX, sizeY, java.awt.Image.SCALE_SMOOTH); // wähle Größe des PNGs + ImageIcon iconTwo = new ImageIcon(newimg); + return iconTwo; + } + } From 9bdae273d832f26f7cff0a4b861eba442313b67f Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 16:13:54 +0200 Subject: [PATCH 10/28] first (maybe last) commit of User pofile which is shown on app Panel --- src/main/java/de/hs_mannheim/ui/Main.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index faa69ad..00aa7fa 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -156,6 +156,23 @@ public class Main extends JFrame { jframe.setVisible(true); } + private void profileCreate() { + profile = new JPanel(new FlowLayout()); + ImageIcon png = png("profile.png", 30, 30); + JLabel jl = new JLabel(png); + String[] details = facade.getUserDetails(); // 6 bzw 7 + JLabel jlTXT = new JLabel("Name: " + details[0] + + "\nWohnort: " + details[1] + + "\nPlz: " + details[2] + + "\nAuto Name: " + details[3] + + "\nAuto km/h: " + details[4] + + "\nCO2/100km: " + details[5] + + "\nFahrrad km/h: " + details[6] + + "\nWetter: " + facade.current_weather()); + profile.add(jl); + profile.add(jlTXT); + } + private void errorMessageCreate() { errorMessage = new JPanel(); JLabel jl = new JLabel("Daten sind falsch oder unvollständig!"); From 11db856157d89c4d9d68b829114cc8aeb23db488 Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 17:04:57 +0200 Subject: [PATCH 11/28] loginConfirmButton Action Listener implemented --- src/main/java/de/hs_mannheim/ui/Main.java | 55 ++++++++++++++--------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 00aa7fa..3588e33 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -156,22 +156,22 @@ public class Main extends JFrame { jframe.setVisible(true); } - private void profileCreate() { - profile = new JPanel(new FlowLayout()); - ImageIcon png = png("profile.png", 30, 30); - JLabel jl = new JLabel(png); - String[] details = facade.getUserDetails(); // 6 bzw 7 - JLabel jlTXT = new JLabel("Name: " + details[0] - + "\nWohnort: " + details[1] - + "\nPlz: " + details[2] - + "\nAuto Name: " + details[3] - + "\nAuto km/h: " + details[4] - + "\nCO2/100km: " + details[5] - + "\nFahrrad km/h: " + details[6] - + "\nWetter: " + facade.current_weather()); - profile.add(jl); - profile.add(jlTXT); - } + private void profileCreate() { + profile = new JPanel(new FlowLayout()); + ImageIcon png = png("profile.png", 30, 30); + JLabel jl = new JLabel(png); + String[] details = facade.getUserDetails(); // 6 bzw 7 + JLabel jlTXT = new JLabel("Name: " + details[0] + + "\nWohnort: " + details[1] + + "\nPlz: " + details[2] + + "\nAuto Name: " + details[3] + + "\nAuto km/h: " + details[4] + + "\nCO2/100km: " + details[5] + + "\nFahrrad km/h: " + details[6] + + "\nWetter: " + facade.current_weather()); + profile.add(jl); + profile.add(jlTXT); + } private void errorMessageCreate() { errorMessage = new JPanel(); @@ -189,7 +189,7 @@ public class Main extends JFrame { public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "2"); 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() { @Override public void actionPerformed(ActionEvent e) { - cardLayout.show(panelLayout, "4"); - jframe.setSize(new Dimension(500, 500)); - // implementiere einlesen der textfelder des Panles + String nameTXT = getTextfieldContent(loginName, "loginNameText"); + String passwordTXT = getTextfieldContent(loginPassword, "loginPasswordText"); + if(facade.sign_in_user(nameTXT, passwordTXT)) { + cardLayout.show(panelLayout, "4"); + jframe.setSize(new Dimension(500, 500)); + } + 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 ImageIcon icon = new ImageIcon(getClass().getResource(path)); // Path des PNGs muss angegeben werden Image img = icon.getImage(); From 89c767f5c92795a8ca9bce73b8514cf44ba0b054 Mon Sep 17 00:00:00 2001 From: David Groys Date: Mon, 10 Jun 2024 17:23:26 +0200 Subject: [PATCH 12/28] registerConfirmButton Action Listener implemented and fixed issue in getTextfieldContent() --- src/main/java/de/hs_mannheim/ui/Main.java | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 3588e33..e007d31 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -340,9 +340,22 @@ public class Main extends JFrame { registerConfirmButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - cardLayout.show(panelLayout, "4"); - jframe.setSize(new Dimension(500, 500)); - // implementiere einlesen der textfelder des Panles + String nameTXT = getTextfieldContent(registerName, "registerNameText"); + String passwordTXT = getTextfieldContent(registerPassword, "registerPasswordText"); + String ortTXT = getTextfieldContent(registerName, "registerOrtText"); + String plzTXT = getTextfieldContent(registerPassword, "registerPLZText"); + String carNameTXT = getTextfieldContent(registerName, "registerCarNameText"); + String carCO2TXT = getTextfieldContent(registerName, "registerCarCO2Text"); + String carSpeedTXT = getTextfieldContent(registerPassword, "registerCarSpeedText"); + String bikeSpeedTXT = getTextfieldContent(registerName, "registerBikeSpeedText"); + if(sign_up_user(nameTXT, passwordTXT, ortTXT, plzTXT, + carNameTXT, carCO2TXT, carSpeedTXT, bikeSpeedTXT)){ + cardLayout.show(panelLayout, "4"); + jframe.setSize(new Dimension(500, 500)); + } + else{ + //mal gucken + } } }); } @@ -440,7 +453,7 @@ 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 ((JTextField) component).getText(); } } return null; From 0d7624337957f6895b63eea37ce9e838c1729e19 Mon Sep 17 00:00:00 2001 From: David Groys Date: Tue, 11 Jun 2024 10:30:35 +0200 Subject: [PATCH 13/28] getDetails() changeUserDetails() und sign_up_user() (erneut) angepasst --- src/main/java/de/hs_mannheim/ui/Main.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index e007d31..2230113 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -160,13 +160,13 @@ public class Main extends JFrame { profile = new JPanel(new FlowLayout()); ImageIcon png = png("profile.png", 30, 30); JLabel jl = new JLabel(png); - String[] details = facade.getUserDetails(); // 6 bzw 7 + String[] details = facade.getDetails(); // 6 bzw 7 JLabel jlTXT = new JLabel("Name: " + details[0] + "\nWohnort: " + details[1] + "\nPlz: " + details[2] + "\nAuto Name: " + details[3] - + "\nAuto km/h: " + details[4] - + "\nCO2/100km: " + details[5] + + "\nCO2/100km: " + details[4] + + "\nAuto km/h: " + details[5] + "\nFahrrad km/h: " + details[6] + "\nWetter: " + facade.current_weather()); profile.add(jl); @@ -348,7 +348,7 @@ public class Main extends JFrame { String carCO2TXT = getTextfieldContent(registerName, "registerCarCO2Text"); String carSpeedTXT = getTextfieldContent(registerPassword, "registerCarSpeedText"); String bikeSpeedTXT = getTextfieldContent(registerName, "registerBikeSpeedText"); - if(sign_up_user(nameTXT, passwordTXT, ortTXT, plzTXT, + if(facade.sign_up_user(nameTXT, passwordTXT, ortTXT, plzTXT, carNameTXT, carCO2TXT, carSpeedTXT, bikeSpeedTXT)){ cardLayout.show(panelLayout, "4"); jframe.setSize(new Dimension(500, 500)); From 1028a91a479d32b6236dce2178f16c7f4c93b1ef Mon Sep 17 00:00:00 2001 From: David Groys Date: Tue, 11 Jun 2024 10:48:41 +0200 Subject: [PATCH 14/28] started implementing buttons for detinations --- src/main/java/de/hs_mannheim/ui/Main.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 2230113..89bf659 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -15,6 +15,8 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingConstants; +import java.util.ArrayList; + public class Main extends JFrame { public static void main(String[] args) { Main main = new Main("35a75437476f12302f72e55d368485db"); @@ -189,7 +191,6 @@ public class Main extends JFrame { public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "2"); jframe.setSize(new Dimension(400, 150)); - // implementiere einlesen der textfelder des Panles } }); @@ -204,7 +205,6 @@ public class Main extends JFrame { public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "3"); jframe.setSize(new Dimension(260, 390)); - // implementiere einlesen der textfelder des Panles } }); } @@ -395,7 +395,13 @@ public class Main extends JFrame { searchConfirmButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - // implementiere Änderung vom Panel + ArrayList orte = facade.search(getTextfieldContent(searchPLZ_ORT, "ortSuche")); + for(String s : orte){ + String[] ortUndPLZ = s.split(";"); + String adress = ortUndPLZ[1] + ", " + ortUndPLZ[0]; + + //erzeuge aus adresse einen Button + } } }); } From c182602dfaef7e9a23652ae2a3629ff309a47070 Mon Sep 17 00:00:00 2001 From: David Groys Date: Tue, 11 Jun 2024 11:35:59 +0200 Subject: [PATCH 15/28] started (not tested) the search Button implementation --- src/main/java/de/hs_mannheim/ui/Main.java | 36 ++++++++++++++++------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 89bf659..da3e958 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -6,14 +6,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.SwingConstants; +import javax.swing.*; import java.util.ArrayList; @@ -63,6 +56,8 @@ public class Main extends JFrame { private JButton randDestinationsBikeButton; private JPanel profile; private JButton logOutButton; + private JScrollPane jsp = new JScrollPane(); + private JPanel destinationButtons = new JPanel(); public Main(String api_key) { this.facade = new Application(api_key); @@ -133,12 +128,14 @@ public class Main extends JFrame { randDestinationsCarButtonCreate(); randDestinationsBikeButtonCreate(); logOutButtonCreate(); + jsp.add(destinationButtons); menuLabel.setBounds(180, -125, 300, 300); searchPLZ_ORT.setBounds(20, 50, 300, 100); searchConfirmButton.setBounds(346, 70, 110, 30); randDestinationsCarButton.setBounds(346, 115, 110, 30); randDestinationsBikeButton.setBounds(346, 160, 110, 30); logOutButton.setBounds(346, 420, 110, 30); + jsp.setBounds(50,50,300,400); menu.add(menuLabel); menu.add(searchPLZ_ORT); menu.add(searchConfirmButton); @@ -396,12 +393,31 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { ArrayList orte = facade.search(getTextfieldContent(searchPLZ_ORT, "ortSuche")); + JPanel destinationButtonsProxy = new JPanel(new FlowLayout()); for(String s : orte){ String[] ortUndPLZ = s.split(";"); - String adress = ortUndPLZ[1] + ", " + ortUndPLZ[0]; - + String address = ortUndPLZ[1] + ", " + ortUndPLZ[0]; + JButton jb = new JButton(address); + jb.setSize(100,20); + jb.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFrame jf = new JFrame(); + JPanel jp = new JPanel(new FlowLayout()); + String[] details = facade.destination_details(ortUndPLZ[0]); + for(String ss : details) { + JLabel jl = new JLabel(ss); + jp.add(jl); + } + jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); + jf.add(jp); + jf.setSize(100,400); + } + }); //erzeuge aus adresse einen Button } + destinationButtons = destinationButtonsProxy; + menu.revalidate(); } }); } From 109489f0ad4d7ffba4590fb201f8a93f119499ae Mon Sep 17 00:00:00 2001 From: David Groys Date: Wed, 12 Jun 2024 15:12:26 +0200 Subject: [PATCH 16/28] Implemented User shown on Gugl Panel and functional registration, login and logout --- src/main/java/de/hs_mannheim/ui/Main.java | 82 +++++++++++++++------- src/main/resources/auto.png | Bin 0 -> 7659 bytes src/main/resources/fahrrad.png | Bin 0 -> 4499 bytes src/main/resources/lupe.png | Bin 0 -> 5948 bytes src/main/resources/profile.png | Bin 0 -> 1439 bytes 5 files changed, 57 insertions(+), 25 deletions(-) create mode 100644 src/main/resources/auto.png create mode 100644 src/main/resources/fahrrad.png create mode 100644 src/main/resources/lupe.png create mode 100644 src/main/resources/profile.png diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index da3e958..92b3003 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -136,6 +136,7 @@ public class Main extends JFrame { randDestinationsBikeButton.setBounds(346, 160, 110, 30); logOutButton.setBounds(346, 420, 110, 30); jsp.setBounds(50,50,300,400); + menu.add(menuLabel); menu.add(searchPLZ_ORT); menu.add(searchConfirmButton); @@ -143,6 +144,7 @@ public class Main extends JFrame { menu.add(randDestinationsBikeButton); menu.add(logOutButton); + panelLayout.add(logRegScreen, "1"); panelLayout.add(loginScreen, "2"); panelLayout.add(registerScreen, "3"); @@ -156,20 +158,39 @@ public class Main extends JFrame { } private void profileCreate() { - profile = new JPanel(new FlowLayout()); - ImageIcon png = png("profile.png", 30, 30); + JPanel jp = new JPanel(null); + ImageIcon png = png("/profile.png", 40, 40); JLabel jl = new JLabel(png); - String[] details = facade.getDetails(); // 6 bzw 7 - JLabel jlTXT = new JLabel("Name: " + details[0] - + "\nWohnort: " + details[1] - + "\nPlz: " + details[2] - + "\nAuto Name: " + details[3] - + "\nCO2/100km: " + details[4] - + "\nAuto km/h: " + details[5] - + "\nFahrrad km/h: " + details[6] - + "\nWetter: " + facade.current_weather()); - profile.add(jl); - profile.add(jlTXT); + String[] details = facade.getDetails(); + JLabel jlName = new JLabel("Name: " + details[0]); + JLabel jlWohnort = new JLabel("Wohnort: " + details[2]); + JLabel jlPLZ = new JLabel("Plz: " + details[3]); + JLabel jlAutoName = new JLabel("nAuto Name: " + details[4]); + JLabel jlCO2 = new JLabel("CO2/100km: " + details[5]); + JLabel jlAutoKMH = new JLabel( "Auto km/h: " + details[6]); + JLabel jlFahrradKMH = new JLabel( "Fahrrad km/h: " + details[7]); + JLabel jlWetter = new JLabel("Wetter: " + facade.current_weather()); + jl.setBounds(60,0, 60,60); + jlName.setBounds(15,30, 200,60); + jlWohnort.setBounds(15,47, 200,60); + jlPLZ.setBounds(15,64, 200,60); + jlAutoName.setBounds(15,81, 200,60); + jlCO2.setBounds(15,98, 200,60); + jlAutoKMH.setBounds(15,115, 200,60); + jlFahrradKMH.setBounds(15,132, 200,60); + jlWetter.setBounds(15,149, 200,60); + + jp.add(jl); + jp.add(jlName); + jp.add(jlWohnort); + jp.add(jlPLZ); + jp.add(jlAutoName); + jp.add(jlCO2); + jp.add(jlAutoKMH); + jp.add(jlFahrradKMH); + jp.add(jlWetter); + + profile = jp; } private void errorMessageCreate() { @@ -234,6 +255,11 @@ public class Main extends JFrame { String nameTXT = getTextfieldContent(loginName, "loginNameText"); String passwordTXT = getTextfieldContent(loginPassword, "loginPasswordText"); if(facade.sign_in_user(nameTXT, passwordTXT)) { + profileCreate(); + profile.setBounds(280, 190, 200,200); + menu.add(profile); + menu.revalidate(); + menu.repaint(); cardLayout.show(panelLayout, "4"); jframe.setSize(new Dimension(500, 500)); } @@ -261,7 +287,7 @@ public class Main extends JFrame { registerName = new JPanel(); JLabel jl = new JLabel(" Name"); JTextField tf = new JTextField(10); - tf.setName("registerPasswordText"); + tf.setName("registerNameText"); registerName.add(jl); registerName.add(tf); } @@ -339,14 +365,19 @@ public class Main extends JFrame { public void actionPerformed(ActionEvent e) { String nameTXT = getTextfieldContent(registerName, "registerNameText"); String passwordTXT = getTextfieldContent(registerPassword, "registerPasswordText"); - String ortTXT = getTextfieldContent(registerName, "registerOrtText"); - String plzTXT = getTextfieldContent(registerPassword, "registerPLZText"); - String carNameTXT = getTextfieldContent(registerName, "registerCarNameText"); - String carCO2TXT = getTextfieldContent(registerName, "registerCarCO2Text"); - String carSpeedTXT = getTextfieldContent(registerPassword, "registerCarSpeedText"); - String bikeSpeedTXT = getTextfieldContent(registerName, "registerBikeSpeedText"); + String ortTXT = getTextfieldContent(registerOrt, "registerOrtText"); + String plzTXT = getTextfieldContent(registerPLZ, "registerPLZText"); + String carNameTXT = getTextfieldContent(registerCarName, "registerCarNameText"); + String carCO2TXT = getTextfieldContent(registerCarCO2, "registerCarCO2Text"); + String carSpeedTXT = getTextfieldContent(registerCarSpeed, "registerCarSpeedText"); + String bikeSpeedTXT = getTextfieldContent(registerBikeSpeed, "registerBikeSpeedText"); if(facade.sign_up_user(nameTXT, passwordTXT, ortTXT, plzTXT, carNameTXT, carCO2TXT, carSpeedTXT, bikeSpeedTXT)){ + profileCreate(); + profile.setBounds(280, 190, 200,200); + menu.add(profile); + menu.revalidate(); + menu.repaint(); cardLayout.show(panelLayout, "4"); jframe.setSize(new Dimension(500, 500)); } @@ -384,7 +415,7 @@ public class Main extends JFrame { searchConfirmButton.setPreferredSize(new Dimension(150, 80)); searchConfirmButton.setFocusable(false); - ImageIcon icon = png("lupe.png", 20, 20); + ImageIcon icon = png("/lupe.png", 20, 20); searchConfirmButton.setIcon(icon); searchConfirmButton.setText(" Suche"); searchConfirmButton.setIconTextGap(3); @@ -427,7 +458,7 @@ public class Main extends JFrame { randDestinationsCarButton.setPreferredSize(new Dimension(150, 80)); randDestinationsCarButton.setFocusable(false); - ImageIcon icon = png("auto.png", 20, 20); + ImageIcon icon = png("/auto.png", 20, 20); randDestinationsCarButton.setIcon(icon); randDestinationsCarButton.setText("Kurztrip"); randDestinationsCarButton.setIconTextGap(3); @@ -445,7 +476,7 @@ public class Main extends JFrame { randDestinationsBikeButton.setPreferredSize(new Dimension(150, 80)); randDestinationsBikeButton.setFocusable(false); - ImageIcon icon = png("fahrrad.png", 20, 20); + ImageIcon icon = png("/fahrrad.png", 20, 20); randDestinationsBikeButton.setIcon(icon); randDestinationsBikeButton.setText("Kurztrip"); randDestinationsBikeButton.setIconTextGap(3); @@ -465,9 +496,10 @@ public class Main extends JFrame { logOutButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + menu.remove(profile); + facade.sign_out_user(); cardLayout.show(panelLayout, "1"); - jframe.setSize(new Dimension(450, 120)); - // implementiere Ausloggen im Backend + jframe.setSize(new Dimension(450, 160)); } }); } diff --git a/src/main/resources/auto.png b/src/main/resources/auto.png new file mode 100644 index 0000000000000000000000000000000000000000..9580e132929241c7e5cdae36fea879154237edcf GIT binary patch literal 7659 zcmeHKdo+~m+jee{%%~)hF(}cPgTWYvoDX9VC8scEUW|-!7^fytMw3K^oQjH+Y-G#% zxJiYaN{Lb^MUf~Wl<%c>yS={OTHo4heZT+qtTpq#&-2{(_1yRMT=%o)j8fS#Jc8bC!O_j_TxA5G9FLKU-@k5)_d!`#L4#@jmVqXV2PT%w?sh(~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Il( zf3831(mr?d9$r&!Rin$oTb49=^~(3e#fzvbSOoqrDf+Q?b1w=e$JRL=di=!5aec}|%j{)uUcH8KT_ zsI~0CpBkI84>MQkr3K0Auj@RZoM4V$_~oI~k}c;?n%<`79^x|bgg5tMZ(oLDI(Y>6|^Qp;RaNb+2-$}Vk$XN#5 zIby@W#yndyMJkhOoE~VcmASa~z%kcH^>bI-+T-hGy~>%xd`WW{4*ec12n@QzyT^J_KB11d(hc5krgB{q594te`B z-C>>iuAF+uh{Ev;Jyg?<<^_7i@VBpGoaaOx-O^K0A67`us71z1b|LOim@lahHZtFN zCA?ijo>lkMA@iCCEw4kc; zR@j8?re#;axPsef7(lys-Z|UjM0S#0SyDV&4}J9zp)}-!r~5DYtiZKbhb8O$6Vs7f zh|*V^6m3svEzNDc?Sk2+=UbnQEzLSgOjMM*r|yVDSD#pTgz*s>8F4Svno?aMU(!j7=l{Fm0p@Aem`TXh)2 zqjr41n*ndDylI8mTRd7?oVbuzPU@m&z7*WvuTzgcTn$GHbrbZ$0tL{5J zZi(3#`p(F#$g3`#x;2_Lx}xn=gL99cw25&)kow0p2P5GEgQ1A|a_I@`lR!l+se&8X z5J`>Prx(1&xP)}<9QTf0+aQ+d^x-$#rbscsK)d&AoKd9+F(*=nEfFW2k1csqdB@e6jB5B F{u|gNO85W( literal 0 HcmV?d00001 diff --git a/src/main/resources/profile.png b/src/main/resources/profile.png new file mode 100644 index 0000000000000000000000000000000000000000..f71fb15c2397d10abc70cdd091c3dbcf1ed3ba60 GIT binary patch literal 1439 zcmV;Q1z`G#P)gqH!Gztm|@9*yf1O%U-pFcl8kB^TO6clf7 zZ^y^S*VorkQBikycOfAm;o;%0udjc9e`siE^78U1C@4oqN2#f)mzS4^hld;-98641 zBqStST3WccxU~6!Gynhu>$BE?$q($@EX#9zws*oz30 zY?x_Qz9-0DVJ?|W2G4Ui91e%W;cz${4qJ)R)hdmA?qwJd?U(Ctr2b7KEy$Z>d`j7hmoiJ5Wt1c{?v*|y zowt)wG8eolo4CD>%cktP*IR?XrN}5*iVTxJ;j_9j7pNo}({)?|WW>GhpXBd4I+S`B zX7bTaPlrX_hksF?FyvH=QF14bb)NFgtbLOzf} zIP)!76e$_==?FmiNyUgyh>z5v6rbCQutNAwS1DEqUkze~6~dQo0aHd^A=Z3a))>1r z?$-m9v~Dm4L~BwMdy+OI0zFu57==KOx~wHSptZ9WAG{1Fg!80pQGw2yk}0l; zeP9*>yH;RtfUxDF$IDx^Fg6nlxDAC|hHkl4c$n+yk$??>I4afu384twB$?83%EqodGY+Fr{a_8T8QoY2ji=^aK>Lc z^%pG*S&uo*c#S2PJqQ>ycAN#&jqykIl`)sCvm?p=tqZA!%m&oq*HhGowp7%V%_;{ddxe!7D^!*dwaTSxXGbU!`krPNobt(`dwAb zJFs|@d3pML;DxL?baW6;fKPX5fMfigONUa>yvwvj*@P3&b@|XD1C=#S2)V}(%K@bW z`ugAf`HOU@)A;tq#5XsNtdr$x1PfrqLqwAgNq5WzM= zD>w=)JY1puZza$i&eT0Sk`BRvgce3Twzj4w=yTp)SsKln(3$i0DsWFU=k5&zUA&ci t==Y@L13|dyFb;>q;cz${4u?Y~{{W+bT^LI8+8F=<002ovPDHLkV1hrvu-^ax literal 0 HcmV?d00001 From 89961cfca955a144da3b65db2d2b54596fc7cb24 Mon Sep 17 00:00:00 2001 From: David Groys Date: Thu, 13 Jun 2024 13:46:52 +0200 Subject: [PATCH 17/28] changed a few things (because pulled methods from System class were changed) no new functions --- src/main/java/de/hs_mannheim/ui/Main.java | 29 ++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 92b3003..159fc3f 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -39,6 +39,7 @@ public class Main extends JFrame { private JPanel registerScreen; // Backend muss PLZ und Ort prüfen, sonst kann die Entfernung in Zukunft nicht berechnet werden private JPanel registerName; private JPanel registerPassword; + private JPanel registerPasswordTwo; private JPanel registerOrt; private JPanel registerPLZ; private JPanel registerCarName; @@ -100,6 +101,7 @@ public class Main extends JFrame { registerLabel.setFont(new Font("Arial", Font.PLAIN, 24)); registerNameCreate(); registerPasswordCreate(); + registerPasswordTwoCreate(); registerOrtCreate(); registerPLZCreate(); registerCarNameCreate(); @@ -111,6 +113,7 @@ public class Main extends JFrame { registerScreen.add(registerLabel); registerScreen.add(registerName); registerScreen.add(registerPassword); + registerScreen.add(registerPasswordTwo); registerScreen.add(registerOrt); registerScreen.add(registerPLZ); registerScreen.add(registerCarName); @@ -163,12 +166,12 @@ public class Main extends JFrame { JLabel jl = new JLabel(png); String[] details = facade.getDetails(); JLabel jlName = new JLabel("Name: " + details[0]); - JLabel jlWohnort = new JLabel("Wohnort: " + details[2]); - JLabel jlPLZ = new JLabel("Plz: " + details[3]); - JLabel jlAutoName = new JLabel("nAuto Name: " + details[4]); - JLabel jlCO2 = new JLabel("CO2/100km: " + details[5]); - JLabel jlAutoKMH = new JLabel( "Auto km/h: " + details[6]); - JLabel jlFahrradKMH = new JLabel( "Fahrrad km/h: " + details[7]); + JLabel jlWohnort = new JLabel("Wohnort: " + details[1]); + JLabel jlPLZ = new JLabel("Plz: " + details[2]); + JLabel jlAutoName = new JLabel("nAuto Name: " + details[3]); + JLabel jlCO2 = new JLabel("CO2/100km: " + details[4]); + JLabel jlAutoKMH = new JLabel( "Auto km/h: " + details[5]); + JLabel jlFahrradKMH = new JLabel( "Fahrrad km/h: " + details[6]); JLabel jlWetter = new JLabel("Wetter: " + facade.current_weather()); jl.setBounds(60,0, 60,60); jlName.setBounds(15,30, 200,60); @@ -222,7 +225,7 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "3"); - jframe.setSize(new Dimension(260, 390)); + jframe.setSize(new Dimension(260, 430)); } }); } @@ -301,6 +304,15 @@ public class Main extends JFrame { registerPassword.add(tf); } + private void registerPasswordTwoCreate() { + registerPasswordTwo = new JPanel(); + JLabel jl = new JLabel(" Passwort best."); + JTextField tf = new JTextField(10); + tf.setName("registerPasswordTwoText"); + registerPasswordTwo.add(jl); + registerPasswordTwo.add(tf); + } + private void registerOrtCreate() { registerOrt = new JPanel(); JLabel jl = new JLabel(" Ort"); @@ -365,13 +377,14 @@ public class Main extends JFrame { public void actionPerformed(ActionEvent e) { String nameTXT = getTextfieldContent(registerName, "registerNameText"); String passwordTXT = getTextfieldContent(registerPassword, "registerPasswordText"); + String passwordTXTTwo = getTextfieldContent(registerPasswordTwo, "registerPasswordTwoText"); String ortTXT = getTextfieldContent(registerOrt, "registerOrtText"); String plzTXT = getTextfieldContent(registerPLZ, "registerPLZText"); String carNameTXT = getTextfieldContent(registerCarName, "registerCarNameText"); String carCO2TXT = getTextfieldContent(registerCarCO2, "registerCarCO2Text"); String carSpeedTXT = getTextfieldContent(registerCarSpeed, "registerCarSpeedText"); String bikeSpeedTXT = getTextfieldContent(registerBikeSpeed, "registerBikeSpeedText"); - if(facade.sign_up_user(nameTXT, passwordTXT, ortTXT, plzTXT, + if(facade.sign_up_user(nameTXT, passwordTXT, passwordTXTTwo, ortTXT, plzTXT, carNameTXT, carCO2TXT, carSpeedTXT, bikeSpeedTXT)){ profileCreate(); profile.setBounds(280, 190, 200,200); From 47e613d109f60179717697b639c057f87b4cd762 Mon Sep 17 00:00:00 2001 From: David Groys Date: Fri, 14 Jun 2024 14:48:32 +0200 Subject: [PATCH 18/28] included error message --- src/main/java/de/hs_mannheim/ui/Main.java | 31 +++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 159fc3f..cc39043 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -21,7 +21,7 @@ public class Main extends JFrame { private JPanel panelLayout; //Wird in mehreren Labels benutzt (reg und log) - private JPanel errorMessage; // mal gucken, vllt auch nicht + private JFrame errorMessage; // mal gucken, vllt auch nicht private JLabel mainMenuLabel; private JPanel logRegScreen; @@ -72,8 +72,6 @@ public class Main extends JFrame { panelLayout.setLayout(cardLayout); jframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE); - errorMessageCreate();//wahrscheinlich muss individuell angepasst werden - logRegScreen = new JPanel(new FlowLayout()); mainMenuLabel = new JLabel(" Hauptmenü "); mainMenuLabel.setFont(new Font("Arial", Font.PLAIN, 24)); @@ -197,9 +195,26 @@ public class Main extends JFrame { } private void errorMessageCreate() { - errorMessage = new JPanel(); - JLabel jl = new JLabel("Daten sind falsch oder unvollständig!"); - errorMessage.add(jl); + errorMessage = new JFrame(); + errorMessage.setDefaultCloseOperation(DISPOSE_ON_CLOSE); + JPanel jp = new JPanel(new FlowLayout()); + JLabel jl = new JLabel("Daten falsch oder unvollständig!"); + JButton jb = new JButton("OK"); + jb.setFocusable(false); + + jb.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + errorMessage.dispose(); + } + }); + jp.add(BorderLayout.CENTER, jl); + jp.add(BorderLayout.SOUTH, jb); + errorMessage.add(jp); + errorMessage.setSize(240, 100); + errorMessage.setResizable(false); + errorMessage.setVisible(true); + errorMessage.setLocationRelativeTo(null); } @@ -267,7 +282,7 @@ public class Main extends JFrame { jframe.setSize(new Dimension(500, 500)); } else{ - //vllt zukünftig implementiert + errorMessageCreate(); } } }); @@ -395,7 +410,7 @@ public class Main extends JFrame { jframe.setSize(new Dimension(500, 500)); } else{ - //mal gucken + errorMessageCreate(); } } }); From d45465c1ad1706e5b2b8d1a61cf70d1dba0b29b7 Mon Sep 17 00:00:00 2001 From: David Groys Date: Fri, 14 Jun 2024 17:11:05 +0200 Subject: [PATCH 19/28] implemented change details Button and panel (both functional) but found minor error in Backend, when u want to change details u currently NEED to change name, this is not intended --- src/main/java/de/hs_mannheim/ui/Main.java | 195 ++++++++++++++++++++-- 1 file changed, 184 insertions(+), 11 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index cc39043..fe3ae8b 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -33,7 +33,7 @@ public class Main extends JFrame { private JPanel loginName; private JPanel loginPassword; private JButton loginConfirmButton; - private JButton loginZurückButton; + private JButton loginBackButton; private JLabel registerLabel; private JPanel registerScreen; // Backend muss PLZ und Ort prüfen, sonst kann die Entfernung in Zukunft nicht berechnet werden @@ -56,10 +56,24 @@ public class Main extends JFrame { private JButton randDestinationsCarButton; private JButton randDestinationsBikeButton; private JPanel profile; + private JButton changeDetailsButton; private JButton logOutButton; private JScrollPane jsp = new JScrollPane(); private JPanel destinationButtons = new JPanel(); + private JPanel changeDetails; + private JLabel changeDetailsLabel; + private JPanel changeName; + private JPanel checkChangePassword; + private JPanel changeOrt; + private JPanel changePLZ; + private JPanel changeCarName; + private JPanel changeCarSpeed; + private JPanel changeCarCO2; + private JPanel changeBikeSpeed; + private JButton changeConfirmButton; + private JButton changeBackButton; + public Main(String api_key) { this.facade = new Application(api_key); initialize(); @@ -92,7 +106,7 @@ public class Main extends JFrame { loginScreen.add(loginName); loginScreen.add(loginPassword); loginScreen.add(loginConfirmButton); - loginScreen.add(loginZurückButton); + loginScreen.add(loginBackButton); registerScreen = new JPanel(new FlowLayout()); // flowLayout muss angepasst werden, um nicht scheiße auszusehen registerLabel = new JLabel("Registrieren"); @@ -129,13 +143,15 @@ public class Main extends JFrame { randDestinationsCarButtonCreate(); randDestinationsBikeButtonCreate(); logOutButtonCreate(); + changeDetailsButtonCreate(); jsp.add(destinationButtons); menuLabel.setBounds(180, -125, 300, 300); searchPLZ_ORT.setBounds(20, 50, 300, 100); searchConfirmButton.setBounds(346, 70, 110, 30); - randDestinationsCarButton.setBounds(346, 115, 110, 30); - randDestinationsBikeButton.setBounds(346, 160, 110, 30); - logOutButton.setBounds(346, 420, 110, 30); + randDestinationsCarButton.setBounds(346, 105, 110, 30); + randDestinationsBikeButton.setBounds(346, 140, 110, 30); + logOutButton.setBounds(340, 430, 130, 30); + changeDetailsButton.setBounds(340, 398, 130, 30); jsp.setBounds(50,50,300,400); menu.add(menuLabel); @@ -144,12 +160,38 @@ public class Main extends JFrame { menu.add(randDestinationsCarButton); menu.add(randDestinationsBikeButton); menu.add(logOutButton); + menu.add(changeDetailsButton); + changeDetails = new JPanel(new FlowLayout()); + changeDetailsLabel = new JLabel("Daten ändern"); + changeDetailsLabel.setFont(new Font("Arial", Font.PLAIN, 24)); + changeNameCreate(); + checkChangePasswordCreate(); + changeOrtCreate(); + changePLZCreate(); + changeCarNameCreate(); + changeCarSpeedCreate(); + changeCarCO2Create(); + changeBikeSpeedCreate(); + changeConfirmButtonCreate(); + changeBackButtonCreate(); + changeDetails.add(changeDetailsLabel); + changeDetails.add(checkChangePassword); + changeDetails.add(changeName); + changeDetails.add(changeOrt); + changeDetails.add(changePLZ); + changeDetails.add(changeCarName); + changeDetails.add(changeCarCO2); + changeDetails.add(changeCarSpeed); + changeDetails.add(changeBikeSpeed); + changeDetails.add(changeBackButton); + changeDetails.add(changeConfirmButton); panelLayout.add(logRegScreen, "1"); panelLayout.add(loginScreen, "2"); panelLayout.add(registerScreen, "3"); panelLayout.add(menu, "4"); + panelLayout.add(changeDetails, "5"); cardLayout.show(panelLayout, "1"); jframe.add(panelLayout); jframe.setResizable(false); @@ -166,7 +208,7 @@ public class Main extends JFrame { JLabel jlName = new JLabel("Name: " + details[0]); JLabel jlWohnort = new JLabel("Wohnort: " + details[1]); JLabel jlPLZ = new JLabel("Plz: " + details[2]); - JLabel jlAutoName = new JLabel("nAuto Name: " + details[3]); + JLabel jlAutoName = new JLabel("Auto Name: " + details[3]); JLabel jlCO2 = new JLabel("CO2/100km: " + details[4]); JLabel jlAutoKMH = new JLabel( "Auto km/h: " + details[5]); JLabel jlFahrradKMH = new JLabel( "Fahrrad km/h: " + details[6]); @@ -274,7 +316,7 @@ public class Main extends JFrame { String passwordTXT = getTextfieldContent(loginPassword, "loginPasswordText"); if(facade.sign_in_user(nameTXT, passwordTXT)) { profileCreate(); - profile.setBounds(280, 190, 200,200); + profile.setBounds(280, 168, 200,200); menu.add(profile); menu.revalidate(); menu.repaint(); @@ -289,10 +331,10 @@ public class Main extends JFrame { } private void loginZurückButtonCreate() { - loginZurückButton = new JButton("Back"); - loginZurückButton.setPreferredSize(new Dimension(80, 20)); - loginZurückButton.setFocusable(false); - loginZurückButton.addActionListener(new ActionListener() { + loginBackButton = new JButton("Back"); + loginBackButton.setPreferredSize(new Dimension(80, 20)); + loginBackButton.setFocusable(false); + loginBackButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cardLayout.show(panelLayout, "1"); @@ -517,6 +559,137 @@ public class Main extends JFrame { }); } + private void changeDetailsButtonCreate() { + changeDetailsButton = new JButton("Daten ändern"); + changeDetailsButton.setPreferredSize(new Dimension(150, 50)); + changeDetailsButton.setFocusable(false); + changeDetailsButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "5"); + jframe.setSize(new Dimension(260, 394)); + } + }); + } + + public void checkChangePasswordCreate(){ + checkChangePassword = new JPanel(); + JLabel jl = new JLabel("Passwort bestätigen"); + JTextField tf = new JTextField(10); + tf.setName("checkChangePasswordText"); + checkChangePassword.add(jl); + checkChangePassword.add(tf); + } + + public void changeNameCreate(){ + changeName = new JPanel(); + JLabel jl = new JLabel(" Name"); + JTextField tf = new JTextField(10); + tf.setName("changeNameText"); + changeName.add(jl); + changeName.add(tf); + } + + public void changeOrtCreate(){ + changeOrt = new JPanel(); + JLabel jl = new JLabel(" Ort"); + JTextField tf = new JTextField(10); + tf.setName("changeOrtText"); + changeOrt.add(jl); + changeOrt.add(tf); + } + + public void changePLZCreate(){ + changePLZ = new JPanel(); + JLabel jl = new JLabel(" PLZ"); + JTextField tf = new JTextField(10); + tf.setName("changePLZText"); + changePLZ.add(jl); + changePLZ.add(tf); + } + + public void changeCarNameCreate(){ + changeCarName = new JPanel(); + JLabel jl = new JLabel(" Auto Name"); + JTextField tf = new JTextField(10); + tf.setName("changeCarNameText"); + changeCarName.add(jl); + changeCarName.add(tf); + } + + public void changeCarCO2Create(){ + changeCarCO2 = new JPanel(); + JLabel jl = new JLabel(" Auto CO2"); + JTextField tf = new JTextField(10); + tf.setName("changeCarCO2Text"); + changeCarCO2.add(jl); + changeCarCO2.add(tf); + } + + public void changeCarSpeedCreate(){ + changeCarSpeed = new JPanel(); + JLabel jl = new JLabel(" Auto Geschw."); + JTextField tf = new JTextField(10); + tf.setName("changeCarSpeedText"); + changeCarSpeed.add(jl); + changeCarSpeed.add(tf); + } + + public void changeBikeSpeedCreate(){ + changeBikeSpeed = new JPanel(); + JLabel jl = new JLabel(" Fahrrad Geschw."); + JTextField tf = new JTextField(10); + tf.setName("changeBikeSpeedText"); + changeBikeSpeed.add(jl); + changeBikeSpeed.add(tf); + } + + public void changeConfirmButtonCreate(){ + changeConfirmButton = new JButton("Confirm"); + changeConfirmButton.setSize(80, 20); + changeConfirmButton.setFocusable(false); + changeConfirmButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String nameTXT = getTextfieldContent(changeName, "changeNameText"); + String passwordTXT = getTextfieldContent(checkChangePassword, "checkChangePasswordText"); + String ortTXT = getTextfieldContent(changeOrt, "changeOrtText"); + String plzTXT = getTextfieldContent(changePLZ, "changePLZText"); + String carNameTXT = getTextfieldContent(changeCarName, "changeCarNameText"); + String carCO2TXT = getTextfieldContent(changeCarCO2, "changeCarCO2Text"); + String carSpeedTXT = getTextfieldContent(changeCarSpeed, "changeCarSpeedText"); + String bikeSpeedTXT = getTextfieldContent(changeBikeSpeed, "changeBikeSpeedText"); + if(facade.change_user_details(nameTXT, passwordTXT, ortTXT, plzTXT, + carNameTXT, carCO2TXT, carSpeedTXT, bikeSpeedTXT)){ + menu.remove(profile); + profileCreate(); + profile.setBounds(280, 190, 200,200); + menu.add(profile); + menu.revalidate(); + menu.repaint(); + cardLayout.show(panelLayout, "4"); + jframe.setSize(new Dimension(500, 500)); + } + else{ + errorMessageCreate(); + } + } + }); + } + + public void changeBackButtonCreate(){ + changeBackButton = new JButton("Zurück"); + changeBackButton.setSize(80, 20); + changeBackButton.setFocusable(false); + changeBackButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "4"); + jframe.setSize(new Dimension(500, 500)); + } + }); + } + private void logOutButtonCreate() { logOutButton = new JButton("Logout"); logOutButton.setPreferredSize(new Dimension(150, 50)); From ed04821220898af13a1d4ee06a1116b1d18f1a05 Mon Sep 17 00:00:00 2001 From: David Groys Date: Fri, 14 Jun 2024 18:18:40 +0200 Subject: [PATCH 20/28] implemented change password Button and panel (both functional) --- src/main/java/de/hs_mannheim/ui/Main.java | 102 ++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index fe3ae8b..670f950 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -56,11 +56,20 @@ public class Main extends JFrame { private JButton randDestinationsCarButton; private JButton randDestinationsBikeButton; private JPanel profile; + private JButton changePasswordButton; private JButton changeDetailsButton; private JButton logOutButton; private JScrollPane jsp = new JScrollPane(); private JPanel destinationButtons = new JPanel(); + private JPanel changePassword; + private JLabel changePasswordLabel; + private JPanel changePasswordOldPassword; + private JPanel changePasswordNewPassword; + private JPanel changePasswordConfirmNewPassword; + private JButton changePasswordBackButton; + private JButton changePasswordConfirmButton; + private JPanel changeDetails; private JLabel changeDetailsLabel; private JPanel changeName; @@ -144,6 +153,7 @@ public class Main extends JFrame { randDestinationsBikeButtonCreate(); logOutButtonCreate(); changeDetailsButtonCreate(); + changePasswordButtonCreate(); jsp.add(destinationButtons); menuLabel.setBounds(180, -125, 300, 300); searchPLZ_ORT.setBounds(20, 50, 300, 100); @@ -152,6 +162,7 @@ public class Main extends JFrame { randDestinationsBikeButton.setBounds(346, 140, 110, 30); logOutButton.setBounds(340, 430, 130, 30); changeDetailsButton.setBounds(340, 398, 130, 30); + changePasswordButton.setBounds(340, 366, 130, 30); jsp.setBounds(50,50,300,400); menu.add(menuLabel); @@ -161,6 +172,22 @@ public class Main extends JFrame { menu.add(randDestinationsBikeButton); menu.add(logOutButton); menu.add(changeDetailsButton); + menu.add(changePasswordButton); + + changePassword = new JPanel(new FlowLayout()); + changePasswordLabel = new JLabel("Password ändern"); + changePasswordLabel.setFont(new Font("Arial", Font.PLAIN, 24)); + changePasswordOldPasswordCreate(); + changePasswordNewPasswordCreate(); + changePasswordConfirmNewPasswordCreate(); + changePasswordBackButtonCreate(); + changePasswordConfirmButtonCreate(); + changePassword.add(changePasswordLabel); + changePassword.add(changePasswordOldPassword); + changePassword.add(changePasswordNewPassword); + changePassword.add(changePasswordConfirmNewPassword); + changePassword.add(changePasswordBackButton); + changePassword.add(changePasswordConfirmButton); changeDetails = new JPanel(new FlowLayout()); changeDetailsLabel = new JLabel("Daten ändern"); @@ -192,6 +219,7 @@ public class Main extends JFrame { panelLayout.add(registerScreen, "3"); panelLayout.add(menu, "4"); panelLayout.add(changeDetails, "5"); + panelLayout.add(changePassword, "6"); cardLayout.show(panelLayout, "1"); jframe.add(panelLayout); jframe.setResizable(false); @@ -690,6 +718,80 @@ public class Main extends JFrame { }); } + public void changePasswordButtonCreate(){ + changePasswordButton = new JButton("Passwort ändern"); + changePasswordButton.setPreferredSize(new Dimension(150, 50)); + changePasswordButton.setFocusable(false); + changePasswordButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "6"); + jframe.setSize(new Dimension(260, 215)); + } + }); + } + + public void changePasswordOldPasswordCreate(){ + changePasswordOldPassword = new JPanel(); + JLabel jl = new JLabel(" Altes Passwort"); + JTextField tf = new JTextField(10); + tf.setName("changePasswordOldPasswordText"); + changePasswordOldPassword.add(jl); + changePasswordOldPassword.add(tf); + } + + public void changePasswordNewPasswordCreate(){ + changePasswordNewPassword = new JPanel(); + JLabel jl = new JLabel(" Neue Passowrt"); + JTextField tf = new JTextField(10); + tf.setName("changePasswordNewPasswordText"); + changePasswordNewPassword.add(jl); + changePasswordNewPassword.add(tf); + } + + public void changePasswordConfirmNewPasswordCreate(){ + changePasswordConfirmNewPassword = new JPanel(); + JLabel jl = new JLabel("Best. neues Passwort"); + JTextField tf = new JTextField(10); + tf.setName("changePasswordConfirmNewPasswordText"); + changePasswordConfirmNewPassword.add(jl); + changePasswordConfirmNewPassword.add(tf); + } + + public void changePasswordBackButtonCreate(){ + changePasswordBackButton = new JButton("Zurück"); + changePasswordBackButton.setSize(80, 20); + changePasswordBackButton.setFocusable(false); + changePasswordBackButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cardLayout.show(panelLayout, "4"); + jframe.setSize(new Dimension(500, 500)); + } + }); + } + + public void changePasswordConfirmButtonCreate(){ + changePasswordConfirmButton = new JButton("Confirm"); + changePasswordConfirmButton.setSize(80, 20); + changePasswordConfirmButton.setFocusable(false); + changePasswordConfirmButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String passwordOldTXT = getTextfieldContent(changePasswordOldPassword, "changePasswordOldPasswordText"); + String passwordNewTXT = getTextfieldContent(changePasswordNewPassword, "changePasswordNewPasswordText"); + String passwordConfirmNewTXT = getTextfieldContent(changePasswordConfirmNewPassword, "changePasswordConfirmNewPasswordText"); + if(facade.change_user_password(passwordOldTXT, passwordNewTXT, passwordConfirmNewTXT)){ + cardLayout.show(panelLayout, "4"); + jframe.setSize(new Dimension(500, 500)); + } + else{ + errorMessageCreate(); + } + } + }); + } + private void logOutButtonCreate() { logOutButton = new JButton("Logout"); logOutButton.setPreferredSize(new Dimension(150, 50)); From 5eaff1161bd4edec4be9903698e18210599e2590 Mon Sep 17 00:00:00 2001 From: David Groys Date: Fri, 14 Jun 2024 18:33:54 +0200 Subject: [PATCH 21/28] small visual bug fix --- src/main/java/de/hs_mannheim/ui/Main.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 670f950..aad072c 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -472,7 +472,7 @@ public class Main extends JFrame { if(facade.sign_up_user(nameTXT, passwordTXT, passwordTXTTwo, ortTXT, plzTXT, carNameTXT, carCO2TXT, carSpeedTXT, bikeSpeedTXT)){ profileCreate(); - profile.setBounds(280, 190, 200,200); + profile.setBounds(280, 168, 200,200); menu.add(profile); menu.revalidate(); menu.repaint(); @@ -691,7 +691,7 @@ public class Main extends JFrame { carNameTXT, carCO2TXT, carSpeedTXT, bikeSpeedTXT)){ menu.remove(profile); profileCreate(); - profile.setBounds(280, 190, 200,200); + profile.setBounds(280, 168, 200,200); menu.add(profile); menu.revalidate(); menu.repaint(); From 1a45bc23eccd9ef2204433eff23b7aafb88f0727 Mon Sep 17 00:00:00 2001 From: David Groys Date: Sat, 15 Jun 2024 16:34:36 +0200 Subject: [PATCH 22/28] implemented scrollbar with search results with error message if none are found --- src/main/java/de/hs_mannheim/ui/Main.java | 94 ++++++++++++++++------- 1 file changed, 68 insertions(+), 26 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index aad072c..f41dc77 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -59,7 +59,7 @@ public class Main extends JFrame { private JButton changePasswordButton; private JButton changeDetailsButton; private JButton logOutButton; - private JScrollPane jsp = new JScrollPane(); + private JScrollPane jsp; private JPanel destinationButtons = new JPanel(); private JPanel changePassword; @@ -154,7 +154,6 @@ public class Main extends JFrame { logOutButtonCreate(); changeDetailsButtonCreate(); changePasswordButtonCreate(); - jsp.add(destinationButtons); menuLabel.setBounds(180, -125, 300, 300); searchPLZ_ORT.setBounds(20, 50, 300, 100); searchConfirmButton.setBounds(346, 70, 110, 30); @@ -163,7 +162,6 @@ public class Main extends JFrame { logOutButton.setBounds(340, 430, 130, 30); changeDetailsButton.setBounds(340, 398, 130, 30); changePasswordButton.setBounds(340, 366, 130, 30); - jsp.setBounds(50,50,300,400); menu.add(menuLabel); menu.add(searchPLZ_ORT); @@ -522,35 +520,73 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { ArrayList orte = facade.search(getTextfieldContent(searchPLZ_ORT, "ortSuche")); - JPanel destinationButtonsProxy = new JPanel(new FlowLayout()); - for(String s : orte){ - String[] ortUndPLZ = s.split(";"); - String address = ortUndPLZ[1] + ", " + ortUndPLZ[0]; - JButton jb = new JButton(address); - jb.setSize(100,20); - jb.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JFrame jf = new JFrame(); - JPanel jp = new JPanel(new FlowLayout()); - String[] details = facade.destination_details(ortUndPLZ[0]); - for(String ss : details) { - JLabel jl = new JLabel(ss); - jp.add(jl); + JPanel destinationButtonsProxy = new JPanel(); + destinationButtonsProxy.setLayout(new BoxLayout(destinationButtonsProxy, BoxLayout.Y_AXIS)); + if (orte.size() > 0) { + for (String s : orte) { + String[] ortUndPLZ = s.split(";"); + String plz = ortUndPLZ[0]; + String address = ortUndPLZ[1] + "," + plz + " " + facade.distance(plz); + JButton jb = new JButton(address); + jb.setPreferredSize(new Dimension(290, 40)); + jb.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFrame jf = new JFrame(); + JPanel jp = new JPanel(new FlowLayout()); + String[] details = facade.destination_details(plz); + for (String ss : details) { + JLabel jl = new JLabel(ss); + jp.add(jl); + } + jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); + jf.add(jp); + jf.setSize(100, 400); + jf.setVisible(true); } - jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); - jf.add(jp); - jf.setSize(100,400); - } - }); - //erzeuge aus adresse einen Button + }); + destinationButtonsProxy.add(jb); + } + destinationButtons = destinationButtonsProxy; + destinationButtons.revalidate(); + destinationButtons.repaint(); + try { + menu.remove(jsp); + } catch (Exception jspNotYetIncluded) { + } + jsp = new JScrollPane(destinationButtons); + jsp.setBounds(40, 110, 244, 336); + jsp.revalidate(); + jsp.repaint(); + menu.add(jsp); + menu.revalidate(); + menu.repaint(); + } + else { + destinationButtonsProxy = new JPanel(); + JLabel jl = new JLabel("Kein Ergebnis"); + jl.setFont(new Font("Arial", Font.PLAIN, 38)); + destinationButtonsProxy.add(jl); + destinationButtons = destinationButtonsProxy; + destinationButtons.revalidate(); + destinationButtons.repaint(); + try { + menu.remove(jsp); + } catch (Exception jspNotYetIncluded) { + } + jsp = new JScrollPane(destinationButtons); + jsp.setBounds(40, 110, 244, 336); + jsp.revalidate(); + jsp.repaint(); + menu.add(jsp); + menu.revalidate(); + menu.repaint(); } - destinationButtons = destinationButtonsProxy; - menu.revalidate(); } }); } + private void randDestinationsCarButtonCreate() { //Auto Icon hinzufügen randDestinationsCarButton = new JButton(); randDestinationsCarButton.setPreferredSize(new Dimension(150, 80)); @@ -807,6 +843,12 @@ public class Main extends JFrame { }); } + public void jspCreate(){ + jsp = new JScrollPane(); + jsp.setSize(100,100); + + } + private String getTextfieldContent(JPanel panel, String name) { for (Component component : panel.getComponents()) { if (component instanceof JTextField && name.equals(component.getName())) { From b670cc38dc11597cb61a061d00887c4c72afded0 Mon Sep 17 00:00:00 2001 From: David Groys Date: Sun, 16 Jun 2024 09:52:24 +0200 Subject: [PATCH 23/28] changed profile creation a little --- src/main/java/de/hs_mannheim/ui/Main.java | 159 ++++++++++++++++------ 1 file changed, 114 insertions(+), 45 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index f41dc77..468765d 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -84,8 +84,10 @@ public class Main extends JFrame { private JButton changeBackButton; public Main(String api_key) { - this.facade = new Application(api_key); - initialize(); + SwingUtilities.invokeLater(() -> { + this.facade = new Application(api_key); + initialize(); + }); } public void initialize() { @@ -231,33 +233,27 @@ public class Main extends JFrame { ImageIcon png = png("/profile.png", 40, 40); JLabel jl = new JLabel(png); String[] details = facade.getDetails(); - JLabel jlName = new JLabel("Name: " + details[0]); - JLabel jlWohnort = new JLabel("Wohnort: " + details[1]); - JLabel jlPLZ = new JLabel("Plz: " + details[2]); - JLabel jlAutoName = new JLabel("Auto Name: " + details[3]); - JLabel jlCO2 = new JLabel("CO2/100km: " + details[4]); - JLabel jlAutoKMH = new JLabel( "Auto km/h: " + details[5]); - JLabel jlFahrradKMH = new JLabel( "Fahrrad km/h: " + details[6]); - JLabel jlWetter = new JLabel("Wetter: " + facade.current_weather()); - jl.setBounds(60,0, 60,60); - jlName.setBounds(15,30, 200,60); - jlWohnort.setBounds(15,47, 200,60); - jlPLZ.setBounds(15,64, 200,60); - jlAutoName.setBounds(15,81, 200,60); - jlCO2.setBounds(15,98, 200,60); - jlAutoKMH.setBounds(15,115, 200,60); - jlFahrradKMH.setBounds(15,132, 200,60); - jlWetter.setBounds(15,149, 200,60); + JLabel jlName = new JLabel("Nutzername:"); + JLabel jlNameText = new JLabel(details[0]); + JLabel jlWohnort = new JLabel("Zieladresse:"); + JLabel jlWohnortText = new JLabel(details[2] + "," + details[1]); + JLabel jlWetter = new JLabel("Wettervorhersage:"); + JLabel jlWetterText = new JLabel(facade.current_weather()); + jl.setBounds(90,0, 60,60); + jlName.setBounds(60,30, 200,60); + jlNameText.setBounds(60,44, 200,60); + jlWohnort.setBounds(60,70, 200,60); + jlWohnortText.setBounds(60,84, 200,60); + jlWetter.setBounds(60,110, 200,60); + jlWetterText.setBounds(60,124, 200,60); jp.add(jl); jp.add(jlName); + jp.add(jlNameText); jp.add(jlWohnort); - jp.add(jlPLZ); - jp.add(jlAutoName); - jp.add(jlCO2); - jp.add(jlAutoKMH); - jp.add(jlFahrradKMH); + jp.add(jlWohnortText); jp.add(jlWetter); + jp.add(jlWetterText); profile = jp; } @@ -270,12 +266,7 @@ public class Main extends JFrame { JButton jb = new JButton("OK"); jb.setFocusable(false); - jb.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - errorMessage.dispose(); - } - }); + jb.addActionListener(e -> errorMessage.dispose()); jp.add(BorderLayout.CENTER, jl); jp.add(BorderLayout.SOUTH, jb); errorMessage.add(jp); @@ -533,19 +524,23 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { JFrame jf = new JFrame(); - JPanel jp = new JPanel(new FlowLayout()); + JPanel jp = new JPanel(); + jp.setLayout(null); String[] details = facade.destination_details(plz); - for (String ss : details) { - JLabel jl = new JLabel(ss); - jp.add(jl); - } + + + + + jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); jf.add(jp); - jf.setSize(100, 400); + jf.setSize(300, 300); jf.setVisible(true); } }); destinationButtonsProxy.add(jb); + JLabel placeholder = new JLabel(""); + destinationButtonsProxy.add(placeholder); } destinationButtons = destinationButtonsProxy; destinationButtons.revalidate(); @@ -555,7 +550,7 @@ public class Main extends JFrame { } catch (Exception jspNotYetIncluded) { } jsp = new JScrollPane(destinationButtons); - jsp.setBounds(40, 110, 244, 336); + jsp.setBounds(40, 110, 256, 336); jsp.revalidate(); jsp.repaint(); menu.add(jsp); @@ -600,7 +595,47 @@ public class Main extends JFrame { randDestinationsCarButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - // implementiere Änderung vom Panel + ArrayList orte = facade.random_destinations_car(); + JPanel destinationButtonsProxy = new JPanel(); + destinationButtonsProxy.setLayout(new BoxLayout(destinationButtonsProxy, BoxLayout.Y_AXIS)); + for (String s : orte) { + String[] ortUndPLZ = s.split(";"); + String plz = ortUndPLZ[0]; + String address = ortUndPLZ[1] + "," + plz + " " + facade.distance(plz); + JButton jb = new JButton(address); + jb.setPreferredSize(new Dimension(290, 40)); + jb.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFrame jf = new JFrame(); + JPanel jp = new JPanel(new FlowLayout()); + String[] details = facade.destination_details(plz); + for (String ss : details) { + JLabel jl = new JLabel(ss); + jp.add(jl); + } + jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); + jf.add(jp); + jf.setSize(200, 200); + jf.setVisible(true); + } + }); + destinationButtonsProxy.add(jb); + } + destinationButtons = destinationButtonsProxy; + destinationButtons.revalidate(); + destinationButtons.repaint(); + try { + menu.remove(jsp); + } catch (Exception jspNotYetIncluded) { + } + jsp = new JScrollPane(destinationButtons); + jsp.setBounds(40, 110, 244, 336); + jsp.revalidate(); + jsp.repaint(); + menu.add(jsp); + menu.revalidate(); + menu.repaint(); } }); } @@ -618,7 +653,47 @@ public class Main extends JFrame { randDestinationsBikeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - // implementiere Änderung vom Panel + ArrayList orte = facade.random_destinations_bike(); + JPanel destinationButtonsProxy = new JPanel(); + destinationButtonsProxy.setLayout(new BoxLayout(destinationButtonsProxy, BoxLayout.Y_AXIS)); + for (String s : orte) { + String[] ortUndPLZ = s.split(";"); + String plz = ortUndPLZ[0]; + String address = ortUndPLZ[1] + "," + plz + " " + facade.distance(plz); + JButton jb = new JButton(address); + jb.setPreferredSize(new Dimension(290, 40)); + jb.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFrame jf = new JFrame(); + JPanel jp = new JPanel(new FlowLayout()); + String[] details = facade.destination_details(plz); + for (String ss : details) { + JLabel jl = new JLabel(ss); + jp.add(jl); + } + jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); + jf.add(jp); + jf.setSize(200, 200); + jf.setVisible(true); + } + }); + destinationButtonsProxy.add(jb); + } + destinationButtons = destinationButtonsProxy; + destinationButtons.revalidate(); + destinationButtons.repaint(); + try { + menu.remove(jsp); + } catch (Exception jspNotYetIncluded) { + } + jsp = new JScrollPane(destinationButtons); + jsp.setBounds(40, 110, 244, 336); + jsp.revalidate(); + jsp.repaint(); + menu.add(jsp); + menu.revalidate(); + menu.repaint(); } }); } @@ -843,12 +918,6 @@ public class Main extends JFrame { }); } - public void jspCreate(){ - jsp = new JScrollPane(); - jsp.setSize(100,100); - - } - private String getTextfieldContent(JPanel panel, String name) { for (Component component : panel.getComponents()) { if (component instanceof JTextField && name.equals(component.getName())) { From d08992eba25ff5a0717545b4f99323599ed9869a Mon Sep 17 00:00:00 2001 From: David Groys Date: Sun, 16 Jun 2024 11:15:57 +0200 Subject: [PATCH 24/28] changed destination details creation a little --- src/main/java/de/hs_mannheim/ui/Main.java | 43 ++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 468765d..66d264d 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -527,10 +527,45 @@ public class Main extends JFrame { JPanel jp = new JPanel(); jp.setLayout(null); String[] details = facade.destination_details(plz); - - - - + JLabel jlAddress = new JLabel("Zieladresse:"); + JLabel jlAddressText = new JLabel(address); + JLabel jlWettervorhersage = new JLabel("Wettervorhersage:"); + JLabel jlWettervorhersageTextOne = new JLabel(details[0]); + JLabel jlWettervorhersageTextTwo = new JLabel(details[1]); + JLabel jlWettervorhersageTextThree = new JLabel(details[2]); + JLabel jlEntfernung = new JLabel("Entfernung:"); + JLabel jlEntfernungText = new JLabel(details[3]); + JLabel jlReisedauerUndKraftstoffverbrauch = new JLabel("Reisedauer und Kraftstoffverbrauch Auto:"); + JLabel jlAutoDauer = new JLabel(details[4]); + JLabel jlAutoVerbrauch = new JLabel(details[5]); + JLabel jlReisedauerMitFahrrad = new JLabel("Reisedauer mit Fahrrad:"); + JLabel jlReisedauerMitFahrradText = new JLabel(details[6]); + jlAddress.setBounds(4, 6, 100, 100); + jlAddressText.setBounds(4, 16, 100, 100); + jlWettervorhersage.setBounds(4, 36, 100, 100); + jlWettervorhersageTextOne.setBounds(4, 46, 100, 100); + jlWettervorhersageTextTwo.setBounds(4, 56, 100, 100); + jlWettervorhersageTextThree.setBounds(4, 66, 100, 100); + jlEntfernung.setBounds(4, 86, 100, 100); + jlEntfernungText.setBounds(4, 96, 100, 100); + jlReisedauerUndKraftstoffverbrauch.setBounds(4, 116, 100, 100); + jlAutoDauer.setBounds(4, 126, 100, 100); + jlAutoVerbrauch.setBounds(4, 136, 100, 100); + jlReisedauerMitFahrrad.setBounds(4, 156, 100, 100); + jlReisedauerMitFahrradText.setBounds(4, 166, 100, 100); + jp.add(jlAddress); + jp.add(jlAddressText); + jp.add(jlWettervorhersage); + jp.add(jlWettervorhersageTextOne); + jp.add(jlWettervorhersageTextTwo); + jp.add(jlWettervorhersageTextThree); + jp.add(jlEntfernung); + jp.add(jlEntfernungText); + jp.add(jlReisedauerUndKraftstoffverbrauch); + jp.add(jlAutoDauer); + jp.add(jlAutoVerbrauch); + jp.add(jlReisedauerMitFahrrad); + jp.add(jlReisedauerMitFahrradText); jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); jf.add(jp); From 991e0f1d8d1ad3197ee81e4ab56ea5b73aafe953 Mon Sep 17 00:00:00 2001 From: David Groys Date: Sun, 16 Jun 2024 11:54:37 +0200 Subject: [PATCH 25/28] implemented reset of textfields so that data doesnt leak --- src/main/java/de/hs_mannheim/ui/Main.java | 60 +++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 66d264d..0d649e6 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -343,6 +343,10 @@ public class Main extends JFrame { else{ errorMessageCreate(); } + JTextField clear = findTextFieldByName(loginName, "loginNameText"); + clear.setText(""); + clear = findTextFieldByName(loginPassword, "loginPasswordText"); + clear.setText(""); } }); } @@ -471,6 +475,24 @@ public class Main extends JFrame { else{ errorMessageCreate(); } + JTextField clear = findTextFieldByName(registerName, "registerNameText"); + clear.setText(""); + clear = findTextFieldByName(registerPassword, "registerPasswordText"); + clear.setText(""); + clear = findTextFieldByName(registerPasswordTwo, "registerPasswordTwoText"); + clear.setText(""); + clear = findTextFieldByName(registerOrt, "registerOrtText"); + clear.setText(""); + clear = findTextFieldByName(registerPLZ, "registerPLZText"); + clear.setText(""); + clear = findTextFieldByName(registerCarName, "registerCarNameText"); + clear.setText(""); + clear = findTextFieldByName(registerCarCO2, "registerCarCO2Text"); + clear.setText(""); + clear = findTextFieldByName(registerCarSpeed, "registerCarSpeedText"); + clear.setText(""); + clear = findTextFieldByName(registerBikeSpeed, "registerBikeSpeedText"); + clear.setText(""); } }); } @@ -847,6 +869,22 @@ public class Main extends JFrame { else{ errorMessageCreate(); } + JTextField clear = findTextFieldByName(changeName, "changeNameText"); + clear.setText(""); + clear = findTextFieldByName(checkChangePassword, "checkChangePasswordText"); + clear.setText(""); + clear = findTextFieldByName(changeOrt, "changeOrtText"); + clear.setText(""); + clear = findTextFieldByName(changePLZ, "changePLZText"); + clear.setText(""); + clear = findTextFieldByName(changeCarName, "changeCarNameText"); + clear.setText(""); + clear = findTextFieldByName(changeCarCO2, "changeCarCO2Text"); + clear.setText(""); + clear = findTextFieldByName(changeCarSpeed, "changeCarSpeedText"); + clear.setText(""); + clear = findTextFieldByName(changeBikeSpeed, "changeBikeSpeedText"); + clear.setText(""); } }); } @@ -934,6 +972,12 @@ public class Main extends JFrame { else{ errorMessageCreate(); } + JTextField clear = findTextFieldByName(changePasswordOldPassword, "changePasswordOldPasswordText"); + clear.setText(""); + clear = findTextFieldByName(changePasswordNewPassword, "changePasswordNewPasswordText"); + clear.setText(""); + clear = findTextFieldByName(changePasswordConfirmNewPassword, "changePasswordConfirmNewPasswordText"); + clear.setText(""); } }); } @@ -949,6 +993,8 @@ public class Main extends JFrame { facade.sign_out_user(); cardLayout.show(panelLayout, "1"); jframe.setSize(new Dimension(450, 160)); + JTextField clear = findTextFieldByName(searchPLZ_ORT, "ortSuche"); + clear.setText(""); } }); } @@ -962,6 +1008,20 @@ public class Main extends JFrame { return null; } + public JTextField findTextFieldByName(Container container, String name) { + for (Component component : container.getComponents()) { + if (component instanceof JTextField && name.equals(component.getName())) { + return (JTextField) component; + } else if (component instanceof Container) { + JTextField textField = findTextFieldByName((Container) component, name); + if (textField != null) { + return textField; + } + } + } + return null; + } + 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 Image img = icon.getImage(); From 5ce975c334777551066ee2231dbe8ba571b3a8c4 Mon Sep 17 00:00:00 2001 From: David Groys Date: Sun, 16 Jun 2024 15:26:34 +0200 Subject: [PATCH 26/28] implemented the change details panel to show former details excpet password --- src/main/java/de/hs_mannheim/ui/Main.java | 50 +++++++++++++++-------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 0d649e6..f3fcf03 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -762,6 +762,24 @@ public class Main extends JFrame { changeDetailsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + String[] details = facade.getDetails(); + JTextField detailsText = findTextFieldByName(changeName, "changeNameText"); + detailsText.setText(details[0]); + detailsText = findTextFieldByName(changeOrt, "changeOrtText"); + detailsText.setText(details[1]); + detailsText = findTextFieldByName(changePLZ, "changePLZText"); + detailsText.setText(details[2]); + detailsText = findTextFieldByName(changeCarName, "changeCarNameText"); + detailsText.setText(details[3]); + detailsText = findTextFieldByName(changeCarCO2, "changeCarCO2Text"); + detailsText.setText(details[4]); + detailsText = findTextFieldByName(changeCarSpeed, "changeCarSpeedText"); + detailsText.setText(details[5]); + detailsText = findTextFieldByName(changeBikeSpeed, "changeBikeSpeedText"); + detailsText.setText(details[6]); + detailsText = findTextFieldByName(checkChangePassword, "checkChangePasswordText"); + detailsText.setText(""); + cardLayout.show(panelLayout, "5"); jframe.setSize(new Dimension(260, 394)); } @@ -869,22 +887,6 @@ public class Main extends JFrame { else{ errorMessageCreate(); } - JTextField clear = findTextFieldByName(changeName, "changeNameText"); - clear.setText(""); - clear = findTextFieldByName(checkChangePassword, "checkChangePasswordText"); - clear.setText(""); - clear = findTextFieldByName(changeOrt, "changeOrtText"); - clear.setText(""); - clear = findTextFieldByName(changePLZ, "changePLZText"); - clear.setText(""); - clear = findTextFieldByName(changeCarName, "changeCarNameText"); - clear.setText(""); - clear = findTextFieldByName(changeCarCO2, "changeCarCO2Text"); - clear.setText(""); - clear = findTextFieldByName(changeCarSpeed, "changeCarSpeedText"); - clear.setText(""); - clear = findTextFieldByName(changeBikeSpeed, "changeBikeSpeedText"); - clear.setText(""); } }); } @@ -995,6 +997,22 @@ public class Main extends JFrame { jframe.setSize(new Dimension(450, 160)); JTextField clear = findTextFieldByName(searchPLZ_ORT, "ortSuche"); clear.setText(""); + clear = findTextFieldByName(changeName, "changeNameText"); + clear.setText(""); + clear = findTextFieldByName(checkChangePassword, "checkChangePasswordText"); + clear.setText(""); + clear = findTextFieldByName(changeOrt, "changeOrtText"); + clear.setText(""); + clear = findTextFieldByName(changePLZ, "changePLZText"); + clear.setText(""); + clear = findTextFieldByName(changeCarName, "changeCarNameText"); + clear.setText(""); + clear = findTextFieldByName(changeCarCO2, "changeCarCO2Text"); + clear.setText(""); + clear = findTextFieldByName(changeCarSpeed, "changeCarSpeedText"); + clear.setText(""); + clear = findTextFieldByName(changeBikeSpeed, "changeBikeSpeedText"); + clear.setText(""); } }); } From b34b0c82bced55c5d5d1c1ecaa3182e61736196b Mon Sep 17 00:00:00 2001 From: David Groys Date: Sun, 16 Jun 2024 15:51:20 +0200 Subject: [PATCH 27/28] Gui complete, I cooked --- src/main/java/de/hs_mannheim/ui/Main.java | 46 ++++++++++++++--------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index f3fcf03..1d09f26 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -558,23 +558,32 @@ public class Main extends JFrame { JLabel jlEntfernung = new JLabel("Entfernung:"); JLabel jlEntfernungText = new JLabel(details[3]); JLabel jlReisedauerUndKraftstoffverbrauch = new JLabel("Reisedauer und Kraftstoffverbrauch Auto:"); - JLabel jlAutoDauer = new JLabel(details[4]); - JLabel jlAutoVerbrauch = new JLabel(details[5]); + JLabel jlAutoDauerText = new JLabel(details[4]); + JLabel jlAutoVerbrauchText = new JLabel(details[5]); JLabel jlReisedauerMitFahrrad = new JLabel("Reisedauer mit Fahrrad:"); JLabel jlReisedauerMitFahrradText = new JLabel(details[6]); - jlAddress.setBounds(4, 6, 100, 100); - jlAddressText.setBounds(4, 16, 100, 100); - jlWettervorhersage.setBounds(4, 36, 100, 100); - jlWettervorhersageTextOne.setBounds(4, 46, 100, 100); - jlWettervorhersageTextTwo.setBounds(4, 56, 100, 100); - jlWettervorhersageTextThree.setBounds(4, 66, 100, 100); - jlEntfernung.setBounds(4, 86, 100, 100); - jlEntfernungText.setBounds(4, 96, 100, 100); - jlReisedauerUndKraftstoffverbrauch.setBounds(4, 116, 100, 100); - jlAutoDauer.setBounds(4, 126, 100, 100); - jlAutoVerbrauch.setBounds(4, 136, 100, 100); - jlReisedauerMitFahrrad.setBounds(4, 156, 100, 100); - jlReisedauerMitFahrradText.setBounds(4, 166, 100, 100); + if(details[4].equals("")){ + jlAutoDauerText.setText("---"); + } + if(details[5].equals("")){ + jlAutoVerbrauchText.setText("---"); + } + if(details[6].equals("")){ + jlReisedauerMitFahrradText.setText("---"); + } + jlAddress.setBounds(4, 0, 300, 20); + jlAddressText.setBounds(4, 12, 300, 20); + jlWettervorhersage.setBounds(4, 45, 300, 20); + jlWettervorhersageTextOne.setBounds(4, 57, 300, 20); + jlWettervorhersageTextTwo.setBounds(4, 69, 300, 20); + jlWettervorhersageTextThree.setBounds(4, 81, 300, 20); + jlEntfernung.setBounds(4, 108, 300, 20); + jlEntfernungText.setBounds(4, 120, 300, 20); + jlReisedauerUndKraftstoffverbrauch.setBounds(4, 147, 300, 20); + jlAutoDauerText.setBounds(4, 159, 300, 20); + jlAutoVerbrauchText.setBounds(4, 171, 300, 20); + jlReisedauerMitFahrrad.setBounds(4, 198, 300, 20); + jlReisedauerMitFahrradText.setBounds(4, 210, 300, 20); jp.add(jlAddress); jp.add(jlAddressText); jp.add(jlWettervorhersage); @@ -584,14 +593,15 @@ public class Main extends JFrame { jp.add(jlEntfernung); jp.add(jlEntfernungText); jp.add(jlReisedauerUndKraftstoffverbrauch); - jp.add(jlAutoDauer); - jp.add(jlAutoVerbrauch); + jp.add(jlAutoDauerText); + jp.add(jlAutoVerbrauchText); jp.add(jlReisedauerMitFahrrad); jp.add(jlReisedauerMitFahrradText); jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); jf.add(jp); - jf.setSize(300, 300); + jf.setSize(280, 270); + jf.setResizable(false); jf.setVisible(true); } }); From 606708c90424859b0ab6de12fb73a1faa2c1a8ad Mon Sep 17 00:00:00 2001 From: David Groys Date: Sun, 16 Jun 2024 15:59:39 +0200 Subject: [PATCH 28/28] Fixed minor visual bug, final commit --- src/main/java/de/hs_mannheim/ui/Main.java | 116 ++++++++++++++++++++-- 1 file changed, 105 insertions(+), 11 deletions(-) diff --git a/src/main/java/de/hs_mannheim/ui/Main.java b/src/main/java/de/hs_mannheim/ui/Main.java index 1d09f26..b5f695b 100644 --- a/src/main/java/de/hs_mannheim/ui/Main.java +++ b/src/main/java/de/hs_mannheim/ui/Main.java @@ -600,7 +600,7 @@ public class Main extends JFrame { jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); jf.add(jp); - jf.setSize(280, 270); + jf.setSize(320, 270); jf.setResizable(false); jf.setVisible(true); } @@ -675,15 +675,62 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { JFrame jf = new JFrame(); - JPanel jp = new JPanel(new FlowLayout()); + JPanel jp = new JPanel(); + jp.setLayout(null); String[] details = facade.destination_details(plz); - for (String ss : details) { - JLabel jl = new JLabel(ss); - jp.add(jl); + JLabel jlAddress = new JLabel("Zieladresse:"); + JLabel jlAddressText = new JLabel(address); + JLabel jlWettervorhersage = new JLabel("Wettervorhersage:"); + JLabel jlWettervorhersageTextOne = new JLabel(details[0]); + JLabel jlWettervorhersageTextTwo = new JLabel(details[1]); + JLabel jlWettervorhersageTextThree = new JLabel(details[2]); + JLabel jlEntfernung = new JLabel("Entfernung:"); + JLabel jlEntfernungText = new JLabel(details[3]); + JLabel jlReisedauerUndKraftstoffverbrauch = new JLabel("Reisedauer und Kraftstoffverbrauch Auto:"); + JLabel jlAutoDauerText = new JLabel(details[4]); + JLabel jlAutoVerbrauchText = new JLabel(details[5]); + JLabel jlReisedauerMitFahrrad = new JLabel("Reisedauer mit Fahrrad:"); + JLabel jlReisedauerMitFahrradText = new JLabel(details[6]); + if(details[4].equals("")){ + jlAutoDauerText.setText("---"); } + if(details[5].equals("")){ + jlAutoVerbrauchText.setText("---"); + } + if(details[6].equals("")){ + jlReisedauerMitFahrradText.setText("---"); + } + jlAddress.setBounds(4, 0, 300, 20); + jlAddressText.setBounds(4, 12, 300, 20); + jlWettervorhersage.setBounds(4, 45, 300, 20); + jlWettervorhersageTextOne.setBounds(4, 57, 300, 20); + jlWettervorhersageTextTwo.setBounds(4, 69, 300, 20); + jlWettervorhersageTextThree.setBounds(4, 81, 300, 20); + jlEntfernung.setBounds(4, 108, 300, 20); + jlEntfernungText.setBounds(4, 120, 300, 20); + jlReisedauerUndKraftstoffverbrauch.setBounds(4, 147, 300, 20); + jlAutoDauerText.setBounds(4, 159, 300, 20); + jlAutoVerbrauchText.setBounds(4, 171, 300, 20); + jlReisedauerMitFahrrad.setBounds(4, 198, 300, 20); + jlReisedauerMitFahrradText.setBounds(4, 210, 300, 20); + jp.add(jlAddress); + jp.add(jlAddressText); + jp.add(jlWettervorhersage); + jp.add(jlWettervorhersageTextOne); + jp.add(jlWettervorhersageTextTwo); + jp.add(jlWettervorhersageTextThree); + jp.add(jlEntfernung); + jp.add(jlEntfernungText); + jp.add(jlReisedauerUndKraftstoffverbrauch); + jp.add(jlAutoDauerText); + jp.add(jlAutoVerbrauchText); + jp.add(jlReisedauerMitFahrrad); + jp.add(jlReisedauerMitFahrradText); + jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); jf.add(jp); - jf.setSize(200, 200); + jf.setSize(320, 270); + jf.setResizable(false); jf.setVisible(true); } }); @@ -733,15 +780,62 @@ public class Main extends JFrame { @Override public void actionPerformed(ActionEvent e) { JFrame jf = new JFrame(); - JPanel jp = new JPanel(new FlowLayout()); + JPanel jp = new JPanel(); + jp.setLayout(null); String[] details = facade.destination_details(plz); - for (String ss : details) { - JLabel jl = new JLabel(ss); - jp.add(jl); + JLabel jlAddress = new JLabel("Zieladresse:"); + JLabel jlAddressText = new JLabel(address); + JLabel jlWettervorhersage = new JLabel("Wettervorhersage:"); + JLabel jlWettervorhersageTextOne = new JLabel(details[0]); + JLabel jlWettervorhersageTextTwo = new JLabel(details[1]); + JLabel jlWettervorhersageTextThree = new JLabel(details[2]); + JLabel jlEntfernung = new JLabel("Entfernung:"); + JLabel jlEntfernungText = new JLabel(details[3]); + JLabel jlReisedauerUndKraftstoffverbrauch = new JLabel("Reisedauer und Kraftstoffverbrauch Auto:"); + JLabel jlAutoDauerText = new JLabel(details[4]); + JLabel jlAutoVerbrauchText = new JLabel(details[5]); + JLabel jlReisedauerMitFahrrad = new JLabel("Reisedauer mit Fahrrad:"); + JLabel jlReisedauerMitFahrradText = new JLabel(details[6]); + if(details[4].equals("")){ + jlAutoDauerText.setText("---"); } + if(details[5].equals("")){ + jlAutoVerbrauchText.setText("---"); + } + if(details[6].equals("")){ + jlReisedauerMitFahrradText.setText("---"); + } + jlAddress.setBounds(4, 0, 300, 20); + jlAddressText.setBounds(4, 12, 300, 20); + jlWettervorhersage.setBounds(4, 45, 300, 20); + jlWettervorhersageTextOne.setBounds(4, 57, 300, 20); + jlWettervorhersageTextTwo.setBounds(4, 69, 300, 20); + jlWettervorhersageTextThree.setBounds(4, 81, 300, 20); + jlEntfernung.setBounds(4, 108, 300, 20); + jlEntfernungText.setBounds(4, 120, 300, 20); + jlReisedauerUndKraftstoffverbrauch.setBounds(4, 147, 300, 20); + jlAutoDauerText.setBounds(4, 159, 300, 20); + jlAutoVerbrauchText.setBounds(4, 171, 300, 20); + jlReisedauerMitFahrrad.setBounds(4, 198, 300, 20); + jlReisedauerMitFahrradText.setBounds(4, 210, 300, 20); + jp.add(jlAddress); + jp.add(jlAddressText); + jp.add(jlWettervorhersage); + jp.add(jlWettervorhersageTextOne); + jp.add(jlWettervorhersageTextTwo); + jp.add(jlWettervorhersageTextThree); + jp.add(jlEntfernung); + jp.add(jlEntfernungText); + jp.add(jlReisedauerUndKraftstoffverbrauch); + jp.add(jlAutoDauerText); + jp.add(jlAutoVerbrauchText); + jp.add(jlReisedauerMitFahrrad); + jp.add(jlReisedauerMitFahrradText); + jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE); jf.add(jp); - jf.setSize(200, 200); + jf.setSize(320, 270); + jf.setResizable(false); jf.setVisible(true); } });