From c70618435aa316df483e0940e7baf45802e4bb2a Mon Sep 17 00:00:00 2001 From: HU helene Date: Mon, 18 Mar 2024 17:01:51 +0100 Subject: [PATCH] #14 Basic gui --- .../java/fr/u_paris/gla/project/gui/View.form | 197 ++++++++++++++++++ .../java/fr/u_paris/gla/project/gui/View.java | 66 ++++++ 2 files changed, 263 insertions(+) create mode 100644 src/main/java/fr/u_paris/gla/project/gui/View.form create mode 100644 src/main/java/fr/u_paris/gla/project/gui/View.java diff --git a/src/main/java/fr/u_paris/gla/project/gui/View.form b/src/main/java/fr/u_paris/gla/project/gui/View.form new file mode 100644 index 0000000..e536cd5 --- /dev/null +++ b/src/main/java/fr/u_paris/gla/project/gui/View.form @@ -0,0 +1,197 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/fr/u_paris/gla/project/gui/View.java b/src/main/java/fr/u_paris/gla/project/gui/View.java new file mode 100644 index 0000000..52be130 --- /dev/null +++ b/src/main/java/fr/u_paris/gla/project/gui/View.java @@ -0,0 +1,66 @@ +package fr.u_paris.gla.project.gui; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class View extends JFrame{ + private JPanel Cardpanel; + private JMenuItem Home; + private JMenuItem Network; + private JMenuItem Favorites; + private JPanel NetworkPanel; + private JPanel FavoritesPanel; + private JTextField textField1; + private JButton searchButton; + private JPanel HomePanel; + private JPanel MainPanel; + + public View() throws HeadlessException { + setContentPane(MainPanel); + setTitle("app"); + setExtendedState(JFrame.MAXIMIZED_BOTH); + //setUndecorated(true); + setVisible(true);; + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + Home.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + Cardpanel.removeAll(); + Cardpanel.add(HomePanel); + Cardpanel.repaint(); + Cardpanel.revalidate(); + } + }); + + Network.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + Cardpanel.removeAll(); + Cardpanel.add(NetworkPanel); + Cardpanel.repaint(); + Cardpanel.revalidate(); + } + }); + + Favorites.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + Cardpanel.removeAll(); + Cardpanel.add(FavoritesPanel); + Cardpanel.repaint(); + Cardpanel.revalidate(); + } + }); + + + } + + public static void main(String[] args) { + View v = new View(); + + + } +}