Ajouté JMenuBar, avec pour seul bouton un éditeur de cartes

This commit is contained in:
galaxyoyo 2015-01-07 18:42:22 +01:00
parent 1470a143ef
commit b31d9db0f0
4 changed files with 59 additions and 4 deletions

View File

@ -122,7 +122,7 @@ public class Main
*/ */
private static void launchEditMode() private static void launchEditMode()
{ {
System.out.println("Lancement de l'\u00e9diteurde monde ..."); System.out.println("Lancement de l'\u00e9diteur de monde ...");
} }
/** /**

View File

@ -3,9 +3,14 @@
*/ */
package galaxyoyo.unknown.frame; package galaxyoyo.unknown.frame;
import galaxyoyo.unknown.frame.listeners.EditMapsListener;
import java.awt.Dimension; import java.awt.Dimension;
import javax.swing.JFrame; 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.LogManager;
import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.Logger;
@ -29,8 +34,17 @@ public class MainFrame extends JFrame
*/ */
private static MainFrame INSTANCE; private static MainFrame INSTANCE;
/**
* Logger de la classe
* @see LogManager#getLogger(String)
*/
private static Logger LOGGER = (Logger) LogManager.getLogger("MainFrame"); 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 * Constructeur
* @see galaxyoyo.unknown.client.main.Main#launchFrame() * @see galaxyoyo.unknown.client.main.Main#launchFrame()
@ -38,13 +52,22 @@ public class MainFrame extends JFrame
private MainFrame() private MainFrame()
{ {
super (); super ();
LOGGER.info("D\u00e9marrage du jeu ..."); LOGGER.info("Initialisation de la fen\u00eatre");
this.setTitle("WHAT IS THE NAME PLEASE"); this.setTitle("WHAT IS THE NAME PLEASE");
this.setPreferredSize(new Dimension(1000, 800)); this.setPreferredSize(new Dimension(1000, 800));
this.setSize(800, 700); this.setSize(800, 700);
this.setLocationRelativeTo(null); this.setLocationRelativeTo(null);
this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setExtendedState(JFrame.MAXIMIZED_BOTH);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
menuBar.add(fichier);
editMaps.addActionListener(new EditMapsListener());
editer.add(editMaps);
menuBar.add(editer);
this.setJMenuBar(menuBar);
} }
/** /**

View File

@ -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" : "");
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Configuration package="log4j.test" status="INFO"> <Configuration package="log4j.test" status="info">
<Loggers> <Loggers>
<Root level="INFO"> <Root level="info">
</Root> </Root>
</Loggers> </Loggers>
</Configuration> </Configuration>