From 3f51761f393c586b2f678141e42ee76e7ee2f473 Mon Sep 17 00:00:00 2001 From: afortuna2016 Date: Fri, 21 Apr 2017 21:13:04 -0400 Subject: [PATCH] main menuuu --- src/view/MainMenu.java | 139 ++--------------------------------------- 1 file changed, 6 insertions(+), 133 deletions(-) diff --git a/src/view/MainMenu.java b/src/view/MainMenu.java index 6171bf0..e4d1b87 100644 --- a/src/view/MainMenu.java +++ b/src/view/MainMenu.java @@ -1,149 +1,22 @@ package view; -import javax.imageio.ImageIO; - -import javax.swing.*; -<<<<<<< HEAD - -import controller.Cashflow; -import model.Instructions; - import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; +import java.io.*; -public class MainMenu -{ - public static void main (String[] args) - { - final JFrame frame = new JFrame("CashFlow"); - - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setSize(650,530); - Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); - int x = (int) ((dimension.getWidth() - frame.getWidth()) / 2); - int y = (int) ((dimension.getHeight() - frame.getHeight()) / 2) -100; - frame.setLocation(x, y); - - JPanel panel1 = new JPanel(); - panel1.setSize(140, 45); - panel1.setLocation(255, 125); - panel1.setOpaque(false); - //Font font = new Font ("Times New Roman", Font.BOLD, 30); - //panel1.setFont(font); - - JPanel panel2 = new JPanel(); - panel2.setSize(140, 45); - panel2.setLocation(255, 160); - panel2.setOpaque(false); - - JPanel panel3 = new JPanel(); - panel3.setSize(140, 45); - panel3.setLocation(255, 260); - panel3.setOpaque(false); - - JPanel panel4 = new JPanel(); - panel4.setSize(140, 45); - panel4.setLocation(255, 295); - panel4.setOpaque(false); - - JPanel panel5 = new JPanel(); - panel5.setSize(140, 45); - panel5.setLocation(255, 330); - panel5.setOpaque(false); - - - JButton newGame = new JButton("New Game"); - JButton savedGame = new JButton("Saved Game"); - JButton rules = new JButton("Rules"); - JButton settings = new JButton("Settings"); - JButton exit = new JButton("Exit"); - - newGame.setPreferredSize(new Dimension(140,40)); - newGame.setForeground(Color.MAGENTA); - - savedGame.setPreferredSize(new Dimension(130,40)); - savedGame.setForeground(Color.MAGENTA); - - - rules.setPreferredSize(new Dimension(80,40)); - rules.setForeground(Color.MAGENTA); - - - settings.setPreferredSize(new Dimension(120,40)); - settings.setForeground(Color.MAGENTA); - - - exit.setPreferredSize(new Dimension(100,40)); - exit.setForeground(Color.MAGENTA); +import javax.imageio.ImageIO; +import javax.swing.*; - - BufferedImage img = null; - try { - img = ImageIO.read(new File("gameboard.png")); - } catch (IOException e) { - e.printStackTrace(); - } - Image dimg = img.getScaledInstance(800, 508, Image.SCALE_SMOOTH); - ImageIcon imageIcon = new ImageIcon(dimg); - frame.setContentPane(new JLabel(imageIcon)); - frame.getContentPane().add(new JLabel(imageIcon)); - - - panel1.add(newGame); - panel2.add(savedGame); - panel3.add(rules); - panel4.add(settings); - panel5.add(exit); - - frame.add(panel1); - frame.add(panel2); - frame.add(panel3); - frame.add(panel4); - frame.add(panel5); - frame.setVisible(true); - - newGame.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frame.dispose(); - Cashflow.go(); - } - }); - - rules.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frame.dispose(); - Instructions.getClicked(); - } - }); - - exit.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - System.exit(0); - } - }); - - - - - - - -}} -======= -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; +import controller.Cashflow; +import model.Instructions; public class MainMenu { public static void main (String[] args) { - JFrame frame = new JFrame("CashFlow"); + final JFrame frame = new JFrame("CashFlow"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(650,530);