diff --git a/src/main/java/galaxyoyo/unknown/client/main/Main.java b/src/main/java/galaxyoyo/unknown/client/main/Main.java index 71b4917..ac2b11e 100644 --- a/src/main/java/galaxyoyo/unknown/client/main/Main.java +++ b/src/main/java/galaxyoyo/unknown/client/main/Main.java @@ -122,7 +122,7 @@ public class Main */ private static void launchEditMode() { - System.out.println("Lancement de l'\u00e9diteurde monde ..."); + System.out.println("Lancement de l'\u00e9diteur de monde ..."); } /** diff --git a/src/main/java/galaxyoyo/unknown/frame/MainFrame.java b/src/main/java/galaxyoyo/unknown/frame/MainFrame.java index 70e8df3..bfd8bb8 100644 --- a/src/main/java/galaxyoyo/unknown/frame/MainFrame.java +++ b/src/main/java/galaxyoyo/unknown/frame/MainFrame.java @@ -3,9 +3,14 @@ */ package galaxyoyo.unknown.frame; +import galaxyoyo.unknown.frame.listeners.EditMapsListener; + import java.awt.Dimension; import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.Logger; @@ -29,7 +34,16 @@ public class MainFrame extends JFrame */ private static MainFrame INSTANCE; + /** + * Logger de la classe + * @see LogManager#getLogger(String) + */ private static Logger LOGGER = (Logger) LogManager.getLogger("MainFrame"); + + private JMenuBar menuBar = new JMenuBar(); + private JMenu fichier = new JMenu("Fichier"); + private JMenu editer = new JMenu("\u00c9diter"); + private JMenuItem editMaps = new JMenuItem("Cartes"); /** * Constructeur @@ -38,13 +52,22 @@ public class MainFrame extends JFrame private MainFrame() { super (); - LOGGER.info("D\u00e9marrage du jeu ..."); + LOGGER.info("Initialisation de la fen\u00eatre"); this.setTitle("WHAT IS THE NAME PLEASE"); this.setPreferredSize(new Dimension(1000, 800)); this.setSize(800, 700); this.setLocationRelativeTo(null); this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + menuBar.add(fichier); + + editMaps.addActionListener(new EditMapsListener()); + editer.add(editMaps); + + menuBar.add(editer); + + this.setJMenuBar(menuBar); } /** diff --git a/src/main/java/galaxyoyo/unknown/frame/listeners/EditMapsListener.java b/src/main/java/galaxyoyo/unknown/frame/listeners/EditMapsListener.java new file mode 100644 index 0000000..eb0dae7 --- /dev/null +++ b/src/main/java/galaxyoyo/unknown/frame/listeners/EditMapsListener.java @@ -0,0 +1,32 @@ +/** + * @author galaxyoyo + */ +package galaxyoyo.unknown.frame.listeners; + +import galaxyoyo.unknown.client.main.Main; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author galaxyoyo + */ +public class EditMapsListener implements ActionListener +{ + /** + * + */ + public EditMapsListener() + { + } + + /* !CodeTemplates.overridecomment.nonjd! + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent event) + { + Main.main("--edit", Main.isInDebugMode() ? " --debug true" : ""); + } + +} diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml index 9a809f8..6e12164 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -1,7 +1,7 @@ - + - + \ No newline at end of file