I have trouble with my IT class project in NetBeans and jFrame. When I set the background image, there is a weird rectangle, after changing it via menu bar and menu item. There is no jPanel or other components that could cover it. This is how I set the background:
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
Graphics x= this.getGraphics();
Image img = null;
try
{img = ImageIO.read(new File("noga1.jpg"));
x.drawImage(img, 0, 0, rootPane);}
catch (Exception e) {}
}
And that's what we can see after performing an action: