예제 #1
0
  public void init(Object parent) {

    glass = new BlurGlass();
    glass.setLayout(null);

    this.setLayout(null);

    setOpaque(false);
    // getContentPane().setOpaque(false);
    this.getLayeredPane().setOpaque(false);
    this.getRootPane().setOpaque(false);
    // putClientProperty("Synthetica.opaque", Boolean.FALSE);

    JParent = parent;
    glass.setOpaque(false);

    MouseInputAdapter adapter = new MouseInputAdapter() {};
    glass.addMouseListener(adapter);
    glass.addMouseMotionListener(adapter);

    try {
      if (parent instanceof JFrame) {
        layer = ((JFrame) parent).getLayeredPane();
      } else if (parent instanceof JInternalFrame) {
        layer = ((JInternalFrame) parent).getLayeredPane();
      }
      glass.setBounds(layer.getBounds());

    } catch (NullPointerException err) {
      Dialogos.error("Error interno en Dialogo interno modal", err);
    }

    try {
      glass.add(this);
      layer.add(glass, JLayeredPane.DEFAULT_LAYER);
    } catch (NullPointerException err) {
      Dialogos.error("Error interno en dialogo modal interno", err);
    }
  }
예제 #2
0
  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);
    }
  }
예제 #3
0
  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);
  }