After I created a window, which should be completely black, there are white colors at the right and bottom edges. What is it that I may be doing wrong ?
this is the constructor where I do initialisation of window :-
public Panel()
{
Thread t = new Thread(this);
addKeyListener(this);
setFocusable(true);
this.setPreferredSize(new Dimension(gameWidth, gameHeight));
JFrame f = new JFrame("AlienBusters");
f.add(this);
f.pack();
f.setLocationRelativeTo(null);
f.setResizable(false);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
t.start();
}
this is the paint method where I made the window black :-
@Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
g.setColor(Color.BLACK);
g.fillRect(0, 0, gameWidth, gameHeight);
}