Skip to content

Commit

Permalink
Buttons not covered by BG image
Browse files Browse the repository at this point in the history
  • Loading branch information
wkc12001 committed Apr 11, 2015
1 parent 5248399 commit b40a4a0
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion MerchantRPGCSE2102/src/view/StartScreen.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package view;

import java.awt.*;
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Image;
Expand All @@ -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 {
Expand Down

0 comments on commit b40a4a0

Please sign in to comment.