added Menu to the actual game, some fixes are required

This commit is contained in:
shebang
2015-01-13 04:39:40 +01:00
parent 2024c2f08b
commit e5608f6a62
2 changed files with 17 additions and 9 deletions
+8 -8
View File
@@ -26,6 +26,7 @@ import de.heatup.objects.StaticObject;
import de.heatup.timers.HardwareResetTimers; import de.heatup.timers.HardwareResetTimers;
import de.heatup.ui.actionPanel.ActionControl; import de.heatup.ui.actionPanel.ActionControl;
import de.heatup.ui.actionPanel.ActionWatcher; import de.heatup.ui.actionPanel.ActionWatcher;
import de.heatup.ui.menu.MenuPanel;
public class Main extends JFrame implements Runnable { public class Main extends JFrame implements Runnable {
@@ -47,11 +48,12 @@ public class Main extends JFrame implements Runnable {
private static JPanel outerPanel; private static JPanel outerPanel;
private static JPanel statusPanel; private static JPanel statusPanel;
private static JPanel gamePanel; private static JPanel gamePanel;
private static JPanel menuPanel;
private static JPanel leftPanel; private static JPanel leftPanel;
private static JPanel rightPanel; private static JPanel rightPanel;
private static JPanel actionPanel; private static JPanel actionPanel;
private static JPanel menuPanel;
public Main(){ public Main(){
setTitle("HeatUP!"); setTitle("HeatUP!");
setDefaultCloseOperation(EXIT_ON_CLOSE); setDefaultCloseOperation(EXIT_ON_CLOSE);
@@ -79,13 +81,6 @@ public class Main extends JFrame implements Runnable {
gamePanel.setFocusable(false); gamePanel.setFocusable(false);
gamePanel.setBackground(Color.black); gamePanel.setBackground(Color.black);
menuPanel = new JPanel();
menuPanel.setLayout(null);
menuPanel.setPreferredSize(new Dimension(800,600));
menuPanel.setFocusable(false);
menuPanel.setBackground(Color.black);
actionPanel = new JPanel(); actionPanel = new JPanel();
actionPanel.setLayout(new GridLayout(1,1)); actionPanel.setLayout(new GridLayout(1,1));
actionPanel.setPreferredSize(new Dimension(800,80)); actionPanel.setPreferredSize(new Dimension(800,80));
@@ -99,12 +94,17 @@ public class Main extends JFrame implements Runnable {
rightPanel.setLayout(null); rightPanel.setLayout(null);
rightPanel.setBackground(Color.black); rightPanel.setBackground(Color.black);
MenuPanel.setMenuPanel();
menuPanel = MenuPanel.getMenuPanel();
outerPanel.add(statusPanel,BorderLayout.NORTH); outerPanel.add(statusPanel,BorderLayout.NORTH);
outerPanel.add(leftPanel, BorderLayout.WEST); outerPanel.add(leftPanel, BorderLayout.WEST);
outerPanel.add(rightPanel, BorderLayout.EAST); outerPanel.add(rightPanel, BorderLayout.EAST);
outerPanel.add(gamePanel,BorderLayout.CENTER); outerPanel.add(gamePanel,BorderLayout.CENTER);
outerPanel.add(actionPanel,BorderLayout.SOUTH); outerPanel.add(actionPanel,BorderLayout.SOUTH);
outerPanel.add(menuPanel, BorderLayout.CENTER);
add(outerPanel); add(outerPanel);
pack(); pack();
setVisible(true); setVisible(true);
+9 -1
View File
@@ -7,7 +7,10 @@ import java.awt.event.MouseEvent;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import de.heatup.logging.Logger;
import de.heatup.ui.FontLoader; import de.heatup.ui.FontLoader;
import de.heatup.ui.Main;
import de.heatup.ui.PanelBuilder;
public class MenuPanel { public class MenuPanel {
@@ -33,6 +36,9 @@ public class MenuPanel {
public static void setMenuPanel() { public static void setMenuPanel() {
menuPanel.setPreferredSize(new Dimension(800,600));
menuPanel.setFocusable(false);
GridLayout menuGrid = new GridLayout(5, 1); GridLayout menuGrid = new GridLayout(5, 1);
menuPanel.setBackground(Color.BLACK); menuPanel.setBackground(Color.BLACK);
menuPanel.setLayout(menuGrid); menuPanel.setLayout(menuGrid);
@@ -68,7 +74,9 @@ public class MenuPanel {
startGame.addMouseListener(new MouseAdapter() { startGame.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
// @TODO: implement start game // @TODO: implement start game
System.out.println("game started");
//PanelBuilder.createGame(1);
Logger.write("Game Started via menu");
} }
}); });