diff --git a/ressources/Logo S.png b/ressources/Logo S.png new file mode 100644 index 0000000..9ebcd7f Binary files /dev/null and b/ressources/Logo S.png differ diff --git a/ressources/Logo Student.png b/ressources/Logo Student.png new file mode 100644 index 0000000..aca61dc Binary files /dev/null and b/ressources/Logo Student.png differ diff --git a/src/Hierarchie/Test.java b/src/Hierarchie/Test.java new file mode 100644 index 0000000..9263580 --- /dev/null +++ b/src/Hierarchie/Test.java @@ -0,0 +1,37 @@ +package Hierarchie; + +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import java.awt.LayoutManager; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; + +public class Test { + + public static void main(String[] args) { + // TODO Auto-generated method stub + JFrame myWindow = new JFrame(); + myWindow.setSize(500,500); + myWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + myWindow.setLayout(new GridLayout(2,1)); + + + JPanel panel1 = new JPanel(); + //panel1.setLayout(new GridLayout(2,1)); + JButton button1 = new JButton("B1"); + JButton button2 = new JButton("B2"); + myWindow.add(button1); + myWindow.add(button2); + + //myWindow.add(panel1); + + myWindow.setVisible(true); + + } + +} diff --git a/src/Hierarchie/mainWindow.java b/src/Hierarchie/mainWindow.java new file mode 100644 index 0000000..0af942f --- /dev/null +++ b/src/Hierarchie/mainWindow.java @@ -0,0 +1,92 @@ +package Hierarchie; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.geom.*; + +public class mainWindow extends JFrame implements ActionListener{ + + JButton bSearch; + JButton ListingS; + JButton addS; + JTextField textfield; + + mainWindow(){ + + this.setTitle("Student"); // set the title of the window + this.setSize(960,540); //set the x-dimension and the y-dimension of the this + Image icon = Toolkit.getDefaultToolkit().getImage("ressources/Logo S.png"); // create an image icon + this.setIconImage(icon); // replace the standard icon of the window + this.setLayout(new GridLayout(4,1)); // set a Layout for all the window + + JLabel label = new JLabel(); // create a new label + ImageIcon image = new ImageIcon("ressources/Logo Student.png"); // add an image to the label + label.setIcon(image);// set the image on the label + + textfield = new JTextField("Enter student's name and surname...", 20); //set a TextField + + bSearch = new JButton("Search"); //set a button + bSearch.addActionListener(this); //add an actionListener when the button is pressed + bSearch.setForeground(Color.WHITE); //change the color of the text + bSearch.setBackground(new Color(155,155,155)); //change the color of the background + + ListingS = new JButton(); + ListingS.setText("List students"); + ListingS.setForeground(Color.WHITE); + ListingS.setBackground(new Color(66,133,244)); + ListingS.setPreferredSize(new Dimension(300,20)); + + addS = new JButton(); // create a new button + addS.setText("Add a new student"); //set the text inside the button + addS.setForeground(Color.WHITE); //change the text color of the button + addS.setBackground(new Color(66,133,244)); //change the background color of the button + addS.setPreferredSize(new Dimension(300,20)); // set the size of the button + + JPanel headerPanel = new JPanel(); // create a headerPanel + headerPanel.setLayout(new FlowLayout()); + headerPanel.add(label); // add the label to the headerPanel + headerPanel.setBackground(Color.WHITE);//set Background color of the headerPanel + headerPanel.setPreferredSize(new Dimension(960,120)); //set the place of the headerPanel + + JPanel searchBar = new JPanel(); //create a searchBar Panel + searchBar.setLayout(new FlowLayout()); + searchBar.add(textfield); // add the textField to the middle Panel + searchBar.add(bSearch); // add the Search button + searchBar.setBackground(Color.WHITE);//set Background color of the headerPanel + + + JPanel ButtonList = new JPanel(); // add a new Buttons Panel + ButtonList.setLayout(new FlowLayout()); // set a grid layout for the two buttons + ButtonList.add(ListingS); //add the button Listing S to the layout + ButtonList.setBackground(Color.WHITE);//set Background color of the headerPanel + + JPanel ButtonAdd = new JPanel(); // add a new Buttons Panel + ButtonAdd.setLayout(new FlowLayout()); // set a grid layout for the two buttons + ButtonAdd.add(addS); //add the button addS to the layout + ButtonAdd.setBackground(Color.WHITE);//set Background color of the headerPanel + + + this.add(headerPanel); // add the header panel to the window + this.add(searchBar); // add the searchbar panel to the window + this.add(ButtonList); // add the Buttons panel to the window + this.add(ButtonAdd); // add the Buttons panel to the window + + this.setResizable(false); // prevent this from being resize + this.getContentPane().setBackground(new Color(255,255,255)); //change the color of the background + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //exit out of application + this.setVisible(true); //make the this visible + } + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if(e.getSource()==bSearch) { + this.getContentPane().removeAll(); + this.repaint(); + } + } + + +} diff --git a/src/Hierarchie/main_StudentH.java b/src/Hierarchie/main_StudentH.java deleted file mode 100644 index a9dbda0..0000000 --- a/src/Hierarchie/main_StudentH.java +++ /dev/null @@ -1,10 +0,0 @@ -package Hierarchie; - -public class main_StudentH { - - public static void main(String[] args) { - // TODO Auto-generated method stub - - } - -} diff --git a/src/module-info.java b/src/module-info.java index a53f393..fd51ec0 100644 --- a/src/module-info.java +++ b/src/module-info.java @@ -1,2 +1,3 @@ module Java_Final_Project_Erasmus2022 { + requires java.desktop; } \ No newline at end of file