Hi, Victor,
Look at this class. I hope it helps you.
Regards.
Alvaro




Hola,  Victor, a ver si te sirve de ayuda.
Alvaro .






import java.awt.*;
import javax.swing.*;
import javax.swing.border.EtchedBorder;


public class SplashMessage extends JWindow
{

  /** JLabel con el mensaje a mostrar en la ventana */
  private JLabel label;



 /**
  *  Crea la ventana con un mensaje inicial y la hace visible.
  *  La ventana aparece centrada respecto a la ventana padre.
  *
  * @param   owner    Ventana padre
  * @param   message  Mensaje a mostrar
  */
  public SplashMessage(Frame owner, String message)
  {
 super(owner);

 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 getContentPane().setLayout(new BorderLayout());

 JPanel panelBordeExterior = new JPanel(new BorderLayout());
 panelBordeExterior.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
 getContentPane().add(panelBordeExterior, BorderLayout.CENTER);

    JPanel panelBorde = new JPanel(new BorderLayout());

panelBorde.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED))
;
 panelBordeExterior.add(panelBorde, BorderLayout.CENTER);

 JPanel panelBordeInterior = new JPanel(new BorderLayout());
 panelBordeInterior.setBorder(BorderFactory.createEmptyBorder(15,25,15,25));
 label = new JLabel(message);
 panelBordeInterior.add(label, BorderLayout.CENTER);
 panelBorde.add(panelBordeInterior, BorderLayout.CENTER);

 pack();

 // centrar en la ventana padre
 if (owner == null)
 {
   Dimension parentSize = Toolkit.getDefaultToolkit().getScreenSize();
   setLocation((parentSize.width - getWidth()) /2,
        (parentSize.height - getHeight()) /2);

 }
    else


      int xParent = owner.getX();
      int yParent = owner.getY();
    Dimension parentSize = owner.getSize();
   setLocation(xParent + (parentSize.width - getWidth()) / 2,
           yParent + (parentSize.height - getHeight()) / 2);
 }

 setVisible(true);
  }



 /**
  * Cambia el mensaje que se muestra en la ventana
  *
  * @param   message  Nuevo mensaje
  */
  public void setMessage(String message)
  {
 label.setText(message);
 pack();
  }



}

-----Mensaje original-----
De: Víctor <[EMAIL PROTECTED]>
Para: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Fecha: martes 22 de mayo de 2001 10:48
Asunto: [JAVA3D] Splash screen an Java 3D


> Hi all, I would like to add a splash screen while our application
>starts up. The problem is that I don't know how to find out when my main
>screen in shown. Anybody knows how to do this.
>
>  Billion thanks in advance.
>
> PRISMAKER TEAM
>
>--
>Maldecir es el único lenguaje que dominan todos los programadores.
>
>Hay dos productos que han salido de Berkeley:
>el LSD y el UNIX. No creemos que sea una coincidencia.
>(Jeremy S. Anderson).
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to