diff --git a/src/main/java/featurecat/lizzie/gui/BoardPane.java b/src/main/java/featurecat/lizzie/gui/BoardPane.java index 28e519aea..ad2d9d490 100644 --- a/src/main/java/featurecat/lizzie/gui/BoardPane.java +++ b/src/main/java/featurecat/lizzie/gui/BoardPane.java @@ -83,7 +83,7 @@ public class BoardPane extends LizziePane { public static Font winrateFont; // private final BufferStrategy bs; - private boolean started = false; + private static boolean started = false; private static final int[] outOfBoundCoordinate = new int[] {-1, -1}; public int[] mouseOverCoordinate = outOfBoundCoordinate; @@ -539,8 +539,8 @@ public void onClicked(int x, int y) { if (Lizzie.board.inAnalysisMode()) Lizzie.board.toggleAnalysis(); if (!isPlayingAgainstLeelaz || (playerIsBlack == Lizzie.board.getData().blackToPlay)) Lizzie.board.place(coords[0], coords[1]); - repaint(); - owner.updateStatus(); + // repaint(); + // owner.updateStatus(); } } diff --git a/src/main/java/featurecat/lizzie/gui/CommentPane.java b/src/main/java/featurecat/lizzie/gui/CommentPane.java index 2ae0c37e5..10ea1ba3b 100644 --- a/src/main/java/featurecat/lizzie/gui/CommentPane.java +++ b/src/main/java/featurecat/lizzie/gui/CommentPane.java @@ -128,17 +128,18 @@ public void setDesignMode(boolean mode) { if (mode) { remove(scrollPane); add(dragPane); - this.commentPane.setVisible(false); - this.scrollPane.setVisible(false); + commentPane.setVisible(false); + scrollPane.setVisible(false); dragPane.setVisible(true); } else { remove(dragPane); add(scrollPane); - this.commentPane.setVisible(true); - this.scrollPane.setVisible(true); + commentPane.setVisible(true); + scrollPane.setVisible(true); dragPane.setVisible(false); } super.setDesignMode(mode); + revalidate(); repaint(); } diff --git a/src/main/java/featurecat/lizzie/gui/LizzieMain.java b/src/main/java/featurecat/lizzie/gui/LizzieMain.java index 8727a9c93..4367cc1df 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieMain.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieMain.java @@ -13,6 +13,7 @@ import java.awt.Font; import java.awt.FontFormatException; import java.awt.Frame; +import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.RenderingHints; @@ -263,44 +264,45 @@ public void run() { * @param g0 not used */ // TODO Need Better Background - // public void paint(Graphics g0) { - //// super.paintComponents(g0); - // - // int width = getWidth(); - // int height = getHeight(); - // - // originX = getX(); - // originY = getY(); - // originW = width; - // originH = height; - // - // Optional backgroundG; - // if (cachedBackgroundWidth != width - // || cachedBackgroundHeight != height - // || redrawBackgroundAnyway) { - // backgroundG = Optional.of(createBackground()); - // } else { - // backgroundG = Optional.empty(); - // } - // - //// cachedImage = new BufferedImage(width, height, TYPE_INT_ARGB); - //// Graphics2D g = (Graphics2D) cachedImage.getGraphics(); - //// g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); - // - // // cleanup - //// g.dispose(); - // - // // draw the image - // Graphics2D bsGraphics = (Graphics2D) bs.getDrawGraphics(); - // bsGraphics.setRenderingHint(RenderingHints.KEY_RENDERING, - // RenderingHints.VALUE_RENDER_QUALITY); - // bsGraphics.drawImage(cachedBackground, 0, 0, null); - //// bsGraphics.drawImage(cachedImage, 0, 0, null); - // - // // cleanup - // bsGraphics.dispose(); - // bs.show(); - // } + public void paint(Graphics g0) { + super.paintComponents(g0); + + // int width = getWidth(); + // int height = getHeight(); + // + // originX = getX(); + // originY = getY(); + // originW = width; + // originH = height; + // + // Optional backgroundG; + // if (cachedBackgroundWidth != width + // || cachedBackgroundHeight != height + // || redrawBackgroundAnyway) { + // backgroundG = Optional.of(createBackground()); + // } else { + // backgroundG = Optional.empty(); + // } + // + // // cachedImage = new BufferedImage(width, height, TYPE_INT_ARGB); + // // Graphics2D g = (Graphics2D) cachedImage.getGraphics(); + // // g.setRenderingHint(RenderingHints.KEY_RENDERING, + // RenderingHints.VALUE_RENDER_QUALITY); + // + // // cleanup + // // g.dispose(); + // + // // draw the image + // Graphics2D bsGraphics = (Graphics2D) bs.getDrawGraphics(); + // bsGraphics.setRenderingHint(RenderingHints.KEY_RENDERING, + // RenderingHints.VALUE_RENDER_QUALITY); + // bsGraphics.drawImage(cachedBackground, 0, 0, null); + // // bsGraphics.drawImage(cachedImage, 0, 0, null); + // + // // cleanup + // bsGraphics.dispose(); + // bs.show(); + } /** * temporary measure to refresh background. ideally we shouldn't need this (but we want to release @@ -381,9 +383,14 @@ public void repaintSub() { } public void updateStatus() { + basicInfoPane.revalidate(); basicInfoPane.repaint(); + variationTreePane.revalidate(); variationTreePane.repaint(); commentPane.drawComment(); + commentPane.revalidate(); + commentPane.repaint(); + invalidLayout(); } public static void openConfigDialog() {