Images and Panels
问题 I'm having a problem adding a JPanel on top of an Image . This is what I'm trying to do: Image bgImage = loadImage(filename); JPanel jp = new JPanel(); jp.setBounds(100,100,100,100); jp.setOpaque(true); jp.setBackgroudColor(Color.red); bgImage.add(jp); After doing this, I only see the bgImage . I tried everything but I still can't show the panel. Can somebody help me? 回答1: You cannot place a component inside an Image . What you want to do is paint the Image onto the background of a swing