public void fadeIn() { final float acel = 0.1f; generarFondo(this); super.setVisible(true); try { while (BlurGlass.this.getAlpha() + acel <= 1.0f) { SwingUtilities.invokeAndWait( new Runnable() { public void run() { BlurGlass.this.setAlpha(BlurGlass.this.getAlpha() + acel); } }); Thread.sleep(50); } } catch (Exception e) { Dialogos.error("Error en fadein", e); } }
public void fadeOut() { super.setVisible(true); try { final float desacel = 0.1f; while (BlurGlass.this.getAlpha() - desacel >= 0.0f) { SwingUtilities.invokeLater( new Runnable() { public void run() { BlurGlass.this.setAlpha(BlurGlass.this.getAlpha() - desacel); } }); Thread.sleep(50); } BlurGlass.this.setAlpha(0.0f); } catch (Exception e) { Dialogos.error("Error en fadeout", e); } // super.setVisible(false); // BlurGlass.this.setAlpha(0.2f); // setAlpha(0.2f); super.setVisible(false); }