Some Error Catching or Preventing
This commit is contained in:
Binary file not shown.
@@ -1444,3 +1444,45 @@ java.sql.SQLClientInfoException: Client info name 'ApplicationName' not supporte
|
|||||||
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
|
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
|
||||||
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
|
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
|
||||||
at java.base/java.lang.Thread.run(Thread.java:829)
|
at java.base/java.lang.Thread.run(Thread.java:829)
|
||||||
|
2021-12-01 18:57:56 jdbc[3]: exception
|
||||||
|
java.sql.SQLClientInfoException: Client info name 'ApplicationName' not supported.
|
||||||
|
at org.h2.jdbc.JdbcConnection.setClientInfo(JdbcConnection.java:1749)
|
||||||
|
at com.intellij.database.remote.jdbc.impl.RemoteConnectionImpl.setClientInfo(RemoteConnectionImpl.java:470)
|
||||||
|
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||||
|
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
||||||
|
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||||
|
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
|
||||||
|
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
|
||||||
|
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
|
||||||
|
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
|
||||||
|
at java.base/java.security.AccessController.doPrivileged(Native Method)
|
||||||
|
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
|
||||||
|
at java.base/java.security.AccessController.doPrivileged(Native Method)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
|
||||||
|
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
|
||||||
|
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
|
||||||
|
at java.base/java.lang.Thread.run(Thread.java:829)
|
||||||
|
2021-12-01 18:58:04 jdbc[4]: exception
|
||||||
|
java.sql.SQLClientInfoException: Client info name 'ApplicationName' not supported.
|
||||||
|
at org.h2.jdbc.JdbcConnection.setClientInfo(JdbcConnection.java:1749)
|
||||||
|
at com.intellij.database.remote.jdbc.impl.RemoteConnectionImpl.setClientInfo(RemoteConnectionImpl.java:470)
|
||||||
|
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||||
|
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
||||||
|
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||||
|
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
|
||||||
|
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
|
||||||
|
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
|
||||||
|
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
|
||||||
|
at java.base/java.security.AccessController.doPrivileged(Native Method)
|
||||||
|
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
|
||||||
|
at java.base/java.security.AccessController.doPrivileged(Native Method)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
|
||||||
|
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
|
||||||
|
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
|
||||||
|
at java.base/java.lang.Thread.run(Thread.java:829)
|
||||||
|
|||||||
@@ -139,11 +139,8 @@ public class DataBase {
|
|||||||
|
|
||||||
boolean[][] cells = new boolean[width][height];
|
boolean[][] cells = new boolean[width][height];
|
||||||
|
|
||||||
|
|
||||||
ResultSet resultData = resultSetSQL("select * from gameData where id ="+id);
|
ResultSet resultData = resultSetSQL("select * from gameData where id ="+id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (resultData.next()){
|
while (resultData.next()){
|
||||||
cells[resultData.getInt("x")][resultData.getInt("y")] = true;
|
cells[resultData.getInt("x")][resultData.getInt("y")] = true;
|
||||||
}
|
}
|
||||||
@@ -154,7 +151,6 @@ public class DataBase {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
disconnect();
|
disconnect();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class Control {
|
|||||||
clock.setFirstGen(true);
|
clock.setFirstGen(true);
|
||||||
|
|
||||||
gen = 0;
|
gen = 0;
|
||||||
mouseLocked = false;
|
mouseLocked = true;
|
||||||
|
|
||||||
cells = new boolean[this.xSize][this.ySize];
|
cells = new boolean[this.xSize][this.ySize];
|
||||||
newcells = new boolean[this.xSize][this.ySize];
|
newcells = new boolean[this.xSize][this.ySize];
|
||||||
@@ -79,6 +79,7 @@ public class Control {
|
|||||||
if (startMode == "Manuel") {
|
if (startMode == "Manuel") {
|
||||||
setRunning(false);
|
setRunning(false);
|
||||||
gui.buildControlWindow();
|
gui.buildControlWindow();
|
||||||
|
this.mouseLocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
startGame();
|
startGame();
|
||||||
@@ -431,11 +432,11 @@ public class Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void jump2Gen(int wantedtGen){
|
public void jump2Gen(int wantedtGen){
|
||||||
if (wantedtGen < gen){
|
if (wantedtGen <= gen){
|
||||||
resetCells();
|
resetCells();
|
||||||
syncCells();
|
syncCells();
|
||||||
|
|
||||||
int counter = ((gen - wantedtGen) / wantedtGen ) + 1;
|
int counter = ((gen - wantedtGen) / (wantedtGen + 1) );
|
||||||
|
|
||||||
for (int i = 0; i < wantedtGen; i++) {
|
for (int i = 0; i < wantedtGen; i++) {
|
||||||
nextGenLight();
|
nextGenLight();
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
package game;
|
|
||||||
|
|
||||||
public enum StartMode {
|
|
||||||
|
|
||||||
Manuel, Randomized, Task1, Blinker, Toad
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -184,6 +184,10 @@ public class ControlWindow {
|
|||||||
if (gui.getGeneration() == 0){
|
if (gui.getGeneration() == 0){
|
||||||
gui.saveFirstGrid();
|
gui.saveFirstGrid();
|
||||||
}
|
}
|
||||||
|
if (!gui.isRunning()){
|
||||||
|
gui.setMouseLocked(true);
|
||||||
|
updateLockedMouse();
|
||||||
|
}
|
||||||
gui.setRunning(!gui.isRunning());
|
gui.setRunning(!gui.isRunning());
|
||||||
updateToggleButton();
|
updateToggleButton();
|
||||||
gui.setVelocity(velocity);
|
gui.setVelocity(velocity);
|
||||||
@@ -208,12 +212,14 @@ public class ControlWindow {
|
|||||||
nextGenButton.addActionListener(new ActionListener() {
|
nextGenButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (!gui.isRunning()) {
|
||||||
if (gui.getGeneration() == 0) {
|
if (gui.getGeneration() == 0) {
|
||||||
gui.saveFirstGrid();
|
gui.saveFirstGrid();
|
||||||
}
|
}
|
||||||
gui.nextGen();
|
gui.nextGen();
|
||||||
gui.showGrid(gui.getCells());
|
gui.showGrid(gui.getCells());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,9 +238,11 @@ public class ControlWindow {
|
|||||||
previousGenButton.addActionListener(new ActionListener() {
|
previousGenButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (!gui.isRunning()) {
|
||||||
gui.previousGen();
|
gui.previousGen();
|
||||||
gui.showGrid(gui.getCells());
|
gui.showGrid(gui.getCells());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,9 +260,11 @@ public class ControlWindow {
|
|||||||
lockMouse.addActionListener(new ActionListener() {
|
lockMouse.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (!gui.isRunning()) {
|
||||||
gui.setMouseLocked(!gui.isMouseLocked());
|
gui.setMouseLocked(!gui.isMouseLocked());
|
||||||
updateLockedMouse();
|
updateLockedMouse();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
updateLockedMouse();
|
updateLockedMouse();
|
||||||
}
|
}
|
||||||
@@ -274,9 +284,11 @@ public class ControlWindow {
|
|||||||
clearButton.addActionListener(new ActionListener() {
|
clearButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (!gui.isRunning()) {
|
||||||
gui.clearGrid();
|
gui.clearGrid();
|
||||||
gui.showGrid(gui.getCells());
|
gui.showGrid(gui.getCells());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,9 +308,11 @@ public class ControlWindow {
|
|||||||
multipleGenSkipButton.addActionListener(new ActionListener() {
|
multipleGenSkipButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (!gui.isRunning()) {
|
||||||
gui.multipleGenSkip(Integer.parseInt(multipleGenSkipLable.getText()));
|
gui.multipleGenSkip(Integer.parseInt(multipleGenSkipLable.getText()));
|
||||||
gui.showGrid(gui.getCells());
|
gui.showGrid(gui.getCells());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
multipleGenSkipLable = new JTextField("6");
|
multipleGenSkipLable = new JTextField("6");
|
||||||
@@ -334,9 +348,11 @@ public class ControlWindow {
|
|||||||
jump2GenButton.addActionListener(new ActionListener() {
|
jump2GenButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (!gui.isRunning()) {
|
||||||
gui.jump2Gen(Integer.parseInt(jump2GenLable.getText()));
|
gui.jump2Gen(Integer.parseInt(jump2GenLable.getText()));
|
||||||
gui.showGrid(gui.getCells());
|
gui.showGrid(gui.getCells());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
jump2GenLable = new JTextField("6");
|
jump2GenLable = new JTextField("6");
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package gui;
|
package gui;
|
||||||
|
|
||||||
import game.Control;
|
import game.Control;
|
||||||
import game.StartMode;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GUI {
|
public class GUI {
|
||||||
|
|||||||
+8
-29
@@ -20,8 +20,8 @@ public class MenuWindow {
|
|||||||
|
|
||||||
private JLabel heading;
|
private JLabel heading;
|
||||||
|
|
||||||
private final int xAxisMin = 6, xAxisMax = 1024;
|
private final int xAxisMin = 6, xAxisMax = 2048;
|
||||||
private final int yAxisMin = 6, yAxisMax = 1024;
|
private final int yAxisMin = 6, yAxisMax = 2048;
|
||||||
|
|
||||||
private int xAxisSize = 6;
|
private int xAxisSize = 6;
|
||||||
private JSlider xAxis;
|
private JSlider xAxis;
|
||||||
@@ -42,7 +42,7 @@ public class MenuWindow {
|
|||||||
private MouseListener hover;
|
private MouseListener hover;
|
||||||
|
|
||||||
private JButton startButton;
|
private JButton startButton;
|
||||||
private JButton manuelStart;
|
|
||||||
|
|
||||||
private ImageIcon preview;
|
private ImageIcon preview;
|
||||||
private JLabel previewLabel;
|
private JLabel previewLabel;
|
||||||
@@ -91,7 +91,6 @@ public class MenuWindow {
|
|||||||
initStartCells();
|
initStartCells();
|
||||||
initModeBox();
|
initModeBox();
|
||||||
initStartButton();
|
initStartButton();
|
||||||
initManuelStart();
|
|
||||||
initIMG();
|
initIMG();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -123,7 +122,7 @@ public class MenuWindow {
|
|||||||
xAxis.setVisible(true);
|
xAxis.setVisible(true);
|
||||||
|
|
||||||
|
|
||||||
xAxisName = new JLabel("Breite in Zellen:");
|
xAxisName = new JLabel("Width in Cells:");
|
||||||
xAxisName.setBounds(50, 100, 200, 30);
|
xAxisName.setBounds(50, 100, 200, 30);
|
||||||
xAxisName.setFont(text);
|
xAxisName.setFont(text);
|
||||||
xAxisName.setForeground(Color.decode("#121212"));
|
xAxisName.setForeground(Color.decode("#121212"));
|
||||||
@@ -186,7 +185,7 @@ public class MenuWindow {
|
|||||||
});
|
});
|
||||||
yAxis.setVisible(true);
|
yAxis.setVisible(true);
|
||||||
|
|
||||||
yAxisName = new JLabel("Höhe in Zellen:");
|
yAxisName = new JLabel("Height in Cells:");
|
||||||
yAxisName.setBounds(50, 150, 200, 30);
|
yAxisName.setBounds(50, 150, 200, 30);
|
||||||
yAxisName.setFont(text);
|
yAxisName.setFont(text);
|
||||||
yAxisName.setForeground(Color.decode("#121212"));
|
yAxisName.setForeground(Color.decode("#121212"));
|
||||||
@@ -249,7 +248,7 @@ public class MenuWindow {
|
|||||||
});
|
});
|
||||||
startCells.setVisible(true);
|
startCells.setVisible(true);
|
||||||
|
|
||||||
startCellsName = new JLabel("Start Zellen:");
|
startCellsName = new JLabel("Start/Max Cells:");
|
||||||
startCellsName.setBounds(50, 200, 200, 30);
|
startCellsName.setBounds(50, 200, 200, 30);
|
||||||
startCellsName.setFont(text);
|
startCellsName.setFont(text);
|
||||||
startCellsName.setForeground(Color.decode("#121212"));
|
startCellsName.setForeground(Color.decode("#121212"));
|
||||||
@@ -300,6 +299,7 @@ public class MenuWindow {
|
|||||||
modeBox = new JComboBox<String>();
|
modeBox = new JComboBox<String>();
|
||||||
modeBox.setBounds(180, 257, 200, 20);
|
modeBox.setBounds(180, 257, 200, 20);
|
||||||
addComboBoxEntry(modeBox, "Randomized");
|
addComboBoxEntry(modeBox, "Randomized");
|
||||||
|
addComboBoxEntry(modeBox, "Manuel");
|
||||||
addComboBoxEntry(modeBox, "Task1");
|
addComboBoxEntry(modeBox, "Task1");
|
||||||
addComboBoxEntry(modeBox, "Blinker");
|
addComboBoxEntry(modeBox, "Blinker");
|
||||||
addComboBoxEntry(modeBox, "Toad");
|
addComboBoxEntry(modeBox, "Toad");
|
||||||
@@ -323,7 +323,7 @@ public class MenuWindow {
|
|||||||
startButton.setBorderPainted(true);
|
startButton.setBorderPainted(true);
|
||||||
startButton.setFocusPainted(false);
|
startButton.setFocusPainted(false);
|
||||||
startButton.setContentAreaFilled(false);
|
startButton.setContentAreaFilled(false);
|
||||||
startButton.setBounds(50, 310, 150, 50);
|
startButton.setBounds(50, 310, 330, 50);
|
||||||
startButton.setVisible(true);
|
startButton.setVisible(true);
|
||||||
startButton.addMouseListener(hover);
|
startButton.addMouseListener(hover);
|
||||||
startButton.setBorder(new RoundedBorder(25));
|
startButton.setBorder(new RoundedBorder(25));
|
||||||
@@ -338,26 +338,6 @@ public class MenuWindow {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initManuelStart(){
|
|
||||||
manuelStart = new JButton();
|
|
||||||
manuelStart.setText("Manuel Start");
|
|
||||||
manuelStart.setFont(text);
|
|
||||||
manuelStart.setForeground(Color.decode("#121212"));
|
|
||||||
manuelStart.setBorderPainted(true);
|
|
||||||
manuelStart.setFocusPainted(false);
|
|
||||||
manuelStart.setContentAreaFilled(false);
|
|
||||||
manuelStart.setBounds(225, 310, 150, 50);
|
|
||||||
manuelStart.setVisible(true);
|
|
||||||
manuelStart.addMouseListener(hover);
|
|
||||||
manuelStart.setBorder(new RoundedBorder(25));
|
|
||||||
manuelStart.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
gui.buildGameWindow(xAxisSize, yAxisSize, cellCount, "Manuel");
|
|
||||||
menuWindow.setVisible(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initIMG(){
|
private void initIMG(){
|
||||||
preview = new ImageIcon("src/data/pictures/Preview.png");
|
preview = new ImageIcon("src/data/pictures/Preview.png");
|
||||||
@@ -389,7 +369,6 @@ public class MenuWindow {
|
|||||||
menuWindow.add(startCellsName);
|
menuWindow.add(startCellsName);
|
||||||
menuWindow.add(startCellsLabel);
|
menuWindow.add(startCellsLabel);
|
||||||
menuWindow.add(startButton);
|
menuWindow.add(startButton);
|
||||||
menuWindow.add(manuelStart);
|
|
||||||
menuWindow.add(previewLabel);
|
menuWindow.add(previewLabel);
|
||||||
menuWindow.add(modeName);
|
menuWindow.add(modeName);
|
||||||
menuWindow.add(modeBox);
|
menuWindow.add(modeBox);
|
||||||
|
|||||||
+9
-9
@@ -18,28 +18,28 @@ public class Main {
|
|||||||
// DataBase dataBase = new DataBase();
|
// DataBase dataBase = new DataBase();
|
||||||
// dataBase.deleteTables();
|
// dataBase.deleteTables();
|
||||||
// dataBase.createTables();
|
// dataBase.createTables();
|
||||||
|
//
|
||||||
|
//
|
||||||
// boolean[][] cells = new boolean[44][66];
|
// boolean[][] cells = new boolean[44][66];
|
||||||
|
//
|
||||||
// for (int x = 0; x < 6; x++) {
|
// for (int x = 0; x < 6; x++) {
|
||||||
// for (int y = 0; y < 6; y++) {
|
// for (int y = 0; y < 6; y++) {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
// for (int x = 0; x < 6; x++) {
|
// for (int x = 0; x < 6; x++) {
|
||||||
// for (int y = 0; y < 6; y++) {
|
// for (int y = 0; y < 6; y++) {
|
||||||
// cells[x][y] = true;
|
// cells[x][y] = true;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
//
|
||||||
// dataBase.saveGrid(cells, "Noah", 1012);
|
// dataBase.saveGrid(cells, "Noah", 1012);
|
||||||
|
//
|
||||||
// System.out.println(dataBase.getAllGrids());
|
// System.out.println(dataBase.getAllGrids());
|
||||||
|
//
|
||||||
// boolean[][] x = dataBase.getGrid("penis");
|
// boolean[][] x = dataBase.getGrid("penis");
|
||||||
|
//
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user