how do you make a jframe transparent?...i need to add a png or gif image in the frame..so when i run the program it will only show the image..and the image would float in the desktop..
i also need to add a few components like JButton.. i want the frame to be invisible so the button would also be floating...
i tried setOpaque(false); but in only shows an error..
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class emptyframe extends JFrame{
private JLabel BG = new JLabel (new ImageIcon("Earth-06-june.gif"));
public emptyframe()
{
watever();
BG.setBounds(50,50,100,100);
add(BG);
}
private void watever()
{
setPreferredSize (new Dimension (300, 300));
setLayout (null);
setVisible(true);
pack();
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
setLocation(400,250);
setBackground(Color.black);
}
public static void main (String[] args) {
new emptyframe().setVisible(true);
}
}