title: how to set JFrame background transparent but JPanel or JLabel Background opaque?
body: <p>As per assignment, we have to create a image viewer just like Picasas one. picture in the middle, translucent black background and changing images with left/right buttons.</p>
  
  <p>i can display an image set it to undercoated, set it to translucent frame but along with frame the the picture becomes translucent. what am i doing wrong.</p>
  
  <pre><code>Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();   
  
  JFrame f1 = new JFrame("ShowImage");
  f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
  f1.setSize(dim);
  
  f1.setUndecorated(true);
  f1.setOpacity(0.5f);
  ShowImage panel = new ShowImage();
  panel.setBackground(Color.black);
  
  f1.setContentPane(panel); 
  f1.setVisible(true);  
  </code></pre>
  
  <p>i tried </p>
  
  <pre><code>si.setOpaque();   
  si.setBackground(Color.black);
  si.setForeground(Color.red);
  </code></pre>
  
  <p>none worked</p>
  
  <p>when i took a boolean and tested </p>
  
  <pre><code>si.isDisplayable();
  si.isVisible();
  si.isShowing();
  </code></pre>
  
  <p>only is visible returns true, rest are false, are these any contributing factor?</p>