211 |
*/ |
*/ |
212 |
static final Object treeLock = new String("AWT_TREE_LOCK"); |
static final Object treeLock = new String("AWT_TREE_LOCK"); |
213 |
|
|
214 |
|
/** |
215 |
|
* Preallocated default font returned by getFont() if no font was |
216 |
|
* set explicitly. |
217 |
|
*/ |
218 |
|
private static final Font DEFAULT_FONT = new Font ("Dialog", Font.PLAIN, 12); |
219 |
|
|
220 |
// Serialized fields from the serialization spec. |
// Serialized fields from the serialization spec. |
221 |
|
|
222 |
/** |
/** |
994 |
*/ |
*/ |
995 |
public void setForeground(Color c) |
public void setForeground(Color c) |
996 |
{ |
{ |
|
firePropertyChange("foreground", foreground, c); |
|
997 |
if (peer != null) |
if (peer != null) |
998 |
peer.setForeground(c); |
peer.setForeground(c); |
999 |
|
|
1000 |
|
Color previous = foreground; |
1001 |
foreground = c; |
foreground = c; |
1002 |
|
firePropertyChange("foreground", previous, c); |
1003 |
} |
} |
1004 |
|
|
1005 |
/** |
/** |
1025 |
{ |
{ |
1026 |
if (background != null) |
if (background != null) |
1027 |
return background; |
return background; |
1028 |
return parent == null ? SystemColor.window : parent.getBackground(); |
return parent == null ? null : parent.getBackground(); |
1029 |
} |
} |
1030 |
|
|
1031 |
/** |
/** |
1039 |
public void setBackground(Color c) |
public void setBackground(Color c) |
1040 |
{ |
{ |
1041 |
// return if the background is already set to that color. |
// return if the background is already set to that color. |
1042 |
if (background != null && c != null) |
if ((c != null) && c.equals(background)) |
1043 |
if (background.equals(c)) |
return; |
1044 |
return; |
|
1045 |
// If c is null, inherit from closest ancestor whose bg is set. |
// If c is null, inherit from closest ancestor whose bg is set. |
1046 |
if (c == null && parent != null) |
if (c == null && parent != null) |
1047 |
c = parent.getBackground(); |
c = parent.getBackground(); |
|
firePropertyChange("background", background, c); |
|
1048 |
if (peer != null && c != null) |
if (peer != null && c != null) |
1049 |
peer.setBackground(c); |
peer.setBackground(c); |
1050 |
|
|
1051 |
|
Color previous = background; |
1052 |
background = c; |
background = c; |
1053 |
|
firePropertyChange("background", previous, c); |
1054 |
} |
} |
1055 |
|
|
1056 |
/** |
/** |
1074 |
*/ |
*/ |
1075 |
public Font getFont() |
public Font getFont() |
1076 |
{ |
{ |
1077 |
if (font != null) |
Font f = font; |
1078 |
return font; |
if (f != null) |
1079 |
|
return f; |
1080 |
if (parent != null) |
|
1081 |
return parent.getFont (); |
Component p = parent; |
1082 |
|
if (p != null) |
1083 |
|
return p.getFont (); |
1084 |
else |
else |
1085 |
return new Font ("Dialog", Font.PLAIN, 12); |
return DEFAULT_FONT; |
1086 |
} |
} |
1087 |
|
|
1088 |
/** |
/** |
1095 |
*/ |
*/ |
1096 |
public void setFont(Font newFont) |
public void setFont(Font newFont) |
1097 |
{ |
{ |
1098 |
if (font == newFont) |
if((newFont != null && (font == null || !font.equals(newFont))) |
1099 |
return; |
|| newFont == null) |
1100 |
|
{ |
1101 |
Font oldFont = font; |
Font oldFont = font; |
1102 |
font = newFont; |
font = newFont; |
1103 |
if (peer != null) |
if (peer != null) |
1104 |
peer.setFont(font); |
peer.setFont(font); |
1105 |
firePropertyChange("font", oldFont, newFont); |
firePropertyChange("font", oldFont, newFont); |
1106 |
invalidate(); |
invalidate(); |
1107 |
|
} |
1108 |
} |
} |
1109 |
|
|
1110 |
/** |
/** |
4221 |
param.append(",translucent"); |
param.append(",translucent"); |
4222 |
if (isDoubleBuffered()) |
if (isDoubleBuffered()) |
4223 |
param.append(",doublebuffered"); |
param.append(",doublebuffered"); |
4224 |
|
if (parent == null) |
4225 |
|
param.append(",parent==null"); |
4226 |
|
else |
4227 |
|
param.append(",parent==").append(parent.getName()); |
4228 |
return param.toString(); |
return param.toString(); |
4229 |
} |
} |
4230 |
|
|