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.
This is my main code that creates my JFrame and calls my board class.
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);
This is my code that paints the go board image. This is in my Board class
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);
This is my game during run-time with further explanation as to my problem. https://i.stack.imgur.com/GNuy7.jpg
Thank you in advance for any and all help!