Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d58597e0
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d58597e0
编写于
8月 14, 2009
作者:
R
rupashka
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
Reviewed-by: alexp
上级
6471c8ff
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
148 addition
and
158 deletion
+148
-158
src/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java
...sses/com/sun/java/swing/plaf/windows/DesktopProperty.java
+15
-33
src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
...s/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
+57
-115
src/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java
...sses/javax/swing/plaf/metal/MetalFontDesktopProperty.java
+4
-6
src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
...hare/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
+2
-4
test/com/sun/java/swing/plaf/windows/Test6824600.java
test/com/sun/java/swing/plaf/windows/Test6824600.java
+70
-0
未找到文件。
src/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java
浏览文件 @
d58597e0
/*
/*
* Copyright 2001-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -49,7 +49,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
...
@@ -49,7 +49,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
/**
/**
* ReferenceQueue of unreferenced WeakPCLs.
* ReferenceQueue of unreferenced WeakPCLs.
*/
*/
private
static
ReferenceQueue
<
DesktopProperty
>
queue
;
private
static
final
ReferenceQueue
<
DesktopProperty
>
queue
=
new
ReferenceQueue
<
DesktopProperty
>()
;
/**
/**
* PropertyChangeListener attached to the Toolkit.
* PropertyChangeListener attached to the Toolkit.
...
@@ -58,7 +58,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
...
@@ -58,7 +58,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
/**
/**
* Key used to lookup value from desktop.
* Key used to lookup value from desktop.
*/
*/
private
String
key
;
private
final
String
key
;
/**
/**
* Value to return.
* Value to return.
*/
*/
...
@@ -66,17 +66,8 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
...
@@ -66,17 +66,8 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
/**
/**
* Fallback value in case we get null from desktop.
* Fallback value in case we get null from desktop.
*/
*/
private
Object
fallback
;
private
final
Object
fallback
;
/**
* Toolkit.
*/
private
Toolkit
toolkit
;
static
{
queue
=
new
ReferenceQueue
<
DesktopProperty
>();
}
/**
/**
* Cleans up any lingering state held by unrefeernced
* Cleans up any lingering state held by unrefeernced
...
@@ -138,13 +129,10 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
...
@@ -138,13 +129,10 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
*
*
* @param key Key used in looking up desktop value.
* @param key Key used in looking up desktop value.
* @param fallback Value used if desktop property is null.
* @param fallback Value used if desktop property is null.
* @param toolkit Toolkit used to fetch property from, can be null
* in which default will be used.
*/
*/
public
DesktopProperty
(
String
key
,
Object
fallback
,
Toolkit
toolkit
)
{
public
DesktopProperty
(
String
key
,
Object
fallback
)
{
this
.
key
=
key
;
this
.
key
=
key
;
this
.
fallback
=
fallback
;
this
.
fallback
=
fallback
;
this
.
toolkit
=
toolkit
;
// The only sure fire way to clear our references is to create a
// The only sure fire way to clear our references is to create a
// Thread and wait for a reference to be added to the queue.
// Thread and wait for a reference to be added to the queue.
// Because it is so rare that you will actually change the look
// Because it is so rare that you will actually change the look
...
@@ -175,13 +163,14 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
...
@@ -175,13 +163,14 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
* Returns the value from the desktop.
* Returns the value from the desktop.
*/
*/
protected
Object
getValueFromDesktop
()
{
protected
Object
getValueFromDesktop
()
{
if
(
this
.
toolkit
==
null
)
{
Toolkit
toolkit
=
Toolkit
.
getDefaultToolkit
();
this
.
toolkit
=
Toolkit
.
getDefaultToolkit
();
if
(
pcl
==
null
)
{
pcl
=
new
WeakPCL
(
this
,
getKey
(),
UIManager
.
getLookAndFeel
());
toolkit
.
addPropertyChangeListener
(
getKey
(),
pcl
);
}
}
Object
value
=
toolkit
.
getDesktopProperty
(
getKey
());
pcl
=
new
WeakPCL
(
this
,
toolkit
,
getKey
(),
UIManager
.
getLookAndFeel
());
return
toolkit
.
getDesktopProperty
(
getKey
());
toolkit
.
addPropertyChangeListener
(
getKey
(),
pcl
);
return
value
;
}
}
/**
/**
...
@@ -205,12 +194,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
...
@@ -205,12 +194,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
* <code>createValue</code> will ask for the property again.
* <code>createValue</code> will ask for the property again.
*/
*/
public
void
invalidate
()
{
public
void
invalidate
()
{
if
(
pcl
!=
null
)
{
value
=
null
;
toolkit
.
removePropertyChangeListener
(
getKey
(),
pcl
);
toolkit
=
null
;
pcl
=
null
;
value
=
null
;
}
}
}
/**
/**
...
@@ -271,13 +255,11 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
...
@@ -271,13 +255,11 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
*/
*/
private
static
class
WeakPCL
extends
WeakReference
<
DesktopProperty
>
private
static
class
WeakPCL
extends
WeakReference
<
DesktopProperty
>
implements
PropertyChangeListener
{
implements
PropertyChangeListener
{
private
Toolkit
kit
;
private
String
key
;
private
String
key
;
private
LookAndFeel
laf
;
private
LookAndFeel
laf
;
WeakPCL
(
DesktopProperty
target
,
Toolkit
kit
,
String
key
,
LookAndFeel
laf
)
{
WeakPCL
(
DesktopProperty
target
,
String
key
,
LookAndFeel
laf
)
{
super
(
target
,
queue
);
super
(
target
,
queue
);
this
.
kit
=
kit
;
this
.
key
=
key
;
this
.
key
=
key
;
this
.
laf
=
laf
;
this
.
laf
=
laf
;
}
}
...
@@ -297,7 +279,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
...
@@ -297,7 +279,7 @@ public class DesktopProperty implements UIDefaults.ActiveValue {
}
}
void
dispose
()
{
void
dispose
()
{
kit
.
removePropertyChangeListener
(
key
,
this
);
Toolkit
.
getDefaultToolkit
()
.
removePropertyChangeListener
(
key
,
this
);
}
}
}
}
}
}
src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
浏览文件 @
d58597e0
/*
/*
* Copyright 1997-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -104,7 +104,6 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -104,7 +104,6 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
new
StringUIClientPropertyKey
(
new
StringUIClientPropertyKey
(
"WindowsLookAndFeel.generateHiResDisabledIcon"
);
"WindowsLookAndFeel.generateHiResDisabledIcon"
);
private
Toolkit
toolkit
;
private
boolean
updatePending
=
false
;
private
boolean
updatePending
=
false
;
private
boolean
useSystemFontSettings
=
true
;
private
boolean
useSystemFontSettings
=
true
;
...
@@ -149,7 +148,6 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -149,7 +148,6 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
public
void
initialize
()
{
public
void
initialize
()
{
super
.
initialize
();
super
.
initialize
();
toolkit
=
Toolkit
.
getDefaultToolkit
();
// Set the flag which determines which version of Windows should
// Set the flag which determines which version of Windows should
// be rendered. This flag only need to be set once.
// be rendered. This flag only need to be set once.
...
@@ -470,80 +468,61 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -470,80 +468,61 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
Object
ControlBackgroundColor
=
new
DesktopProperty
(
Object
ControlBackgroundColor
=
new
DesktopProperty
(
"win.3d.backgroundColor"
,
"win.3d.backgroundColor"
,
table
.
get
(
"control"
),
table
.
get
(
"control"
));
toolkit
);
Object
ControlLightColor
=
new
DesktopProperty
(
Object
ControlLightColor
=
new
DesktopProperty
(
"win.3d.lightColor"
,
"win.3d.lightColor"
,
table
.
get
(
"controlHighlight"
),
table
.
get
(
"controlHighlight"
));
toolkit
);
Object
ControlHighlightColor
=
new
DesktopProperty
(
Object
ControlHighlightColor
=
new
DesktopProperty
(
"win.3d.highlightColor"
,
"win.3d.highlightColor"
,
table
.
get
(
"controlLtHighlight"
),
table
.
get
(
"controlLtHighlight"
));
toolkit
);
Object
ControlShadowColor
=
new
DesktopProperty
(
Object
ControlShadowColor
=
new
DesktopProperty
(
"win.3d.shadowColor"
,
"win.3d.shadowColor"
,
table
.
get
(
"controlShadow"
),
table
.
get
(
"controlShadow"
));
toolkit
);
Object
ControlDarkShadowColor
=
new
DesktopProperty
(
Object
ControlDarkShadowColor
=
new
DesktopProperty
(
"win.3d.darkShadowColor"
,
"win.3d.darkShadowColor"
,
table
.
get
(
"controlDkShadow"
),
table
.
get
(
"controlDkShadow"
));
toolkit
);
Object
ControlTextColor
=
new
DesktopProperty
(
Object
ControlTextColor
=
new
DesktopProperty
(
"win.button.textColor"
,
"win.button.textColor"
,
table
.
get
(
"controlText"
),
table
.
get
(
"controlText"
));
toolkit
);
Object
MenuBackgroundColor
=
new
DesktopProperty
(
Object
MenuBackgroundColor
=
new
DesktopProperty
(
"win.menu.backgroundColor"
,
"win.menu.backgroundColor"
,
table
.
get
(
"menu"
),
table
.
get
(
"menu"
));
toolkit
);
Object
MenuBarBackgroundColor
=
new
DesktopProperty
(
Object
MenuBarBackgroundColor
=
new
DesktopProperty
(
"win.menubar.backgroundColor"
,
"win.menubar.backgroundColor"
,
table
.
get
(
"menu"
),
table
.
get
(
"menu"
));
toolkit
);
Object
MenuTextColor
=
new
DesktopProperty
(
Object
MenuTextColor
=
new
DesktopProperty
(
"win.menu.textColor"
,
"win.menu.textColor"
,
table
.
get
(
"menuText"
),
table
.
get
(
"menuText"
));
toolkit
);
Object
SelectionBackgroundColor
=
new
DesktopProperty
(
Object
SelectionBackgroundColor
=
new
DesktopProperty
(
"win.item.highlightColor"
,
"win.item.highlightColor"
,
table
.
get
(
"textHighlight"
),
table
.
get
(
"textHighlight"
));
toolkit
);
Object
SelectionTextColor
=
new
DesktopProperty
(
Object
SelectionTextColor
=
new
DesktopProperty
(
"win.item.highlightTextColor"
,
"win.item.highlightTextColor"
,
table
.
get
(
"textHighlightText"
),
table
.
get
(
"textHighlightText"
));
toolkit
);
Object
WindowBackgroundColor
=
new
DesktopProperty
(
Object
WindowBackgroundColor
=
new
DesktopProperty
(
"win.frame.backgroundColor"
,
"win.frame.backgroundColor"
,
table
.
get
(
"window"
),
table
.
get
(
"window"
));
toolkit
);
Object
WindowTextColor
=
new
DesktopProperty
(
Object
WindowTextColor
=
new
DesktopProperty
(
"win.frame.textColor"
,
"win.frame.textColor"
,
table
.
get
(
"windowText"
),
table
.
get
(
"windowText"
));
toolkit
);
Object
WindowBorderWidth
=
new
DesktopProperty
(
Object
WindowBorderWidth
=
new
DesktopProperty
(
"win.frame.sizingBorderWidth"
,
"win.frame.sizingBorderWidth"
,
Integer
.
valueOf
(
1
),
Integer
.
valueOf
(
1
));
toolkit
);
Object
TitlePaneHeight
=
new
DesktopProperty
(
Object
TitlePaneHeight
=
new
DesktopProperty
(
"win.frame.captionHeight"
,
"win.frame.captionHeight"
,
Integer
.
valueOf
(
18
),
Integer
.
valueOf
(
18
));
toolkit
);
Object
TitleButtonWidth
=
new
DesktopProperty
(
Object
TitleButtonWidth
=
new
DesktopProperty
(
"win.frame.captionButtonWidth"
,
"win.frame.captionButtonWidth"
,
Integer
.
valueOf
(
16
),
Integer
.
valueOf
(
16
));
toolkit
);
Object
TitleButtonHeight
=
new
DesktopProperty
(
Object
TitleButtonHeight
=
new
DesktopProperty
(
"win.frame.captionButtonHeight"
,
"win.frame.captionButtonHeight"
,
Integer
.
valueOf
(
16
),
Integer
.
valueOf
(
16
));
toolkit
);
Object
InactiveTextColor
=
new
DesktopProperty
(
Object
InactiveTextColor
=
new
DesktopProperty
(
"win.text.grayedTextColor"
,
"win.text.grayedTextColor"
,
table
.
get
(
"textInactiveText"
),
table
.
get
(
"textInactiveText"
));
toolkit
);
Object
ScrollbarBackgroundColor
=
new
DesktopProperty
(
Object
ScrollbarBackgroundColor
=
new
DesktopProperty
(
"win.scrollbar.backgroundColor"
,
"win.scrollbar.backgroundColor"
,
table
.
get
(
"scrollbar"
),
table
.
get
(
"scrollbar"
));
toolkit
);
Object
TextBackground
=
new
XPColorValue
(
Part
.
EP_EDIT
,
null
,
Prop
.
FILLCOLOR
,
Object
TextBackground
=
new
XPColorValue
(
Part
.
EP_EDIT
,
null
,
Prop
.
FILLCOLOR
,
WindowBackgroundColor
);
WindowBackgroundColor
);
...
@@ -566,32 +545,22 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -566,32 +545,22 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
Object
ToolTipFont
=
sansSerifPlain12
;
Object
ToolTipFont
=
sansSerifPlain12
;
Object
IconFont
=
ControlFont
;
Object
IconFont
=
ControlFont
;
Object
scrollBarWidth
=
new
DesktopProperty
(
"win.scrollbar.width"
,
Object
scrollBarWidth
=
new
DesktopProperty
(
"win.scrollbar.width"
,
Integer
.
valueOf
(
16
));
Integer
.
valueOf
(
16
),
toolkit
);
Object
menuBarHeight
=
new
DesktopProperty
(
"win.menu.height"
,
Object
menuBarHeight
=
new
DesktopProperty
(
"win.menu.height"
,
null
);
null
,
toolkit
);
Object
hotTrackingOn
=
new
DesktopProperty
(
"win.item.hotTrackingOn"
,
Object
hotTrackingOn
=
new
DesktopProperty
(
"win.item.hotTrackingOn"
,
true
);
true
,
toolkit
);
Object
showMnemonics
=
new
DesktopProperty
(
"win.menu.keyboardCuesOn"
,
Object
showMnemonics
=
new
DesktopProperty
(
"win.menu.keyboardCuesOn"
,
Boolean
.
TRUE
);
Boolean
.
TRUE
,
toolkit
);
if
(
useSystemFontSettings
)
{
if
(
useSystemFontSettings
)
{
MenuFont
=
getDesktopFontValue
(
"win.menu.font"
,
MenuFont
,
toolkit
);
MenuFont
=
getDesktopFontValue
(
"win.menu.font"
,
MenuFont
);
FixedControlFont
=
getDesktopFontValue
(
"win.ansiFixed.font"
,
FixedControlFont
=
getDesktopFontValue
(
"win.ansiFixed.font"
,
FixedControlFont
);
FixedControlFont
,
toolkit
);
ControlFont
=
getDesktopFontValue
(
"win.defaultGUI.font"
,
ControlFont
);
ControlFont
=
getDesktopFontValue
(
"win.defaultGUI.font"
,
MessageFont
=
getDesktopFontValue
(
"win.messagebox.font"
,
MessageFont
);
ControlFont
,
toolkit
);
WindowFont
=
getDesktopFontValue
(
"win.frame.captionFont"
,
WindowFont
);
MessageFont
=
getDesktopFontValue
(
"win.messagebox.font"
,
IconFont
=
getDesktopFontValue
(
"win.icon.font"
,
IconFont
);
MessageFont
,
toolkit
);
ToolTipFont
=
getDesktopFontValue
(
"win.tooltip.font"
,
ToolTipFont
);
WindowFont
=
getDesktopFontValue
(
"win.frame.captionFont"
,
WindowFont
,
toolkit
);
IconFont
=
getDesktopFontValue
(
"win.icon.font"
,
IconFont
,
toolkit
);
ToolTipFont
=
getDesktopFontValue
(
"win.tooltip.font"
,
ToolTipFont
,
toolkit
);
/* Put the desktop AA settings in the defaults.
/* Put the desktop AA settings in the defaults.
* JComponent.setUI() retrieves this and makes it available
* JComponent.setUI() retrieves this and makes it available
...
@@ -605,26 +574,14 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -605,26 +574,14 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
new
FontDesktopProperty
(
SunToolkit
.
DESKTOPFONTHINTS
);
new
FontDesktopProperty
(
SunToolkit
.
DESKTOPFONTHINTS
);
}
}
if
(
useSystemFontSizeSettings
)
{
if
(
useSystemFontSizeSettings
)
{
MenuFont
=
new
WindowsFontSizeProperty
(
"win.menu.font.height"
,
MenuFont
=
new
WindowsFontSizeProperty
(
"win.menu.font.height"
,
Font
.
DIALOG
,
Font
.
PLAIN
,
12
);
toolkit
,
Font
.
DIALOG
,
Font
.
PLAIN
,
12
);
FixedControlFont
=
new
WindowsFontSizeProperty
(
"win.ansiFixed.font.height"
,
Font
.
MONOSPACED
,
FixedControlFont
=
new
WindowsFontSizeProperty
(
"win.ansiFixed.font.height"
,
toolkit
,
Font
.
MONOSPACED
,
Font
.
PLAIN
,
12
);
Font
.
PLAIN
,
12
);
ControlFont
=
new
WindowsFontSizeProperty
(
ControlFont
=
new
WindowsFontSizeProperty
(
"win.defaultGUI.font.height"
,
Font
.
DIALOG
,
Font
.
PLAIN
,
12
);
"win.defaultGUI.font.height"
,
toolkit
,
Font
.
DIALOG
,
MessageFont
=
new
WindowsFontSizeProperty
(
"win.messagebox.font.height"
,
Font
.
DIALOG
,
Font
.
PLAIN
,
12
);
Font
.
PLAIN
,
12
);
WindowFont
=
new
WindowsFontSizeProperty
(
"win.frame.captionFont.height"
,
Font
.
DIALOG
,
Font
.
BOLD
,
12
);
MessageFont
=
new
WindowsFontSizeProperty
(
ToolTipFont
=
new
WindowsFontSizeProperty
(
"win.tooltip.font.height"
,
Font
.
SANS_SERIF
,
Font
.
PLAIN
,
12
);
"win.messagebox.font.height"
,
IconFont
=
new
WindowsFontSizeProperty
(
"win.icon.font.height"
,
Font
.
DIALOG
,
Font
.
PLAIN
,
12
);
toolkit
,
Font
.
DIALOG
,
Font
.
PLAIN
,
12
);
WindowFont
=
new
WindowsFontSizeProperty
(
"win.frame.captionFont.height"
,
toolkit
,
Font
.
DIALOG
,
Font
.
BOLD
,
12
);
ToolTipFont
=
new
WindowsFontSizeProperty
(
"win.tooltip.font.height"
,
toolkit
,
Font
.
SANS_SERIF
,
Font
.
PLAIN
,
12
);
IconFont
=
new
WindowsFontSizeProperty
(
"win.icon.font.height"
,
toolkit
,
Font
.
DIALOG
,
Font
.
PLAIN
,
12
);
}
}
...
@@ -752,8 +709,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -752,8 +709,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
// DeskTop.
// DeskTop.
"Desktop.background"
,
new
DesktopProperty
(
"Desktop.background"
,
new
DesktopProperty
(
"win.desktop.backgroundColor"
,
"win.desktop.backgroundColor"
,
table
.
get
(
"desktop"
),
table
.
get
(
"desktop"
)),
toolkit
),
"Desktop.ancestorInputMap"
,
"Desktop.ancestorInputMap"
,
new
UIDefaults
.
LazyInputMap
(
new
Object
[]
{
new
UIDefaults
.
LazyInputMap
(
new
Object
[]
{
"ctrl F5"
,
"restore"
,
"ctrl F5"
,
"restore"
,
...
@@ -819,7 +775,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -819,7 +775,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
"FileChooser.filesOfTypeLabelMnemonic"
,
Integer
.
valueOf
(
KeyEvent
.
VK_T
),
"FileChooser.filesOfTypeLabelMnemonic"
,
Integer
.
valueOf
(
KeyEvent
.
VK_T
),
"FileChooser.usesSingleFilePane"
,
Boolean
.
TRUE
,
"FileChooser.usesSingleFilePane"
,
Boolean
.
TRUE
,
"FileChooser.noPlacesBar"
,
new
DesktopProperty
(
"win.comdlg.noPlacesBar"
,
"FileChooser.noPlacesBar"
,
new
DesktopProperty
(
"win.comdlg.noPlacesBar"
,
Boolean
.
FALSE
,
toolkit
),
Boolean
.
FALSE
),
"FileChooser.ancestorInputMap"
,
"FileChooser.ancestorInputMap"
,
new
UIDefaults
.
LazyInputMap
(
new
Object
[]
{
new
UIDefaults
.
LazyInputMap
(
new
Object
[]
{
"ESCAPE"
,
"cancelSelection"
,
"ESCAPE"
,
"cancelSelection"
,
...
@@ -861,36 +817,28 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -861,36 +817,28 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
"InternalFrame.resizeIconShadow"
,
ControlShadowColor
,
"InternalFrame.resizeIconShadow"
,
ControlShadowColor
,
"InternalFrame.activeBorderColor"
,
new
DesktopProperty
(
"InternalFrame.activeBorderColor"
,
new
DesktopProperty
(
"win.frame.activeBorderColor"
,
"win.frame.activeBorderColor"
,
table
.
get
(
"windowBorder"
),
table
.
get
(
"windowBorder"
)),
toolkit
),
"InternalFrame.inactiveBorderColor"
,
new
DesktopProperty
(
"InternalFrame.inactiveBorderColor"
,
new
DesktopProperty
(
"win.frame.inactiveBorderColor"
,
"win.frame.inactiveBorderColor"
,
table
.
get
(
"windowBorder"
),
table
.
get
(
"windowBorder"
)),
toolkit
),
"InternalFrame.activeTitleBackground"
,
new
DesktopProperty
(
"InternalFrame.activeTitleBackground"
,
new
DesktopProperty
(
"win.frame.activeCaptionColor"
,
"win.frame.activeCaptionColor"
,
table
.
get
(
"activeCaption"
),
table
.
get
(
"activeCaption"
)),
toolkit
),
"InternalFrame.activeTitleGradient"
,
new
DesktopProperty
(
"InternalFrame.activeTitleGradient"
,
new
DesktopProperty
(
"win.frame.activeCaptionGradientColor"
,
"win.frame.activeCaptionGradientColor"
,
table
.
get
(
"activeCaption"
),
table
.
get
(
"activeCaption"
)),
toolkit
),
"InternalFrame.activeTitleForeground"
,
new
DesktopProperty
(
"InternalFrame.activeTitleForeground"
,
new
DesktopProperty
(
"win.frame.captionTextColor"
,
"win.frame.captionTextColor"
,
table
.
get
(
"activeCaptionText"
),
table
.
get
(
"activeCaptionText"
)),
toolkit
),
"InternalFrame.inactiveTitleBackground"
,
new
DesktopProperty
(
"InternalFrame.inactiveTitleBackground"
,
new
DesktopProperty
(
"win.frame.inactiveCaptionColor"
,
"win.frame.inactiveCaptionColor"
,
table
.
get
(
"inactiveCaption"
),
table
.
get
(
"inactiveCaption"
)),
toolkit
),
"InternalFrame.inactiveTitleGradient"
,
new
DesktopProperty
(
"InternalFrame.inactiveTitleGradient"
,
new
DesktopProperty
(
"win.frame.inactiveCaptionGradientColor"
,
"win.frame.inactiveCaptionGradientColor"
,
table
.
get
(
"inactiveCaption"
),
table
.
get
(
"inactiveCaption"
)),
toolkit
),
"InternalFrame.inactiveTitleForeground"
,
new
DesktopProperty
(
"InternalFrame.inactiveTitleForeground"
,
new
DesktopProperty
(
"win.frame.inactiveCaptionTextColor"
,
"win.frame.inactiveCaptionTextColor"
,
table
.
get
(
"inactiveCaptionText"
),
table
.
get
(
"inactiveCaptionText"
)),
toolkit
),
"InternalFrame.maximizeIcon"
,
"InternalFrame.maximizeIcon"
,
WindowsIconFactory
.
createFrameMaximizeIcon
(),
WindowsIconFactory
.
createFrameMaximizeIcon
(),
...
@@ -1529,12 +1477,8 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -1529,12 +1477,8 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
// *** ToolTip
// *** ToolTip
"ToolTip.font"
,
ToolTipFont
,
"ToolTip.font"
,
ToolTipFont
,
"ToolTip.background"
,
new
DesktopProperty
(
"ToolTip.background"
,
new
DesktopProperty
(
"win.tooltip.backgroundColor"
,
table
.
get
(
"info"
)),
"win.tooltip.backgroundColor"
,
"ToolTip.foreground"
,
new
DesktopProperty
(
"win.tooltip.textColor"
,
table
.
get
(
"infoText"
)),
table
.
get
(
"info"
),
toolkit
),
"ToolTip.foreground"
,
new
DesktopProperty
(
"win.tooltip.textColor"
,
table
.
get
(
"infoText"
),
toolkit
),
// *** ToolTipManager
// *** ToolTipManager
"ToolTipManager.enableToolTipMode"
,
"activeApplication"
,
"ToolTipManager.enableToolTipMode"
,
"activeApplication"
,
...
@@ -1798,10 +1742,9 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -1798,10 +1742,9 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
* represented in the current encoding this will return null and
* represented in the current encoding this will return null and
* turn off the use of system fonts.
* turn off the use of system fonts.
*/
*/
private
Object
getDesktopFontValue
(
String
fontName
,
Object
backup
,
private
Object
getDesktopFontValue
(
String
fontName
,
Object
backup
)
{
Toolkit
kit
)
{
if
(
useSystemFontSettings
)
{
if
(
useSystemFontSettings
)
{
return
new
WindowsFontProperty
(
fontName
,
backup
,
kit
);
return
new
WindowsFontProperty
(
fontName
,
backup
);
}
}
return
null
;
return
null
;
}
}
...
@@ -1989,7 +1932,6 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -1989,7 +1932,6 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
public
void
uninitialize
()
{
public
void
uninitialize
()
{
super
.
uninitialize
();
super
.
uninitialize
();
toolkit
=
null
;
if
(
WindowsPopupMenuUI
.
mnemonicListener
!=
null
)
{
if
(
WindowsPopupMenuUI
.
mnemonicListener
!=
null
)
{
MenuSelectionManager
.
defaultManager
().
MenuSelectionManager
.
defaultManager
().
...
@@ -2309,8 +2251,8 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -2309,8 +2251,8 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
* is returned, it is mapped to 'Microsoft Sans Serif'.
* is returned, it is mapped to 'Microsoft Sans Serif'.
*/
*/
private
static
class
WindowsFontProperty
extends
DesktopProperty
{
private
static
class
WindowsFontProperty
extends
DesktopProperty
{
WindowsFontProperty
(
String
key
,
Object
backup
,
Toolkit
kit
)
{
WindowsFontProperty
(
String
key
,
Object
backup
)
{
super
(
key
,
backup
,
kit
);
super
(
key
,
backup
);
}
}
public
void
invalidate
(
LookAndFeel
laf
)
{
public
void
invalidate
(
LookAndFeel
laf
)
{
...
@@ -2372,9 +2314,9 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -2372,9 +2314,9 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
private
int
fontSize
;
private
int
fontSize
;
private
int
fontStyle
;
private
int
fontStyle
;
WindowsFontSizeProperty
(
String
key
,
Toolkit
toolkit
,
String
fontName
,
WindowsFontSizeProperty
(
String
key
,
String
fontName
,
int
fontStyle
,
int
fontSize
)
{
int
fontStyle
,
int
fontSize
)
{
super
(
key
,
null
,
toolkit
);
super
(
key
,
null
);
this
.
fontName
=
fontName
;
this
.
fontName
=
fontName
;
this
.
fontSize
=
fontSize
;
this
.
fontSize
=
fontSize
;
this
.
fontStyle
=
fontStyle
;
this
.
fontStyle
=
fontStyle
;
...
@@ -2508,7 +2450,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
...
@@ -2508,7 +2450,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
private
class
TriggerDesktopProperty
extends
DesktopProperty
{
private
class
TriggerDesktopProperty
extends
DesktopProperty
{
TriggerDesktopProperty
(
String
key
)
{
TriggerDesktopProperty
(
String
key
)
{
super
(
key
,
null
,
toolkit
);
super
(
key
,
null
);
// This call adds a property change listener for the property,
// This call adds a property change listener for the property,
// which triggers a call to updateUI(). The value returned
// which triggers a call to updateUI(). The value returned
// is not interesting here.
// is not interesting here.
...
...
src/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java
浏览文件 @
d58597e0
/*
/*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2001
-2009
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,8 +25,6 @@
...
@@ -25,8 +25,6 @@
package
javax.swing.plaf.metal
;
package
javax.swing.plaf.metal
;
import
java.awt.*
;
import
java.awt.*
;
import
java.beans.*
;
import
javax.swing.*
;
/**
/**
* DesktopProperty that only uses font height in configuring font. This
* DesktopProperty that only uses font height in configuring font. This
...
@@ -60,7 +58,7 @@ class MetalFontDesktopProperty extends com.sun.java.swing.plaf.windows.DesktopPr
...
@@ -60,7 +58,7 @@ class MetalFontDesktopProperty extends com.sun.java.swing.plaf.windows.DesktopPr
* @param type MetalTheme font type.
* @param type MetalTheme font type.
*/
*/
MetalFontDesktopProperty
(
int
type
)
{
MetalFontDesktopProperty
(
int
type
)
{
this
(
propertyMapping
[
type
],
Toolkit
.
getDefaultToolkit
(),
type
);
this
(
propertyMapping
[
type
],
type
);
}
}
/**
/**
...
@@ -72,8 +70,8 @@ class MetalFontDesktopProperty extends com.sun.java.swing.plaf.windows.DesktopPr
...
@@ -72,8 +70,8 @@ class MetalFontDesktopProperty extends com.sun.java.swing.plaf.windows.DesktopPr
* @param type Type of font being used, corresponds to MetalTheme font
* @param type Type of font being used, corresponds to MetalTheme font
* type.
* type.
*/
*/
MetalFontDesktopProperty
(
String
key
,
Toolkit
kit
,
int
type
)
{
MetalFontDesktopProperty
(
String
key
,
int
type
)
{
super
(
key
,
null
,
kit
);
super
(
key
,
null
);
this
.
type
=
type
;
this
.
type
=
type
;
}
}
...
...
src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
浏览文件 @
d58597e0
/*
/*
* Copyright 1998-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -1541,10 +1541,8 @@ public class MetalLookAndFeel extends BasicLookAndFeel
...
@@ -1541,10 +1541,8 @@ public class MetalLookAndFeel extends BasicLookAndFeel
table
.
putDefaults
(
defaults
);
table
.
putDefaults
(
defaults
);
if
(
isWindows
()
&&
useSystemFonts
()
&&
theme
.
isSystemTheme
())
{
if
(
isWindows
()
&&
useSystemFonts
()
&&
theme
.
isSystemTheme
())
{
Toolkit
kit
=
Toolkit
.
getDefaultToolkit
();
Object
messageFont
=
new
MetalFontDesktopProperty
(
Object
messageFont
=
new
MetalFontDesktopProperty
(
"win.messagebox.font.height"
,
kit
,
MetalTheme
.
"win.messagebox.font.height"
,
MetalTheme
.
CONTROL_TEXT_FONT
);
CONTROL_TEXT_FONT
);
defaults
=
new
Object
[]
{
defaults
=
new
Object
[]
{
"OptionPane.messageFont"
,
messageFont
,
"OptionPane.messageFont"
,
messageFont
,
...
...
test/com/sun/java/swing/plaf/windows/Test6824600.java
0 → 100644
浏览文件 @
d58597e0
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6824600
@summary OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
@author Pavel Porvatov
@run main Test6824600
*/
import
com.sun.java.swing.plaf.windows.DesktopProperty
;
import
java.awt.*
;
public
class
Test6824600
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Toolkit
toolkit
=
Toolkit
.
getDefaultToolkit
();
HackedDesktopProperty
desktopProperty
=
new
HackedDesktopProperty
(
"Button.background"
,
null
);
// Register listener in toolkit
desktopProperty
.
getValueFromDesktop
();
int
length
=
toolkit
.
getPropertyChangeListeners
().
length
;
// Make several invocations
desktopProperty
.
getValueFromDesktop
();
desktopProperty
.
getValueFromDesktop
();
desktopProperty
.
invalidate
();
desktopProperty
.
getValueFromDesktop
();
desktopProperty
.
getValueFromDesktop
();
if
(
length
!=
toolkit
.
getPropertyChangeListeners
().
length
)
{
throw
new
RuntimeException
(
"New listeners were added into Toolkit"
);
}
}
public
static
class
HackedDesktopProperty
extends
DesktopProperty
{
public
HackedDesktopProperty
(
String
key
,
Object
fallback
)
{
super
(
key
,
fallback
);
}
// Publish the method
public
Object
getValueFromDesktop
()
{
return
super
.
getValueFromDesktop
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录