Listing of Source client/SYSICON_SYSICONWINPROC.javapackage cuserwin;
import java.awt.Graphics;
import javax.swing.Icon;
import javax.swing.UIManager;
import se.entra.phantom.client.PJUserWindow;
import se.entra.phantom.client.CUserWindow;
/**
* This user window presents four different icons. It is provided as a sample
* with Phantom Hurricane (UW2DUAL).
*
* <p>Icons:
* <br> 0 - Application (none for NetPhantom),
* <br> 1 - Critical/Error,
* <br> 2 - Information,
* <br> 3 - Question,
* <br> 4 - Warning.
*/
public class SYSICON_SYSICONWINPROC extends PJUserWindow
{
/**
* The different names for the icons.
*/
private static final String [] iconText =
{
"error",
"information",
"question",
"warning"
};
/**
* The selected icon (or null if none).
*/
private Icon icon;
/**
* Creates the user window that displays an icon.
*/
public SYSICON_SYSICONWINPROC(CUserWindow uw,byte [] data)
{
super(uw,data);
if ( data.length>0 )
{
// Set flags.
int i=data[0];
if ( i>0 && i<=iconText.length )
icon=UIManager.getIcon("OptionPane."+iconText[i-1]+"Icon");
}
}
/**
* Paints the icon top/left.
*/
public void paint(Graphics g)
{
if ( icon!=null )
icon.paintIcon(this,g,0,0);
}
}