From b40a4a0fc6235aea148094d90369d4ca2c561497 Mon Sep 17 00:00:00 2001 From: MrWilliamC Date: Sat, 11 Apr 2015 15:37:46 -0400 Subject: [PATCH] Buttons not covered by BG image --- MerchantRPGCSE2102/src/view/StartScreen.java | 38 +++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/MerchantRPGCSE2102/src/view/StartScreen.java b/MerchantRPGCSE2102/src/view/StartScreen.java index 4d900dd..47e6bc9 100644 --- a/MerchantRPGCSE2102/src/view/StartScreen.java +++ b/MerchantRPGCSE2102/src/view/StartScreen.java @@ -1,5 +1,6 @@ package view; +import java.awt.*; import java.awt.Color; import java.awt.GradientPaint; import java.awt.Image; @@ -13,48 +14,83 @@ import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; +import javax.swing.*; public class StartScreen extends JFrame { + private static final long serialVersionUID = 1L; + JPanel startMenu = new JPanel(); + + public static void main(String[] args) throws IOException { new StartScreen(); } public StartScreen() throws IOException { + + + + + + JLabel MainMenuBG = new JLabel(new ImageIcon("src/images/background.jpg")); + MainMenuBG.setVisible(true); + + + + + + + Image icon, background; icon = loadIcon(); background = loadBackground(); BackgroundPanel panel = new BackgroundPanel(background, BackgroundPanel.ACTUAL, 1.0f, 0.5f); this.setIconImage(icon); + this.setTitle("The Merchant RPG"); this.setSize(1500, 844); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setResizable(false); this.setVisible(true); + + JButton start = new JButton("Start"); + start.setVisible(true); + + start.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ System.out.println("Game started"); } }); + JButton instructions = new JButton("Instructions"); + instructions.setVisible(true); + + + instructions.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ System.out.println("Instructions opened"); } + }); + this.getContentPane().setLayout(null); start.setBounds(650, 382, 200, 80); instructions.setBounds(650, 482, 200, 40); panel.setBounds(0, 0, 1500, 844); start.setBackground(null); instructions.setBackground(null); - this.add(panel); + + this.getContentPane().add(instructions); this.getContentPane().add(start); + + this.add(panel); } public BufferedImage loadIcon() throws IOException {