This commit is contained in:
Noah
2021-12-02 19:13:06 +01:00
parent e1c6b1cffc
commit cb8e4246db
9 changed files with 264 additions and 226 deletions
+13 -33
View File
@@ -2,21 +2,17 @@ package gui;
import game.Control;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
public class GUI {
private final String title = "Conway's game if Live";
private final String title = "Conway's game if Live";
private final Control control;
private Font head;
private Font text;
private MouseAdapter hover;
private boolean sliderLocked = false;
private final int offset = 20;
@@ -36,27 +32,6 @@ public class GUI {
head = new Font("Segoe UI Light", Font.PLAIN, 24);
text = new Font("Segoe UI Light", Font.PLAIN, 16);
hover = new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
super.mouseEntered(e);
JButton b = (JButton) e.getSource();
b.setForeground(Color.decode("#C40233"));
b.setBounds(b.getX() - 10, b.getY() - 10, b.getWidth() + 20, b.getHeight() + 20);
}
@Override
public void mouseExited(MouseEvent e) {
super.mouseExited(e);
JButton b = (JButton) e.getSource();
b.setForeground(Color.decode("#121212"));
b.setBounds(b.getX() + 10, b.getY() + 10, b.getWidth() - 20, b.getHeight() - 20);
}
};
}
public void createMenuWindow(){
@@ -119,10 +94,6 @@ public class GUI {
this.sliderLocked = sliderLocked;
}
public MouseAdapter getHover() {
return hover;
}
public void nextGen(){
control.nextGen();
}
@@ -167,6 +138,18 @@ public class GUI {
control.jump2Gen(wantedtGen);
}
public void saveGridInDB(String gridName){
control.saveGridInDB(gridName);
}
public List<String> getAllGrids(){
return control.getAllGrids();
}
public boolean checkName(String name){
return control.checkName(name);
}
//TODO: Delet this Methods. Those are shit.
public void setVisibility(boolean value){
controlWindow.setVisibility(value);
@@ -176,9 +159,6 @@ public class GUI {
return controlWindow;
}
public List<String> getAllGrids(){
return control.getAllGrids();
}
}