JPanel with image background
How to put image background on 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? Here's an explanation. It is probably easiest to load the Image into an ImageIcon and display it in a JLabel , however: To directly 'draw' the image to the JPanel, override the JPanel's paintComponent(Graphics) method to something like the following: public void paintComponent(Graphics page) { super.paintComponent(page); page.drawImage(img,