Revert "Fix NullPointerException" #14

Closed
iryupnik wants to merge 1 commits from revert-9ee498cb into master

View File

@ -12,7 +12,6 @@ public class WindowOfFreeMove extends JFrame {
private static boolean canPersonMove;
private static boolean preventDoubleMove;
private static boolean isReadyToPaint;
static final int KEY_LEFT = 37;
static final int KEY_UP = 38;
@ -50,7 +49,6 @@ public class WindowOfFreeMove extends JFrame {
}
public WindowOfFreeMove() {
isReadyToPaint = false;
canPersonMove = true;
preventDoubleMove = true;
lp = getLayeredPane();
@ -133,7 +131,6 @@ public class WindowOfFreeMove extends JFrame {
setMap(m1);
map.createMap();
isReadyToPaint = true;
//
// lp.remove(dialogBar);
//
@ -159,7 +156,7 @@ public class WindowOfFreeMove extends JFrame {
//setCanPersonMove(false);
// lp.add(jf, JLayeredPane.POPUP_LAYER);
timer = new Timer( 16, new ActionListener() {
timer = new Timer(5, new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
if (!map.getPerson().getIsMoving()) {
@ -174,18 +171,16 @@ public class WindowOfFreeMove extends JFrame {
static class Canvas extends JPanel {
@Override
public void paint(Graphics g) {
if (isReadyToPaint) {
super.paint(g);
Graphics2D g2D = (Graphics2D) g;
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
for (Cell cell : map.getMoveToCells()) {
cell.paint(g2D);
}
map.getPerson().paint(g2D);
for (Cell cell : map.getBlocks()) {
cell.paint(g2D);
}
map.getPerson().paint(g2D);
for (Cell cell : map.getMoveToCells()) {
cell.paint(g2D);
}
}
}