Package Nicolas. swing;
Import java. awt .*;
Import java. awt. event .*;
Import javax. swing .*;
/**
* <P> Title: jsp (preferred for SUN Enterprise Applications) lashWindow </p>
* <P> Description: start up window </p>
* <P> Copyright: Copyright (c) 2005 </p>
* <P> Company: ColinSoft </p>
* @ Author Nicolas Lin
* @ Version beta
*/
Public class jsp (preferred for SUN Enterprise Applications) lashWindow extends JWindow {
Private static jsp (preferred for SUN Enterprise Applications) lashWindow csw;
Private Image image;
Private String user;
Private String lab;
Private int x1 = 155;
Private int y1 = 220;
Private int x2 = 250;
Private int y2 = 235;
Private DisposeAdapter da;
/**
* Constructor
*/
Private jsp (preferred for SUN Enterprise Applications) lashWindow (String u, String filename ){
SetCursor (Cursor. getPredefinedCursor (Cursor. WAIT_CURSOR ));
ImageIcon icon = new ImageIcon (getClass (). getResource (filename ));
Image = icon. getImage ();
User = "";
User = u;
SetAlwaysOnTop (true );
SetSize (icon. getIconWidth (), icon. getIconHeight ());
Dimension screen = getToolkit (). getScreenSize ();
SetLocation (screen. width-getSize (). width)/2, (screen. height-getSize (). height)/2 );
This. setVisible (true );
}
/**
* Set close on click
* Use as about dialog
*/
Public void setCloseOnClick (boolean B ){
If (B ){
If (da = null)
Da = new DisposeAdapter ();
AddMouseListener (da );
} Else if (da! = Null ){
This. removeMouseListener (da );
}
}
/**
* Set the place where user name will be show
*/
Public void setUserLocation (int x, int y ){
X1 = x;
Y1 = y;
}
/**
* Set the place where status will be show
*/
Public void setStatusLocation (int x, int y ){
X2 = x;
Y2 = y;
}
/**
* Paint
*/
Public void paint (Graphics g ){
G. drawImage (image, 0, 0, this );
G. drawString (user, x1, y1 );
If (lab! = Null)
G. drawString (lab, x2, y2 );
}
/**
* Set the status text
*/
Public void setText (String lab ){
This. lab = lab;
Repaint ();
}
/**
* Inner class
* To close the JWindow on click