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$Worker.run(ThreadPoolExecutor.java:628)
|
||||
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];
|
||||
|
||||
|
||||
ResultSet resultData = resultSetSQL("select * from gameData where id ="+id);
|
||||
|
||||
|
||||
|
||||
while (resultData.next()){
|
||||
cells[resultData.getInt("x")][resultData.getInt("y")] = true;
|
||||
}
|
||||
@@ -154,7 +151,6 @@ public class DataBase {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
disconnect();
|
||||
|
||||
return null;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Control {
|
||||
clock.setFirstGen(true);
|
||||
|
||||
gen = 0;
|
||||
mouseLocked = false;
|
||||
mouseLocked = true;
|
||||
|
||||
cells = new boolean[this.xSize][this.ySize];
|
||||
newcells = new boolean[this.xSize][this.ySize];
|
||||
@@ -79,6 +79,7 @@ public class Control {
|
||||
if (startMode == "Manuel") {
|
||||
setRunning(false);
|
||||
gui.buildControlWindow();
|
||||
this.mouseLocked = false;
|
||||
}
|
||||
|
||||
startGame();
|
||||
@@ -431,11 +432,11 @@ public class Control {
|
||||
}
|
||||
|
||||
public void jump2Gen(int wantedtGen){
|
||||
if (wantedtGen < gen){
|
||||
if (wantedtGen <= gen){
|
||||
resetCells();
|
||||
syncCells();
|
||||
|
||||
int counter = ((gen - wantedtGen) / wantedtGen ) + 1;
|
||||
int counter = ((gen - wantedtGen) / (wantedtGen + 1) );
|
||||
|
||||
for (int i = 0; i < wantedtGen; i++) {
|
||||
nextGenLight();
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package game;
|
||||
|
||||
public enum StartMode {
|
||||
|
||||
Manuel, Randomized, Task1, Blinker, Toad
|
||||
|
||||
}
|
||||
+30
-14
@@ -184,6 +184,10 @@ public class ControlWindow {
|
||||
if (gui.getGeneration() == 0){
|
||||
gui.saveFirstGrid();
|
||||
}
|
||||
if (!gui.isRunning()){
|
||||
gui.setMouseLocked(true);
|
||||
updateLockedMouse();
|
||||
}
|
||||
gui.setRunning(!gui.isRunning());
|
||||
updateToggleButton();
|
||||
gui.setVelocity(velocity);
|
||||
@@ -208,11 +212,13 @@ public class ControlWindow {
|
||||
nextGenButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (gui.getGeneration() == 0){
|
||||
gui.saveFirstGrid();
|
||||
if (!gui.isRunning()) {
|
||||
if (gui.getGeneration() == 0) {
|
||||
gui.saveFirstGrid();
|
||||
}
|
||||
gui.nextGen();
|
||||
gui.showGrid(gui.getCells());
|
||||
}
|
||||
gui.nextGen();
|
||||
gui.showGrid(gui.getCells());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -232,8 +238,10 @@ public class ControlWindow {
|
||||
previousGenButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gui.previousGen();
|
||||
gui.showGrid(gui.getCells());
|
||||
if (!gui.isRunning()) {
|
||||
gui.previousGen();
|
||||
gui.showGrid(gui.getCells());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -252,8 +260,10 @@ public class ControlWindow {
|
||||
lockMouse.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gui.setMouseLocked(!gui.isMouseLocked());
|
||||
updateLockedMouse();
|
||||
if (!gui.isRunning()) {
|
||||
gui.setMouseLocked(!gui.isMouseLocked());
|
||||
updateLockedMouse();
|
||||
}
|
||||
}
|
||||
});
|
||||
updateLockedMouse();
|
||||
@@ -274,8 +284,10 @@ public class ControlWindow {
|
||||
clearButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gui.clearGrid();
|
||||
gui.showGrid(gui.getCells());
|
||||
if (!gui.isRunning()) {
|
||||
gui.clearGrid();
|
||||
gui.showGrid(gui.getCells());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -296,8 +308,10 @@ public class ControlWindow {
|
||||
multipleGenSkipButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gui.multipleGenSkip(Integer.parseInt(multipleGenSkipLable.getText()));
|
||||
gui.showGrid(gui.getCells());
|
||||
if (!gui.isRunning()) {
|
||||
gui.multipleGenSkip(Integer.parseInt(multipleGenSkipLable.getText()));
|
||||
gui.showGrid(gui.getCells());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -334,8 +348,10 @@ public class ControlWindow {
|
||||
jump2GenButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
gui.jump2Gen(Integer.parseInt(jump2GenLable.getText()));
|
||||
gui.showGrid(gui.getCells());
|
||||
if (!gui.isRunning()) {
|
||||
gui.jump2Gen(Integer.parseInt(jump2GenLable.getText()));
|
||||
gui.showGrid(gui.getCells());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package gui;
|
||||
|
||||
import game.Control;
|
||||
import game.StartMode;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.List;
|
||||
|
||||
public class GUI {
|
||||
|
||||
+8
-29
@@ -20,8 +20,8 @@ public class MenuWindow {
|
||||
|
||||
private JLabel heading;
|
||||
|
||||
private final int xAxisMin = 6, xAxisMax = 1024;
|
||||
private final int yAxisMin = 6, yAxisMax = 1024;
|
||||
private final int xAxisMin = 6, xAxisMax = 2048;
|
||||
private final int yAxisMin = 6, yAxisMax = 2048;
|
||||
|
||||
private int xAxisSize = 6;
|
||||
private JSlider xAxis;
|
||||
@@ -42,7 +42,7 @@ public class MenuWindow {
|
||||
private MouseListener hover;
|
||||
|
||||
private JButton startButton;
|
||||
private JButton manuelStart;
|
||||
|
||||
|
||||
private ImageIcon preview;
|
||||
private JLabel previewLabel;
|
||||
@@ -91,7 +91,6 @@ public class MenuWindow {
|
||||
initStartCells();
|
||||
initModeBox();
|
||||
initStartButton();
|
||||
initManuelStart();
|
||||
initIMG();
|
||||
|
||||
}
|
||||
@@ -123,7 +122,7 @@ public class MenuWindow {
|
||||
xAxis.setVisible(true);
|
||||
|
||||
|
||||
xAxisName = new JLabel("Breite in Zellen:");
|
||||
xAxisName = new JLabel("Width in Cells:");
|
||||
xAxisName.setBounds(50, 100, 200, 30);
|
||||
xAxisName.setFont(text);
|
||||
xAxisName.setForeground(Color.decode("#121212"));
|
||||
@@ -186,7 +185,7 @@ public class MenuWindow {
|
||||
});
|
||||
yAxis.setVisible(true);
|
||||
|
||||
yAxisName = new JLabel("Höhe in Zellen:");
|
||||
yAxisName = new JLabel("Height in Cells:");
|
||||
yAxisName.setBounds(50, 150, 200, 30);
|
||||
yAxisName.setFont(text);
|
||||
yAxisName.setForeground(Color.decode("#121212"));
|
||||
@@ -249,7 +248,7 @@ public class MenuWindow {
|
||||
});
|
||||
startCells.setVisible(true);
|
||||
|
||||
startCellsName = new JLabel("Start Zellen:");
|
||||
startCellsName = new JLabel("Start/Max Cells:");
|
||||
startCellsName.setBounds(50, 200, 200, 30);
|
||||
startCellsName.setFont(text);
|
||||
startCellsName.setForeground(Color.decode("#121212"));
|
||||
@@ -300,6 +299,7 @@ public class MenuWindow {
|
||||
modeBox = new JComboBox<String>();
|
||||
modeBox.setBounds(180, 257, 200, 20);
|
||||
addComboBoxEntry(modeBox, "Randomized");
|
||||
addComboBoxEntry(modeBox, "Manuel");
|
||||
addComboBoxEntry(modeBox, "Task1");
|
||||
addComboBoxEntry(modeBox, "Blinker");
|
||||
addComboBoxEntry(modeBox, "Toad");
|
||||
@@ -323,7 +323,7 @@ public class MenuWindow {
|
||||
startButton.setBorderPainted(true);
|
||||
startButton.setFocusPainted(false);
|
||||
startButton.setContentAreaFilled(false);
|
||||
startButton.setBounds(50, 310, 150, 50);
|
||||
startButton.setBounds(50, 310, 330, 50);
|
||||
startButton.setVisible(true);
|
||||
startButton.addMouseListener(hover);
|
||||
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(){
|
||||
preview = new ImageIcon("src/data/pictures/Preview.png");
|
||||
@@ -389,7 +369,6 @@ public class MenuWindow {
|
||||
menuWindow.add(startCellsName);
|
||||
menuWindow.add(startCellsLabel);
|
||||
menuWindow.add(startButton);
|
||||
menuWindow.add(manuelStart);
|
||||
menuWindow.add(previewLabel);
|
||||
menuWindow.add(modeName);
|
||||
menuWindow.add(modeBox);
|
||||
|
||||
+20
-20
@@ -15,31 +15,31 @@ public class Main {
|
||||
|
||||
Control control = new Control();
|
||||
control.start();
|
||||
// DataBase dataBase = new DataBase();
|
||||
// DataBase dataBase = new DataBase();
|
||||
// dataBase.deleteTables();
|
||||
// dataBase.createTables();
|
||||
|
||||
|
||||
// boolean[][] cells = new boolean[44][66];
|
||||
|
||||
//for (int x = 0; x < 6; x++) {
|
||||
// for (int y = 0; y < 6; y++) {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// for (int x = 0; x < 6; x++) {
|
||||
// for (int y = 0; y < 6; y++) {
|
||||
//
|
||||
//
|
||||
// boolean[][] cells = new boolean[44][66];
|
||||
//
|
||||
// for (int x = 0; x < 6; x++) {
|
||||
// for (int y = 0; y < 6; y++) {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// for (int x = 0; x < 6; x++) {
|
||||
// for (int y = 0; y < 6; y++) {
|
||||
// cells[x][y] = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// dataBase.saveGrid(cells, "Noah", 1012);
|
||||
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// dataBase.saveGrid(cells, "Noah", 1012);
|
||||
//
|
||||
// System.out.println(dataBase.getAllGrids());
|
||||
|
||||
//
|
||||
// boolean[][] x = dataBase.getGrid("penis");
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user