I know that I can fade in a panel, by adding the alpha value to the background color & a timer. But how can I fade in a panel with child components (like a JLabel)?
EDIT
_fadeTimer = new Timer(40, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (_alpha == 255) {
_fadeTimer.stop();
} else {
pnl_hint.setBackground(new Color(
bgColor.getRed(),
bgColor.getGreen(),
bgColor.getBlue(),
(_alpha += 1)));
pnl_hint.updateUI();
}
}
});
_fadeTimer.start();
Another option would be to capture a screenshot of your panel and then let it paint itself with an increasing alpha composite.
Here is a small demo of that (although I am not sure this is really clean):