I used to do the transparent background with javax.swing.JLabel this way:
lbl.setBackground(new Color(0, 0, 0, 0));
.
But it doesn't work with java.awt.Label. Is there any simple way to make the label transparent?
Update:
public class SplashBackground extends Panel {
private static final long serialVersionUID = 1L;
private Image image = null;
/**
* This is the default constructor
*/
public SplashBackground() {
super();
initialize();
}
/**
* This method initializes this
*
*/
private void initialize() {
image = Toolkit.getDefaultToolkit().createImage(getClass().getResource("/splash/splash.jpg"));
this.setLayout(null);
}
@Override
public void paint(Graphics g) {
super.paint(g);
if(image != null) {
g.drawImage(image, 0,0,this.getWidth(),this.getHeight(),this);
}
}
}
and
lbl= new Label();
lbl.setBackground(new Color(0, 0, 0, 0));
splashBackground = new SplashBackground();
splashBackground.add(appNameLabel, null);