JFrame設置背景色代碼:
import java.awt.Color; import javax.swing.JFrame; public class Test { public static void main(String[] args) { JFrame frame=new JFrame("背景色測試"); frame.setLocation(150,250); frame.setSize(300,200); frame.setBackground(Color.blue); frame.getContentPane().setVisible(false); frame.setVisible(true); } }