Note that there are some explanatory texts on larger screens.

plurals
  1. POJPanel rendered behind the paint() method
    text
    copied!<p>I am trying to create a board game. The left side of my windows is my actual board game while on the right side I was going to have a few buttons and timers. I paint my board using the paint method but when I try to create a new JPanel thats rendered in the background. I know because I can see some black around the edges of the game. </p> <p>This is my main code that creates my JFrame and calls my board class. </p> <pre><code> frame.setSize(864, 480); frame.add(new Board()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setCursor(frame.getToolkit().createCustomCursor(new BufferedImage(3, 3, BufferedImage.TYPE_INT_ARGB), new Point(0, 0), "null")); JPanel panel = new JPanel(); frame.add(panel); panel.setBackground(Color.BLACK); </code></pre> <p>This is my code that paints the go board image. This is in my Board class </p> <pre><code>super.paint(g); s.location = MouseInfo.getPointerInfo(); s.mouse = s.location.getLocation(); s.updateBlackX(s.mouse); s.updateBlackY(s.mouse); s.updateWhiteX(s.mouse); s.updateWhiteY(s.mouse); Graphics2D g2d = (Graphics2D) g; g2d.drawImage(board, 0, 0, null); paintArray(g2d); if (turn == 1) g2d.drawImage(s.getBlackStone(), s.getBlackX() - f.getX() - 15, s.getBlackY() - f.getY() - 35, null); else g2d.drawImage(s.getWhiteStone(), s.getWhiteX() - f.getX() - 15, s.getWhiteY() - f.getY() - 35, null); </code></pre> <p>This is my game during run-time with further explanation as to my problem. <a href="http://imgur.com/cAIS9aR" rel="nofollow">http://imgur.com/cAIS9aR</a></p> <p>Thank you in advance for any and all help! </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload