Database Icons
This commit is contained in:
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 344 B |
Binary file not shown.
|
After Width: | Height: | Size: 344 B |
@@ -277,7 +277,6 @@ public class Control {
|
|||||||
y = (int) ((float) (mouseY - offset) / (800f / ((float) ySize)));
|
y = (int) ((float) (mouseY - offset) / (800f / ((float) ySize)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
x = (int) ((float) (mouseX - offset) / (800f / ((float) xSize)));
|
x = (int) ((float) (mouseX - offset) / (800f / ((float) xSize)));
|
||||||
y = (int) ((float) (mouseY - offset) / (800f / ((float) ySize * ratio)));
|
y = (int) ((float) (mouseY - offset) / (800f / ((float) ySize * ratio)));
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ import javax.swing.event.DocumentListener;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In this class the Control Window is implemented. In the Control Window you are able to change some game variables and enable the drawing mode.
|
||||||
|
* @author Noah Kessinger
|
||||||
|
*/
|
||||||
public class ControlWindow extends GUI {
|
public class ControlWindow extends GUI {
|
||||||
|
|
||||||
private final int width = 400, height = 800;
|
private final int width = 400, height = 800;
|
||||||
@@ -55,7 +60,7 @@ public class ControlWindow extends GUI {
|
|||||||
controlWindow.setLocation(control.getGameWindowPos().x - (width + offset), control.getGameWindowPos().y);
|
controlWindow.setLocation(control.getGameWindowPos().x - (width + offset), control.getGameWindowPos().y);
|
||||||
controlWindow.setLayout(null);
|
controlWindow.setLayout(null);
|
||||||
|
|
||||||
ImageIcon imageIcon = new ImageIcon("src/assets/icons/Icon.png");
|
ImageIcon imageIcon = new ImageIcon(iconPath);
|
||||||
controlWindow.setIconImage(imageIcon.getImage());
|
controlWindow.setIconImage(imageIcon.getImage());
|
||||||
|
|
||||||
controlWindow.addWindowListener(new WindowAdapter() {
|
controlWindow.addWindowListener(new WindowAdapter() {
|
||||||
|
|||||||
@@ -4,14 +4,21 @@ import gamecontrol.Control;
|
|||||||
import gui.fundamental.Hover;
|
import gui.fundamental.Hover;
|
||||||
import gui.fundamental.RoundedBorder;
|
import gui.fundamental.RoundedBorder;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is the Window to access the Data from the Database and delete some entries.
|
||||||
|
* @author Noah Kessinger
|
||||||
|
*/
|
||||||
public class DatabaseWindow extends GUI {
|
public class DatabaseWindow extends GUI {
|
||||||
|
|
||||||
private JFrame databaseWindow;
|
private JFrame databaseWindow;
|
||||||
@@ -44,7 +51,7 @@ public class DatabaseWindow extends GUI {
|
|||||||
|
|
||||||
databaseWindow.setTitle(this.title + " Database Control");
|
databaseWindow.setTitle(this.title + " Database Control");
|
||||||
|
|
||||||
ImageIcon imageIcon = new ImageIcon("src/assets/icons/Icon.png");
|
ImageIcon imageIcon = new ImageIcon(iconPath);
|
||||||
databaseWindow.setIconImage(imageIcon.getImage());
|
databaseWindow.setIconImage(imageIcon.getImage());
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +64,7 @@ public class DatabaseWindow extends GUI {
|
|||||||
databaseWindow.setSize(1400, getAllGrids().size() * 75 + 200);
|
databaseWindow.setSize(1400, getAllGrids().size() * 75 + 200);
|
||||||
|
|
||||||
|
|
||||||
databaseWindow.setResizable(true);
|
databaseWindow.setResizable(false);
|
||||||
|
|
||||||
databaseWindow.addWindowListener(new WindowAdapter() {
|
databaseWindow.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -129,8 +136,8 @@ public class DatabaseWindow extends GUI {
|
|||||||
max_cellcounts[i].setForeground(Color.decode("#121212"));
|
max_cellcounts[i].setForeground(Color.decode("#121212"));
|
||||||
max_cellcounts[i].setVisible(true);
|
max_cellcounts[i].setVisible(true);
|
||||||
|
|
||||||
deleteButtons[i] = new JButton();
|
Icon icon = new ImageIcon(deleteIconPath);
|
||||||
deleteButtons[i].setText("Delete");
|
deleteButtons[i] = new JButton(icon);
|
||||||
deleteButtons[i].setFont(text);
|
deleteButtons[i].setFont(text);
|
||||||
deleteButtons[i].setForeground(Color.decode("#121212"));
|
deleteButtons[i].setForeground(Color.decode("#121212"));
|
||||||
deleteButtons[i].setBorderPainted(true);
|
deleteButtons[i].setBorderPainted(true);
|
||||||
@@ -138,8 +145,7 @@ public class DatabaseWindow extends GUI {
|
|||||||
deleteButtons[i].setContentAreaFilled(false);
|
deleteButtons[i].setContentAreaFilled(false);
|
||||||
deleteButtons[i].setBounds(1300, 75 * i + 150, 50, 30);
|
deleteButtons[i].setBounds(1300, 75 * i + 150, 50, 30);
|
||||||
deleteButtons[i].setVisible(true);
|
deleteButtons[i].setVisible(true);
|
||||||
deleteButtons[i].addMouseListener(new Hover());
|
deleteButtons[i].setBorder(null);
|
||||||
deleteButtons[i].setBorder(new RoundedBorder(25));
|
|
||||||
deleteButtons[i].addActionListener(new ActionListener() {
|
deleteButtons[i].addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@@ -223,6 +229,7 @@ public class DatabaseWindow extends GUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setVisibility(boolean value) {
|
public void setVisibility(boolean value) {
|
||||||
|
update();
|
||||||
databaseWindow.setVisible(value);
|
databaseWindow.setVisible(value);
|
||||||
databaseWindow.requestFocus();
|
databaseWindow.requestFocus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import java.util.List;
|
|||||||
public abstract class GUI {
|
public abstract class GUI {
|
||||||
|
|
||||||
protected final String title = "Conway's game if Live";
|
protected final String title = "Conway's game if Live";
|
||||||
|
protected final String iconPath = "src/assets/icons/Icon.png";
|
||||||
|
protected final String picturePath = "src/assets/pictures/Preview.png";
|
||||||
|
protected final String deleteIconPath = "src/assets/icons/delete.png";
|
||||||
protected final int offset = 20;
|
protected final int offset = 20;
|
||||||
protected Control control;
|
protected Control control;
|
||||||
protected Font head;
|
protected Font head;
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import javax.swing.*;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In this class the game is shown.
|
||||||
|
* @author Noah Kessinger
|
||||||
|
*/
|
||||||
public class GameWindow extends GUI {
|
public class GameWindow extends GUI {
|
||||||
|
|
||||||
private final JFrame gameWindow;
|
private final JFrame gameWindow;
|
||||||
@@ -34,7 +38,7 @@ public class GameWindow extends GUI {
|
|||||||
gameWindow.getContentPane().setPreferredSize(new Dimension(width + (2 * offset), height + (2 * offset)));
|
gameWindow.getContentPane().setPreferredSize(new Dimension(width + (2 * offset), height + (2 * offset)));
|
||||||
gameWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
gameWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
|
|
||||||
ImageIcon imageIcon = new ImageIcon("src/assets/icons/Icon.png");
|
ImageIcon imageIcon = new ImageIcon(iconPath);
|
||||||
gameWindow.setIconImage(imageIcon.getImage());
|
gameWindow.setIconImage(imageIcon.getImage());
|
||||||
|
|
||||||
gameWindow.addWindowListener(new WindowAdapter() {
|
gameWindow.addWindowListener(new WindowAdapter() {
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ import javax.swing.event.DocumentListener;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This Class is the Menu window in wich you can set up the basic Game Variables.
|
||||||
|
* @author Noah Kessinger
|
||||||
|
*/
|
||||||
public class MenuWindow extends GUI {
|
public class MenuWindow extends GUI {
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ public class MenuWindow extends GUI {
|
|||||||
|
|
||||||
menuWindow.setTitle(this.title);
|
menuWindow.setTitle(this.title);
|
||||||
|
|
||||||
ImageIcon imageIcon = new ImageIcon("src/assets/icons/Icon.png");
|
ImageIcon imageIcon = new ImageIcon(iconPath);
|
||||||
menuWindow.setIconImage(imageIcon.getImage());
|
menuWindow.setIconImage(imageIcon.getImage());
|
||||||
|
|
||||||
|
|
||||||
@@ -68,7 +72,7 @@ public class MenuWindow extends GUI {
|
|||||||
menuWindow.setLayout(null);
|
menuWindow.setLayout(null);
|
||||||
menuWindow.setSize(752, 424);
|
menuWindow.setSize(752, 424);
|
||||||
|
|
||||||
menuWindow.setResizable(true);
|
menuWindow.setResizable(false);
|
||||||
|
|
||||||
|
|
||||||
menuWindow.addKeyListener(new KeyListener() {
|
menuWindow.addKeyListener(new KeyListener() {
|
||||||
@@ -396,7 +400,7 @@ public class MenuWindow extends GUI {
|
|||||||
|
|
||||||
|
|
||||||
private void initIMG(){
|
private void initIMG(){
|
||||||
preview = new ImageIcon("src/assets/pictures/Preview.png");
|
preview = new ImageIcon(picturePath);
|
||||||
previewLabel = new JLabel(preview);
|
previewLabel = new JLabel(preview);
|
||||||
previewLabel.setBounds(450, 45, 203, 302);
|
previewLabel.setBounds(450, 45, 203, 302);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user