I am using the following code to fade-in a JDialog with a javax.swing.Timer:
    float i = 0.0F;
    final Timer timer = new Timer(50, null);
    timer.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (i == 0.8F){
                timer.stop();
            }
            i = i + 0.1F;
            setOpacity(i);
        }
    });
    timer.start();
The Dialog is nicely faded-in with the desired effect but at last, an IllegalArgumentException Occurs saying that:
 The value of opacity should be in the range [0.0f .. 1.0f]
But the problem is I am not going far fro i = 0.8F so how can it be a illegal argument??
Exception occur at line : setOpacity(i);
Any suggestions? Solutions?