home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
ListItem.java
< prev
next >
Wrap
Text File
|
1998-08-21
|
2KB
|
89 lines
package symantec.itools.awt;
import java.awt.Image;
import java.awt.Color;
import java.awt.FontMetrics;
import java.net.URL;
// 07/29/87 CAR class implements java.io.Serializable
// marked fields transient as needed
// added field "url" to keep track of the URL "behind" the Image (if one is provieded)
// added constructor which takes an URL as one of its arguments
/**
* This class is not public and therefore cannot be used outside this package.
*
* @see ImageListBox
*
* @version 1.0, Nov 26, 1996
*
* @author Symantec
*
*/
class ListItem implements java.io.Serializable
{
URL url = null;
transient Image image;
String sText;
boolean bEnabled;
boolean bSelected;
transient boolean bDirty;
Color color;
int lineWidth;
boolean bCellBorder;
Color cellBorderColor;
boolean bEdited = false;
public ListItem(Image image, String sText, boolean bEnabled, FontMetrics fm, boolean bCellBorder)
{
this.image = image;
this.sText = sText;
this.bEnabled = bEnabled;
this.bSelected = false;
this.bDirty = true;
this.color = null;
this.bCellBorder = bCellBorder;
this.cellBorderColor = Color.black;
updateWidth(fm);
}
public ListItem(Image image, URL url, String sText, boolean bEnabled, FontMetrics fm, boolean bCellBorder)
{
this(image, sText, bEnabled, fm, bCellBorder);
this.url = url;
}
public void updateWidth(FontMetrics fm)
{
if (fm != null)
this.lineWidth = fm.stringWidth(sText);
else
this.lineWidth = 0;
}
public String toString()
{
String s = "ListItem " + sText;
if (image != null)
s += " [Image]";
if (color != Color.black)
s += " [Colored]";
if (bEnabled)
s += " [Enabled]";
else
s += " [Disabled]";
if (bSelected)
s += " [Selected]";
else
s += " [Not Selected]";
if (bDirty)
s += " [Dirty]";
return s;
}
}