JPanel与图像背景

Jes*_*ssy 7 java background-image jpanel

如何在JPANEL上放置图像背景?

JPanel pDraw = new JPanel(new GridLayout(ROWS,COLS,2,2)); 
pDraw.setPreferredSize(new Dimension(600,600)); //size of the JPanel
pDraw.setBackground(Color.RED); //How can I change the background from red color to image?
Run Code Online (Sandbox Code Playgroud)

Bor*_*vić 2

这是一个解释。