Fading a JLabel that contains html
问题 I can fade out a normal JLabel using a Timer, as follows: public static void main(String[] args) { JFrame frame = new JFrame(); // final JLabel label = new JLabel("<html><font color=red>Red</font><font color=blue>Blue</font>"); final JLabel label = new JLabel("Hello"); label.setOpaque(true); label.setBackground(Color.WHITE); frame.getContentPane().add(label); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); final Timer timer = new Timer(100, null); final int steps = 25