So fügen Sie Hintergrundfarbe in JFrame hinzu
import java.awt.Color; //to be imported
JFrame frame = new JFrame("Figure");
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.getContentPane().setBackground(new Color(0,0,0)); //setting the background color
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
Dead Dragonfly