How can I fade in a JPanel & children?
Posted
by
Christian 'fuzi' Orgler
on Stack Overflow
See other posts from Stack Overflow
or by Christian 'fuzi' Orgler
Published on 2012-09-21T07:34:13Z
Indexed on
2012/09/21
9:38 UTC
Read the original article
Hit count: 226
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();
© Stack Overflow or respective owner