Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions mainMenu/LabelFrame.java

This file was deleted.

14 changes: 0 additions & 14 deletions mainMenu/MainMenu.java

This file was deleted.

Binary file added mainMenu/background2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 7 additions & 12 deletions mainMenu/myCustomPanel.java → mainMenu/backgroundAdapt.java
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
package principal;

import java.awt.*;
import java.net.*;
import javax.swing.*;

public class myCustomPanel extends JPanel
{
public class backgroundAdapt extends JPanel {

private Image background;

public myCustomPanel(URL path)
{
public backgroundAdapt(URL path) {
this.background = new ImageIcon(path).getImage();
setOpaque(false);
setPreferredSize(new Dimension(getWidth(), getHeight()));
}

myCustomPanel()
{
backgroundAdapt() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
protected void paintComponent(Graphics g)
{
protected void paintComponent(Graphics g) {
g.drawImage(background, 0, 0, this);
super.paintComponent(g);
}

@Override
public int getWidth()
{
public int getWidth() {
return background.getWidth(this);
}

@Override
public int getHeight()
{
public int getHeight() {
return background.getHeight(this);
}
}
File renamed without changes
45 changes: 45 additions & 0 deletions mainMenu/difficultyMenu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package principal;

import java.awt.*;
import java.net.*;
import javax.swing.*;

public class difficultyMenu extends JFrame {
private JPanel panel1;
private JButton easyButton, mediumButton, hardButton;
private final URL background = getClass().getResource("background2.jpg");
Icon easyIcon = new ImageIcon(getClass().getResource("easy.png"));
Icon mediumIcon = new ImageIcon(getClass().getResource("medium.png"));
Icon hardIcon = new ImageIcon(getClass().getResource("hard.png"));

public difficultyMenu(){
super("Main Menu");
setLayout(new BorderLayout());

panel1 = new backgroundAdapt(background);
panel1.setLayout(new GridBagLayout());

easyButton = new JButton();
easyButton.setIcon(easyIcon);
easyButton.setOpaque(false);
easyButton.setContentAreaFilled(false);
easyButton.setBorderPainted(false);

mediumButton = new JButton();
mediumButton.setIcon(mediumIcon);
mediumButton.setOpaque(false);
mediumButton.setContentAreaFilled(false);
mediumButton.setBorderPainted(false);

hardButton = new JButton();
hardButton.setIcon(hardIcon);
hardButton.setOpaque(false);
hardButton.setContentAreaFilled(false);
hardButton.setBorderPainted(false);

this.add(panel1);
panel1.add(easyButton);
panel1.add(mediumButton);
panel1.add(hardButton);
}
}
Binary file added mainMenu/easy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
13 changes: 13 additions & 0 deletions mainMenu/gameExecutor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package principal;
import java.net.MalformedURLException;
import javax.swing.JFrame;
public class gameExecutor {

public static void main(String[] args) throws MalformedURLException {
mainMenu frame = new mainMenu();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(804,600);
frame.setResizable(false);
frame.setVisible(true);
}
}
Binary file added mainMenu/hard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
60 changes: 60 additions & 0 deletions mainMenu/mainMenu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package principal;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.*;
import javax.swing.*;

public class mainMenu extends JFrame {
private JPanel panel1;
private JButton battleshipButton, ticTacButton;
private final URL background = getClass().getResource("fundo jogo.jpg");
Icon battleshipIcon = new ImageIcon(getClass().getResource("battleship botao.png"));
Icon ticTacIcon = new ImageIcon(getClass().getResource("jogo da velha botao.png"));

public mainMenu() throws MalformedURLException {
super("Main Menu");
setLayout(new BorderLayout());

panel1 = new backgroundAdapt(background);
panel1.setLayout(new GridBagLayout());

battleshipButton = new JButton();
battleshipButton.setIcon(battleshipIcon);
battleshipButton.setOpaque(false);
battleshipButton.setContentAreaFilled(false);
battleshipButton.setBorderPainted(false);
battleshipButton.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0));
battleshipButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
difficultyMenu frame2 = new difficultyMenu();
frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame2.setSize(804,600);
frame2.setResizable(false);
frame2.setVisible(true);
}
});

ticTacButton = new JButton();
ticTacButton.setIcon(ticTacIcon);
ticTacButton.setOpaque(false);
ticTacButton.setContentAreaFilled(false);
ticTacButton.setBorderPainted(false);
ticTacButton.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0));
ticTacButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
ticTacToeBoard gameFrame = new ticTacToeBoard();
gameFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gameFrame.setSize(804,600);
gameFrame.setResizable(false);
gameFrame.setVisible(true);

}
});

this.add(panel1);
panel1.add(battleshipButton);
panel1.add(ticTacButton);
}
}
Binary file added mainMenu/medium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.