Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
2a113c4a
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看板
提交
2a113c4a
编写于
7月 12, 2010
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
3403002c
2bce7f19
变更
37
展开全部
隐藏空白更改
内联
并排
Showing
37 changed file
with
1406 addition
and
606 deletion
+1406
-606
src/share/classes/com/sun/beans/finder/InstanceFinder.java
src/share/classes/com/sun/beans/finder/InstanceFinder.java
+3
-5
src/share/classes/com/sun/beans/finder/MethodFinder.java
src/share/classes/com/sun/beans/finder/MethodFinder.java
+2
-2
src/share/classes/com/sun/beans/finder/PersistenceDelegateFinder.java
...asses/com/sun/beans/finder/PersistenceDelegateFinder.java
+12
-7
src/share/classes/com/sun/beans/finder/PropertyEditorFinder.java
...re/classes/com/sun/beans/finder/PropertyEditorFinder.java
+9
-3
src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
...share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
+0
-4
src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java
...ses/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java
+5
-2
src/share/classes/java/beans/Encoder.java
src/share/classes/java/beans/Encoder.java
+3
-10
src/share/classes/java/beans/EventSetDescriptor.java
src/share/classes/java/beans/EventSetDescriptor.java
+4
-5
src/share/classes/java/beans/IndexedPropertyDescriptor.java
src/share/classes/java/beans/IndexedPropertyDescriptor.java
+3
-9
src/share/classes/java/beans/Introspector.java
src/share/classes/java/beans/Introspector.java
+31
-100
src/share/classes/java/beans/MethodDescriptor.java
src/share/classes/java/beans/MethodDescriptor.java
+4
-4
src/share/classes/java/beans/PropertyDescriptor.java
src/share/classes/java/beans/PropertyDescriptor.java
+4
-7
src/share/classes/java/beans/PropertyEditorManager.java
src/share/classes/java/beans/PropertyEditorManager.java
+5
-17
src/share/classes/javax/swing/JSplitPane.java
src/share/classes/javax/swing/JSplitPane.java
+12
-11
src/share/classes/javax/swing/JTable.java
src/share/classes/javax/swing/JTable.java
+3
-3
src/share/classes/javax/swing/JTree.java
src/share/classes/javax/swing/JTree.java
+7
-10
src/share/classes/javax/swing/border/TitledBorder.java
src/share/classes/javax/swing/border/TitledBorder.java
+331
-393
src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java
...e/classes/javax/swing/plaf/basic/BasicButtonListener.java
+1
-2
src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java
...re/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java
+1
-1
src/share/classes/javax/swing/plaf/nimbus/skin.laf
src/share/classes/javax/swing/plaf/nimbus/skin.laf
+1
-0
src/share/classes/sun/swing/SwingUtilities2.java
src/share/classes/sun/swing/SwingUtilities2.java
+5
-1
test/ProblemList.txt
test/ProblemList.txt
+0
-6
test/com/sun/java/swing/plaf/gtk/Test6635110.java
test/com/sun/java/swing/plaf/gtk/Test6635110.java
+6
-2
test/com/sun/java/swing/plaf/gtk/Test6963870.java
test/com/sun/java/swing/plaf/gtk/Test6963870.java
+72
-0
test/java/beans/Introspector/Test6707234.java
test/java/beans/Introspector/Test6707234.java
+52
-0
test/java/beans/Introspector/Test6963811.java
test/java/beans/Introspector/Test6963811.java
+78
-0
test/java/beans/PropertyEditor/Test6963811.java
test/java/beans/PropertyEditor/Test6963811.java
+83
-0
test/java/beans/XMLEncoder/Test6963811.java
test/java/beans/XMLEncoder/Test6963811.java
+84
-0
test/javax/swing/AbstractButton/6711682/bug6711682.java
test/javax/swing/AbstractButton/6711682/bug6711682.java
+151
-0
test/javax/swing/JFileChooser/6520101/bug6520101.java
test/javax/swing/JFileChooser/6520101/bug6520101.java
+104
-0
test/javax/swing/JInternalFrame/6725409/bug6725409.java
test/javax/swing/JInternalFrame/6725409/bug6725409.java
+2
-2
test/javax/swing/JPopupMenu/6495920/bug6495920.java
test/javax/swing/JPopupMenu/6495920/bug6495920.java
+112
-0
test/javax/swing/JTable/6777378/bug6777378.java
test/javax/swing/JTable/6777378/bug6777378.java
+88
-0
test/javax/swing/border/Test4129681.html
test/javax/swing/border/Test4129681.html
+10
-0
test/javax/swing/border/Test4129681.java
test/javax/swing/border/Test4129681.java
+59
-0
test/javax/swing/border/Test4760089.html
test/javax/swing/border/Test4760089.html
+10
-0
test/javax/swing/border/Test4760089.java
test/javax/swing/border/Test4760089.java
+49
-0
未找到文件。
src/share/classes/com/sun/beans/finder/InstanceFinder.java
浏览文件 @
2a113c4a
/*
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009,
2010,
Oracle and/or its affiliates. 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
...
@@ -39,7 +39,7 @@ class InstanceFinder<T> {
...
@@ -39,7 +39,7 @@ class InstanceFinder<T> {
private
final
Class
<?
extends
T
>
type
;
private
final
Class
<?
extends
T
>
type
;
private
final
boolean
allow
;
private
final
boolean
allow
;
private
final
String
suffix
;
private
final
String
suffix
;
private
String
[]
packages
;
private
volatile
String
[]
packages
;
InstanceFinder
(
Class
<?
extends
T
>
type
,
boolean
allow
,
String
suffix
,
String
...
packages
)
{
InstanceFinder
(
Class
<?
extends
T
>
type
,
boolean
allow
,
String
suffix
,
String
...
packages
)
{
this
.
type
=
type
;
this
.
type
=
type
;
...
@@ -49,9 +49,7 @@ class InstanceFinder<T> {
...
@@ -49,9 +49,7 @@ class InstanceFinder<T> {
}
}
public
String
[]
getPackages
()
{
public
String
[]
getPackages
()
{
return
(
this
.
packages
.
length
>
0
)
return
this
.
packages
.
clone
();
?
this
.
packages
.
clone
()
:
this
.
packages
;
}
}
public
void
setPackages
(
String
...
packages
)
{
public
void
setPackages
(
String
...
packages
)
{
...
...
src/share/classes/com/sun/beans/finder/MethodFinder.java
浏览文件 @
2a113c4a
/*
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008,
2010,
Oracle and/or its affiliates. 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
...
@@ -118,7 +118,7 @@ public final class MethodFinder extends AbstractFinder<Method> {
...
@@ -118,7 +118,7 @@ public final class MethodFinder extends AbstractFinder<Method> {
* @throws NoSuchMethodException if method is not accessible or is not found
* @throws NoSuchMethodException if method is not accessible or is not found
* in specified superclass or interface
* in specified superclass or interface
*/
*/
p
rivate
static
Method
findAccessibleMethod
(
Method
method
)
throws
NoSuchMethodException
{
p
ublic
static
Method
findAccessibleMethod
(
Method
method
)
throws
NoSuchMethodException
{
Class
<?>
type
=
method
.
getDeclaringClass
();
Class
<?>
type
=
method
.
getDeclaringClass
();
if
(
Modifier
.
isPublic
(
type
.
getModifiers
()))
{
if
(
Modifier
.
isPublic
(
type
.
getModifiers
()))
{
return
method
;
return
method
;
...
...
src/share/classes/com/sun/beans/finder/PersistenceDelegateFinder.java
浏览文件 @
2a113c4a
/*
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009,
2010,
Oracle and/or its affiliates. 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
...
@@ -47,17 +47,22 @@ public final class PersistenceDelegateFinder
...
@@ -47,17 +47,22 @@ public final class PersistenceDelegateFinder
}
}
public
void
register
(
Class
<?>
type
,
PersistenceDelegate
delegate
)
{
public
void
register
(
Class
<?>
type
,
PersistenceDelegate
delegate
)
{
if
(
delegate
!=
null
)
{
synchronized
(
this
.
registry
)
{
this
.
registry
.
put
(
type
,
delegate
);
if
(
delegate
!=
null
)
{
}
this
.
registry
.
put
(
type
,
delegate
);
else
{
}
this
.
registry
.
remove
(
type
);
else
{
this
.
registry
.
remove
(
type
);
}
}
}
}
}
@Override
@Override
public
PersistenceDelegate
find
(
Class
<?>
type
)
{
public
PersistenceDelegate
find
(
Class
<?>
type
)
{
PersistenceDelegate
delegate
=
this
.
registry
.
get
(
type
);
PersistenceDelegate
delegate
;
synchronized
(
this
.
registry
)
{
delegate
=
this
.
registry
.
get
(
type
);
}
return
(
delegate
!=
null
)
?
delegate
:
super
.
find
(
type
);
return
(
delegate
!=
null
)
?
delegate
:
super
.
find
(
type
);
}
}
}
}
src/share/classes/com/sun/beans/finder/PropertyEditorFinder.java
浏览文件 @
2a113c4a
/*
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009,
2010,
Oracle and/or its affiliates. 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
...
@@ -64,12 +64,18 @@ public final class PropertyEditorFinder
...
@@ -64,12 +64,18 @@ public final class PropertyEditorFinder
}
}
public
void
register
(
Class
<?>
type
,
Class
<?>
editor
)
{
public
void
register
(
Class
<?>
type
,
Class
<?>
editor
)
{
this
.
registry
.
put
(
type
,
editor
);
synchronized
(
this
.
registry
)
{
this
.
registry
.
put
(
type
,
editor
);
}
}
}
@Override
@Override
public
PropertyEditor
find
(
Class
<?>
type
)
{
public
PropertyEditor
find
(
Class
<?>
type
)
{
PropertyEditor
editor
=
instantiate
(
this
.
registry
.
get
(
type
),
null
);
Class
<?>
predefined
;
synchronized
(
this
.
registry
)
{
predefined
=
this
.
registry
.
get
(
type
);
}
PropertyEditor
editor
=
instantiate
(
predefined
,
null
);
if
(
editor
==
null
)
{
if
(
editor
==
null
)
{
editor
=
super
.
find
(
type
);
editor
=
super
.
find
(
type
);
if
((
editor
==
null
)
&&
(
null
!=
type
.
getEnumConstants
()))
{
if
((
editor
==
null
)
&&
(
null
!=
type
.
getEnumConstants
()))
{
...
...
src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
浏览文件 @
2a113c4a
...
@@ -1440,10 +1440,6 @@ class GTKPainter extends SynthPainter {
...
@@ -1440,10 +1440,6 @@ class GTKPainter extends SynthPainter {
}
}
}
}
public
Insets
getBorderInsets
(
Component
c
)
{
return
getBorderInsets
(
c
,
null
);
}
public
Insets
getBorderInsets
(
Component
c
,
Insets
i
)
{
public
Insets
getBorderInsets
(
Component
c
,
Insets
i
)
{
SynthContext
context
=
getContext
(
c
);
SynthContext
context
=
getContext
(
c
);
...
...
src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java
浏览文件 @
2a113c4a
/*
/*
* Copyright (c) 1997, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
10
, Oracle and/or its affiliates. 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
...
@@ -271,7 +271,9 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
...
@@ -271,7 +271,9 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
}
}
public
void
uninstallUI
(
JComponent
c
)
{
public
void
uninstallUI
(
JComponent
c
)
{
getFileChooser
().
removeAll
();
c
.
removePropertyChangeListener
(
filterComboBoxModel
);
approveButton
.
removeActionListener
(
getApproveSelectionAction
());
filenameTextField
.
removeActionListener
(
getApproveSelectionAction
());
super
.
uninstallUI
(
c
);
super
.
uninstallUI
(
c
);
}
}
...
@@ -515,6 +517,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
...
@@ -515,6 +517,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
public
void
uninstallComponents
(
JFileChooser
fc
)
{
public
void
uninstallComponents
(
JFileChooser
fc
)
{
fc
.
removeAll
();
fc
.
removeAll
();
bottomPanel
=
null
;
if
(
filterComboBoxModel
!=
null
)
{
if
(
filterComboBoxModel
!=
null
)
{
fc
.
removePropertyChangeListener
(
filterComboBoxModel
);
fc
.
removePropertyChangeListener
(
filterComboBoxModel
);
}
}
...
...
src/share/classes/java/beans/Encoder.java
浏览文件 @
2a113c4a
...
@@ -194,13 +194,8 @@ public class Encoder {
...
@@ -194,13 +194,8 @@ public class Encoder {
* @see java.beans.BeanInfo#getBeanDescriptor
* @see java.beans.BeanInfo#getBeanDescriptor
*/
*/
public
PersistenceDelegate
getPersistenceDelegate
(
Class
<?>
type
)
{
public
PersistenceDelegate
getPersistenceDelegate
(
Class
<?>
type
)
{
synchronized
(
this
.
finder
)
{
PersistenceDelegate
pd
=
this
.
finder
.
find
(
type
);
PersistenceDelegate
pd
=
this
.
finder
.
find
(
type
);
return
(
pd
!=
null
)
?
pd
:
MetaData
.
getPersistenceDelegate
(
type
);
if
(
pd
!=
null
)
{
return
pd
;
}
}
return
MetaData
.
getPersistenceDelegate
(
type
);
}
}
/**
/**
...
@@ -214,9 +209,7 @@ public class Encoder {
...
@@ -214,9 +209,7 @@ public class Encoder {
* @see java.beans.BeanInfo#getBeanDescriptor
* @see java.beans.BeanInfo#getBeanDescriptor
*/
*/
public
void
setPersistenceDelegate
(
Class
<?>
type
,
PersistenceDelegate
delegate
)
{
public
void
setPersistenceDelegate
(
Class
<?>
type
,
PersistenceDelegate
delegate
)
{
synchronized
(
this
.
finder
)
{
this
.
finder
.
register
(
type
,
delegate
);
this
.
finder
.
register
(
type
,
delegate
);
}
}
}
/**
/**
...
...
src/share/classes/java/beans/EventSetDescriptor.java
浏览文件 @
2a113c4a
...
@@ -27,6 +27,7 @@ package java.beans;
...
@@ -27,6 +27,7 @@ package java.beans;
import
java.lang.ref.Reference
;
import
java.lang.ref.Reference
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Modifier
;
/**
/**
* An EventSetDescriptor describes a group of events that a given Java
* An EventSetDescriptor describes a group of events that a given Java
...
@@ -175,10 +176,8 @@ public class EventSetDescriptor extends FeatureDescriptor {
...
@@ -175,10 +176,8 @@ public class EventSetDescriptor extends FeatureDescriptor {
setRemoveListenerMethod
(
getMethod
(
sourceClass
,
removeListenerMethodName
,
1
));
setRemoveListenerMethod
(
getMethod
(
sourceClass
,
removeListenerMethodName
,
1
));
// Be more forgiving of not finding the getListener method.
// Be more forgiving of not finding the getListener method.
Method
method
=
Introspector
.
findMethod
(
sourceClass
,
if
(
getListenerMethodName
!=
null
)
{
getListenerMethodName
,
0
);
setGetListenerMethod
(
Introspector
.
findInstanceMethod
(
sourceClass
,
getListenerMethodName
));
if
(
method
!=
null
)
{
setGetListenerMethod
(
method
);
}
}
}
}
...
@@ -188,7 +187,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
...
@@ -188,7 +187,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
return
null
;
return
null
;
}
}
Method
method
=
Introspector
.
findMethod
(
cls
,
name
,
args
);
Method
method
=
Introspector
.
findMethod
(
cls
,
name
,
args
);
if
(
method
==
null
)
{
if
(
(
method
==
null
)
||
Modifier
.
isStatic
(
method
.
getModifiers
())
)
{
throw
new
IntrospectionException
(
"Method not found: "
+
name
+
throw
new
IntrospectionException
(
"Method not found: "
+
name
+
" on class "
+
cls
.
getName
());
" on class "
+
cls
.
getName
());
}
}
...
...
src/share/classes/java/beans/IndexedPropertyDescriptor.java
浏览文件 @
2a113c4a
...
@@ -189,16 +189,11 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
...
@@ -189,16 +189,11 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
indexedReadMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
();
indexedReadMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
();
}
}
}
}
indexedReadMethod
=
Introspector
.
findInstanceMethod
(
cls
,
indexedReadMethodName
,
int
.
class
);
Class
[]
args
=
{
int
.
class
};
indexedReadMethod
=
Introspector
.
findMethod
(
cls
,
indexedReadMethodName
,
1
,
args
);
if
(
indexedReadMethod
==
null
)
{
if
(
indexedReadMethod
==
null
)
{
// no "is" method, so look for a "get" method.
// no "is" method, so look for a "get" method.
indexedReadMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
();
indexedReadMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
();
indexedReadMethod
=
Introspector
.
findMethod
(
cls
,
indexedReadMethodName
,
indexedReadMethod
=
Introspector
.
findInstanceMethod
(
cls
,
indexedReadMethodName
,
int
.
class
);
1
,
args
);
}
}
setIndexedReadMethod0
(
indexedReadMethod
);
setIndexedReadMethod0
(
indexedReadMethod
);
}
}
...
@@ -270,8 +265,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
...
@@ -270,8 +265,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
if
(
indexedWriteMethodName
==
null
)
{
if
(
indexedWriteMethodName
==
null
)
{
indexedWriteMethodName
=
Introspector
.
SET_PREFIX
+
getBaseName
();
indexedWriteMethodName
=
Introspector
.
SET_PREFIX
+
getBaseName
();
}
}
indexedWriteMethod
=
Introspector
.
findMethod
(
cls
,
indexedWriteMethodName
,
indexedWriteMethod
=
Introspector
.
findInstanceMethod
(
cls
,
indexedWriteMethodName
,
int
.
class
,
type
);
2
,
(
type
==
null
)
?
null
:
new
Class
[]
{
int
.
class
,
type
});
if
(
indexedWriteMethod
!=
null
)
{
if
(
indexedWriteMethod
!=
null
)
{
if
(!
indexedWriteMethod
.
getReturnType
().
equals
(
void
.
class
))
{
if
(!
indexedWriteMethod
.
getReturnType
().
equals
(
void
.
class
))
{
indexedWriteMethod
=
null
;
indexedWriteMethod
=
null
;
...
...
src/share/classes/java/beans/Introspector.java
浏览文件 @
2a113c4a
...
@@ -28,6 +28,7 @@ package java.beans;
...
@@ -28,6 +28,7 @@ package java.beans;
import
com.sun.beans.WeakCache
;
import
com.sun.beans.WeakCache
;
import
com.sun.beans.finder.BeanInfoFinder
;
import
com.sun.beans.finder.BeanInfoFinder
;
import
com.sun.beans.finder.ClassFinder
;
import
com.sun.beans.finder.ClassFinder
;
import
com.sun.beans.finder.MethodFinder
;
import
java.lang.ref.Reference
;
import
java.lang.ref.Reference
;
import
java.lang.ref.SoftReference
;
import
java.lang.ref.SoftReference
;
...
@@ -157,21 +158,23 @@ public class Introspector {
...
@@ -157,21 +158,23 @@ public class Introspector {
if
(!
ReflectUtil
.
isPackageAccessible
(
beanClass
))
{
if
(!
ReflectUtil
.
isPackageAccessible
(
beanClass
))
{
return
(
new
Introspector
(
beanClass
,
null
,
USE_ALL_BEANINFO
)).
getBeanInfo
();
return
(
new
Introspector
(
beanClass
,
null
,
USE_ALL_BEANINFO
)).
getBeanInfo
();
}
}
Map
<
Class
<?>,
BeanInfo
>
beanInfoCache
;
BeanInfo
beanInfo
;
synchronized
(
BEANINFO_CACHE
)
{
synchronized
(
BEANINFO_CACHE
)
{
Map
<
Class
<?>,
BeanInfo
>
beanInfoCache
=
beanInfoCache
=
(
Map
<
Class
<?>,
BeanInfo
>)
AppContext
.
getAppContext
().
get
(
BEANINFO_CACHE
);
(
Map
<
Class
<?>,
BeanInfo
>)
AppContext
.
getAppContext
().
get
(
BEANINFO_CACHE
);
if
(
beanInfoCache
==
null
)
{
if
(
beanInfoCache
==
null
)
{
beanInfoCache
=
new
WeakHashMap
<
Class
<?>,
BeanInfo
>();
beanInfoCache
=
new
WeakHashMap
<
Class
<?>,
BeanInfo
>();
AppContext
.
getAppContext
().
put
(
BEANINFO_CACHE
,
beanInfoCache
);
AppContext
.
getAppContext
().
put
(
BEANINFO_CACHE
,
beanInfoCache
);
}
}
BeanInfo
beanInfo
=
beanInfoCache
.
get
(
beanClass
);
beanInfo
=
beanInfoCache
.
get
(
beanClass
);
if
(
beanInfo
==
null
)
{
}
beanInfo
=
(
new
Introspector
(
beanClass
,
null
,
USE_ALL_BEANINFO
)).
getBeanInfo
();
if
(
beanInfo
==
null
)
{
beanInfo
=
new
Introspector
(
beanClass
,
null
,
USE_ALL_BEANINFO
).
getBeanInfo
();
synchronized
(
BEANINFO_CACHE
)
{
beanInfoCache
.
put
(
beanClass
,
beanInfo
);
beanInfoCache
.
put
(
beanClass
,
beanInfo
);
}
}
return
beanInfo
;
}
}
return
beanInfo
;
}
}
/**
/**
...
@@ -301,10 +304,7 @@ public class Introspector {
...
@@ -301,10 +304,7 @@ public class Introspector {
*/
*/
public
static
String
[]
getBeanInfoSearchPath
()
{
public
static
String
[]
getBeanInfoSearchPath
()
{
BeanInfoFinder
finder
=
getFinder
();
return
getFinder
().
getPackages
();
synchronized
(
finder
)
{
return
finder
.
getPackages
();
}
}
}
/**
/**
...
@@ -328,10 +328,7 @@ public class Introspector {
...
@@ -328,10 +328,7 @@ public class Introspector {
if
(
sm
!=
null
)
{
if
(
sm
!=
null
)
{
sm
.
checkPropertiesAccess
();
sm
.
checkPropertiesAccess
();
}
}
BeanInfoFinder
finder
=
getFinder
();
getFinder
().
setPackages
(
path
);
synchronized
(
finder
)
{
finder
.
setPackages
(
path
);
}
}
}
...
@@ -453,10 +450,7 @@ public class Introspector {
...
@@ -453,10 +450,7 @@ public class Introspector {
* @return Instance of an explicit BeanInfo class or null if one isn't found.
* @return Instance of an explicit BeanInfo class or null if one isn't found.
*/
*/
private
static
BeanInfo
findExplicitBeanInfo
(
Class
beanClass
)
{
private
static
BeanInfo
findExplicitBeanInfo
(
Class
beanClass
)
{
BeanInfoFinder
finder
=
getFinder
();
return
getFinder
().
find
(
beanClass
);
synchronized
(
finder
)
{
return
finder
.
find
(
beanClass
);
}
}
}
/**
/**
...
@@ -849,8 +843,8 @@ public class Introspector {
...
@@ -849,8 +843,8 @@ public class Introspector {
Method
read
=
result
.
getReadMethod
();
Method
read
=
result
.
getReadMethod
();
if
(
read
==
null
&&
write
!=
null
)
{
if
(
read
==
null
&&
write
!=
null
)
{
read
=
findMethod
(
result
.
getClass0
(),
read
=
find
Instance
Method
(
result
.
getClass0
(),
GET_PREFIX
+
NameGenerator
.
capitalize
(
result
.
getName
()),
0
);
GET_PREFIX
+
NameGenerator
.
capitalize
(
result
.
getName
())
);
if
(
read
!=
null
)
{
if
(
read
!=
null
)
{
try
{
try
{
result
.
setReadMethod
(
read
);
result
.
setReadMethod
(
read
);
...
@@ -860,9 +854,9 @@ public class Introspector {
...
@@ -860,9 +854,9 @@ public class Introspector {
}
}
}
}
if
(
write
==
null
&&
read
!=
null
)
{
if
(
write
==
null
&&
read
!=
null
)
{
write
=
findMethod
(
result
.
getClass0
(),
write
=
find
Instance
Method
(
result
.
getClass0
(),
SET_PREFIX
+
NameGenerator
.
capitalize
(
result
.
getName
()),
1
,
SET_PREFIX
+
NameGenerator
.
capitalize
(
result
.
getName
())
,
new
Class
[]
{
FeatureDescriptor
.
getReturnType
(
result
.
getClass0
(),
read
)
}
);
FeatureDescriptor
.
getReturnType
(
result
.
getClass0
(),
read
)
);
if
(
write
!=
null
)
{
if
(
write
!=
null
)
{
try
{
try
{
result
.
setWriteMethod
(
write
);
result
.
setWriteMethod
(
write
);
...
@@ -1286,90 +1280,27 @@ public class Introspector {
...
@@ -1286,90 +1280,27 @@ public class Introspector {
// Package private support methods.
// Package private support methods.
//======================================================================
//======================================================================
/**
static
Method
findMethod
(
Class
<?>
type
,
String
name
,
int
args
)
{
* Internal support for finding a target methodName with a given
for
(
Method
method
:
type
.
getMethods
())
{
* parameter list on a given class.
if
(
method
.
getName
().
equals
(
name
)
&&
(
args
==
method
.
getParameterTypes
().
length
))
{
*/
try
{
private
static
Method
internalFindMethod
(
Class
start
,
String
methodName
,
return
MethodFinder
.
findAccessibleMethod
(
method
);
int
argCount
,
Class
args
[])
{
// For overriden methods we need to find the most derived version.
// So we start with the given class and walk up the superclass chain.
Method
method
=
null
;
for
(
Class
cl
=
start
;
cl
!=
null
;
cl
=
cl
.
getSuperclass
())
{
Method
methods
[]
=
getPublicDeclaredMethods
(
cl
);
for
(
int
i
=
0
;
i
<
methods
.
length
;
i
++)
{
method
=
methods
[
i
];
if
(
method
==
null
)
{
continue
;
}
}
catch
(
NoSuchMethodException
exception
)
{
// make sure method signature matches.
// continue search for a method with the specified count of parameters
Class
params
[]
=
FeatureDescriptor
.
getParameterTypes
(
start
,
method
);
if
(
method
.
getName
().
equals
(
methodName
)
&&
params
.
length
==
argCount
)
{
if
(
args
!=
null
)
{
boolean
different
=
false
;
if
(
argCount
>
0
)
{
for
(
int
j
=
0
;
j
<
argCount
;
j
++)
{
if
(
params
[
j
]
!=
args
[
j
])
{
different
=
true
;
continue
;
}
}
if
(
different
)
{
continue
;
}
}
}
return
method
;
}
}
}
}
}
}
method
=
null
;
return
null
;
// Now check any inherited interfaces. This is necessary both when
// the argument class is itself an interface, and when the argument
// class is an abstract class.
Class
ifcs
[]
=
start
.
getInterfaces
();
for
(
int
i
=
0
;
i
<
ifcs
.
length
;
i
++)
{
// Note: The original implementation had both methods calling
// the 3 arg method. This is preserved but perhaps it should
// pass the args array instead of null.
method
=
internalFindMethod
(
ifcs
[
i
],
methodName
,
argCount
,
null
);
if
(
method
!=
null
)
{
break
;
}
}
return
method
;
}
/**
* Find a target methodName on a given class.
*/
static
Method
findMethod
(
Class
cls
,
String
methodName
,
int
argCount
)
{
return
findMethod
(
cls
,
methodName
,
argCount
,
null
);
}
}
/**
static
Method
findInstanceMethod
(
Class
<?>
type
,
String
name
,
Class
<?>...
args
)
{
* Find a target methodName with specific parameter list on a given class.
try
{
* <p>
return
MethodFinder
.
findInstanceMethod
(
type
,
name
,
args
);
* Used in the contructors of the EventSetDescriptor,
}
* PropertyDescriptor and the IndexedPropertyDescriptor.
catch
(
NoSuchMethodException
exception
)
{
* <p>
* @param cls The Class object on which to retrieve the method.
* @param methodName Name of the method.
* @param argCount Number of arguments for the desired method.
* @param args Array of argument types for the method.
* @return the method or null if not found
*/
static
Method
findMethod
(
Class
cls
,
String
methodName
,
int
argCount
,
Class
args
[])
{
if
(
methodName
==
null
)
{
return
null
;
return
null
;
}
}
return
internalFindMethod
(
cls
,
methodName
,
argCount
,
args
);
}
}
/**
/**
...
...
src/share/classes/java/beans/MethodDescriptor.java
浏览文件 @
2a113c4a
...
@@ -82,21 +82,21 @@ public class MethodDescriptor extends FeatureDescriptor {
...
@@ -82,21 +82,21 @@ public class MethodDescriptor extends FeatureDescriptor {
Method
method
=
getMethod0
();
Method
method
=
getMethod0
();
if
(
method
==
null
)
{
if
(
method
==
null
)
{
Class
cls
=
getClass0
();
Class
cls
=
getClass0
();
if
(
cls
!=
null
)
{
String
name
=
getName
();
if
((
cls
!=
null
)
&&
(
name
!=
null
))
{
Class
[]
params
=
getParams
();
Class
[]
params
=
getParams
();
if
(
params
==
null
)
{
if
(
params
==
null
)
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
// Find methods for up to 2 params. We are guessing here.
// Find methods for up to 2 params. We are guessing here.
// This block should never execute unless the classloader
// This block should never execute unless the classloader
// that loaded the argument classes disappears.
// that loaded the argument classes disappears.
method
=
Introspector
.
findMethod
(
cls
,
getName
(),
i
,
null
);
method
=
Introspector
.
findMethod
(
cls
,
name
,
i
);
if
(
method
!=
null
)
{
if
(
method
!=
null
)
{
break
;
break
;
}
}
}
}
}
else
{
}
else
{
method
=
Introspector
.
findMethod
(
cls
,
getName
(),
method
=
Statement
.
getMethod
(
cls
,
name
,
params
);
params
.
length
,
params
);
}
}
setMethod
(
method
);
setMethod
(
method
);
}
}
...
...
src/share/classes/java/beans/PropertyDescriptor.java
浏览文件 @
2a113c4a
...
@@ -112,9 +112,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
...
@@ -112,9 +112,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
// If this class or one of its base classes allow PropertyChangeListener,
// If this class or one of its base classes allow PropertyChangeListener,
// then we assume that any properties we discover are "bound".
// then we assume that any properties we discover are "bound".
// See Introspector.getTargetPropertyInfo() method.
// See Introspector.getTargetPropertyInfo() method.
String
name
=
"addPropertyChangeListener"
;
this
.
bound
=
null
!=
Introspector
.
findInstanceMethod
(
beanClass
,
"addPropertyChangeListener"
,
PropertyChangeListener
.
class
);
Class
[]
args
=
{
PropertyChangeListener
.
class
};
this
.
bound
=
(
null
!=
Introspector
.
findMethod
(
beanClass
,
name
,
args
.
length
,
args
));
}
}
/**
/**
...
@@ -225,10 +223,10 @@ public class PropertyDescriptor extends FeatureDescriptor {
...
@@ -225,10 +223,10 @@ public class PropertyDescriptor extends FeatureDescriptor {
// property type is. For booleans, there can be "is" and "get"
// property type is. For booleans, there can be "is" and "get"
// methods. If an "is" method exists, this is the official
// methods. If an "is" method exists, this is the official
// reader method so look for this one first.
// reader method so look for this one first.
readMethod
=
Introspector
.
find
Method
(
cls
,
readMethodName
,
0
);
readMethod
=
Introspector
.
find
InstanceMethod
(
cls
,
readMethodName
);
if
(
readMethod
==
null
)
{
if
(
readMethod
==
null
)
{
readMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
();
readMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
();
readMethod
=
Introspector
.
find
Method
(
cls
,
readMethodName
,
0
);
readMethod
=
Introspector
.
find
InstanceMethod
(
cls
,
readMethodName
);
}
}
try
{
try
{
setReadMethod
(
readMethod
);
setReadMethod
(
readMethod
);
...
@@ -293,8 +291,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
...
@@ -293,8 +291,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
writeMethodName
=
Introspector
.
SET_PREFIX
+
getBaseName
();
writeMethodName
=
Introspector
.
SET_PREFIX
+
getBaseName
();
}
}
writeMethod
=
Introspector
.
findMethod
(
cls
,
writeMethodName
,
1
,
writeMethod
=
Introspector
.
findInstanceMethod
(
cls
,
writeMethodName
,
type
);
(
type
==
null
)
?
null
:
new
Class
[]
{
type
});
if
(
writeMethod
!=
null
)
{
if
(
writeMethod
!=
null
)
{
if
(!
writeMethod
.
getReturnType
().
equals
(
void
.
class
))
{
if
(!
writeMethod
.
getReturnType
().
equals
(
void
.
class
))
{
writeMethod
=
null
;
writeMethod
=
null
;
...
...
src/share/classes/java/beans/PropertyEditorManager.java
浏览文件 @
2a113c4a
/*
/*
* Copyright (c) 1996, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 20
10
, Oracle and/or its affiliates. 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
...
@@ -81,10 +81,7 @@ public class PropertyEditorManager {
...
@@ -81,10 +81,7 @@ public class PropertyEditorManager {
if
(
sm
!=
null
)
{
if
(
sm
!=
null
)
{
sm
.
checkPropertiesAccess
();
sm
.
checkPropertiesAccess
();
}
}
PropertyEditorFinder
finder
=
getFinder
();
getFinder
().
register
(
targetType
,
editorClass
);
synchronized
(
finder
)
{
finder
.
register
(
targetType
,
editorClass
);
}
}
}
/**
/**
...
@@ -95,10 +92,7 @@ public class PropertyEditorManager {
...
@@ -95,10 +92,7 @@ public class PropertyEditorManager {
* The result is null if no suitable editor can be found.
* The result is null if no suitable editor can be found.
*/
*/
public
static
PropertyEditor
findEditor
(
Class
<?>
targetType
)
{
public
static
PropertyEditor
findEditor
(
Class
<?>
targetType
)
{
PropertyEditorFinder
finder
=
getFinder
();
return
getFinder
().
find
(
targetType
);
synchronized
(
finder
)
{
return
finder
.
find
(
targetType
);
}
}
}
/**
/**
...
@@ -110,10 +104,7 @@ public class PropertyEditorManager {
...
@@ -110,10 +104,7 @@ public class PropertyEditorManager {
* e.g. Sun implementation initially sets to {"sun.beans.editors"}.
* e.g. Sun implementation initially sets to {"sun.beans.editors"}.
*/
*/
public
static
String
[]
getEditorSearchPath
()
{
public
static
String
[]
getEditorSearchPath
()
{
PropertyEditorFinder
finder
=
getFinder
();
return
getFinder
().
getPackages
();
synchronized
(
finder
)
{
return
finder
.
getPackages
();
}
}
}
/**
/**
...
@@ -134,10 +125,7 @@ public class PropertyEditorManager {
...
@@ -134,10 +125,7 @@ public class PropertyEditorManager {
if
(
sm
!=
null
)
{
if
(
sm
!=
null
)
{
sm
.
checkPropertiesAccess
();
sm
.
checkPropertiesAccess
();
}
}
PropertyEditorFinder
finder
=
getFinder
();
getFinder
().
setPackages
(
path
);
synchronized
(
finder
)
{
finder
.
setPackages
(
path
);
}
}
}
private
static
PropertyEditorFinder
getFinder
()
{
private
static
PropertyEditorFinder
getFinder
()
{
...
...
src/share/classes/javax/swing/JSplitPane.java
浏览文件 @
2a113c4a
...
@@ -242,19 +242,19 @@ public class JSplitPane extends JComponent implements Accessible
...
@@ -242,19 +242,19 @@ public class JSplitPane extends JComponent implements Accessible
/**
/**
* Creates a new <code>JSplitPane</code> configured to arrange the child
* Creates a new <code>JSplitPane</code> configured to arrange the child
* components side-by-side horizontally with no continuous
* components side-by-side horizontally, using two buttons for the components.
* layout, using two buttons for the components.
*/
*/
public
JSplitPane
()
{
public
JSplitPane
()
{
this
(
JSplitPane
.
HORIZONTAL_SPLIT
,
false
,
this
(
JSplitPane
.
HORIZONTAL_SPLIT
,
new
JButton
(
UIManager
.
getString
(
"SplitPane.leftButtonText"
)),
UIManager
.
getBoolean
(
"SplitPane.continuousLayout"
),
new
JButton
(
UIManager
.
getString
(
"SplitPane.rightButtonText"
)));
new
JButton
(
UIManager
.
getString
(
"SplitPane.leftButtonText"
)),
new
JButton
(
UIManager
.
getString
(
"SplitPane.rightButtonText"
)));
}
}
/**
/**
* Creates a new <code>JSplitPane</code> configured with the
* Creates a new <code>JSplitPane</code> configured with the
* specified orientation
and no continuous layout
.
* specified orientation.
*
*
* @param newOrientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or
* @param newOrientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or
* <code>JSplitPane.VERTICAL_SPLIT</code>
* <code>JSplitPane.VERTICAL_SPLIT</code>
...
@@ -263,7 +263,8 @@ public class JSplitPane extends JComponent implements Accessible
...
@@ -263,7 +263,8 @@ public class JSplitPane extends JComponent implements Accessible
*/
*/
@ConstructorProperties
({
"orientation"
})
@ConstructorProperties
({
"orientation"
})
public
JSplitPane
(
int
newOrientation
)
{
public
JSplitPane
(
int
newOrientation
)
{
this
(
newOrientation
,
false
);
this
(
newOrientation
,
UIManager
.
getBoolean
(
"SplitPane.continuousLayout"
));
}
}
...
@@ -287,9 +288,7 @@ public class JSplitPane extends JComponent implements Accessible
...
@@ -287,9 +288,7 @@ public class JSplitPane extends JComponent implements Accessible
/**
/**
* Creates a new <code>JSplitPane</code> with the specified
* Creates a new <code>JSplitPane</code> with the specified
* orientation and
* orientation and the specified components.
* with the specified components that do not do continuous
* redrawing.
*
*
* @param newOrientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or
* @param newOrientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or
* <code>JSplitPane.VERTICAL_SPLIT</code>
* <code>JSplitPane.VERTICAL_SPLIT</code>
...
@@ -307,7 +306,9 @@ public class JSplitPane extends JComponent implements Accessible
...
@@ -307,7 +306,9 @@ public class JSplitPane extends JComponent implements Accessible
public
JSplitPane
(
int
newOrientation
,
public
JSplitPane
(
int
newOrientation
,
Component
newLeftComponent
,
Component
newLeftComponent
,
Component
newRightComponent
){
Component
newRightComponent
){
this
(
newOrientation
,
false
,
newLeftComponent
,
newRightComponent
);
this
(
newOrientation
,
UIManager
.
getBoolean
(
"SplitPane.continuousLayout"
),
newLeftComponent
,
newRightComponent
);
}
}
...
...
src/share/classes/javax/swing/JTable.java
浏览文件 @
2a113c4a
...
@@ -1048,7 +1048,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
...
@@ -1048,7 +1048,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
/**
/**
* Returns the horizontal and vertical space between cells.
* Returns the horizontal and vertical space between cells.
* The default spacing is
(1, 1), which provides room to draw the grid
.
* The default spacing is
look and feel dependent
.
*
*
* @return the horizontal and vertical spacing between cells
* @return the horizontal and vertical spacing between cells
* @see #setIntercellSpacing
* @see #setIntercellSpacing
...
@@ -1155,7 +1155,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
...
@@ -1155,7 +1155,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
/**
/**
* Returns true if the table draws horizontal lines between cells, false if it
* Returns true if the table draws horizontal lines between cells, false if it
* doesn't. The default
is true
.
* doesn't. The default
value is look and feel dependent
.
*
*
* @return true if the table draws horizontal lines between cells, false if it
* @return true if the table draws horizontal lines between cells, false if it
* doesn't
* doesn't
...
@@ -1167,7 +1167,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
...
@@ -1167,7 +1167,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
/**
/**
* Returns true if the table draws vertical lines between cells, false if it
* Returns true if the table draws vertical lines between cells, false if it
* doesn't. The default
is true
.
* doesn't. The default
value is look and feel dependent
.
*
*
* @return true if the table draws vertical lines between cells, false if it
* @return true if the table draws vertical lines between cells, false if it
* doesn't
* doesn't
...
...
src/share/classes/javax/swing/JTree.java
浏览文件 @
2a113c4a
...
@@ -1986,20 +1986,17 @@ public class JTree extends JComponent implements Scrollable, Accessible
...
@@ -1986,20 +1986,17 @@ public class JTree extends JComponent implements Scrollable, Accessible
* true if all nodes in the path are expanded
* true if all nodes in the path are expanded
*/
*/
public
boolean
isExpanded
(
TreePath
path
)
{
public
boolean
isExpanded
(
TreePath
path
)
{
if
(
path
==
null
)
return
false
;
// Is this node expanded?
Boolean
value
=
expandedState
.
get
(
path
);
if
(
value
==
null
||
!
value
.
booleanValue
()
)
if
(
path
==
null
)
return
false
;
return
false
;
Object
value
;
// It is, make sure its parent is also expanded.
do
{
TreePath
parentPath
=
path
.
getParentPath
();
value
=
expandedState
.
get
(
path
);
if
(
value
==
null
||
!((
Boolean
)
value
).
booleanValue
())
return
false
;
}
while
(
(
path
=
path
.
getParentPath
())!=
null
);
if
(
parentPath
!=
null
)
return
isExpanded
(
parentPath
);
return
true
;
return
true
;
}
}
...
...
src/share/classes/javax/swing/border/TitledBorder.java
浏览文件 @
2a113c4a
此差异已折叠。
点击以展开。
src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java
浏览文件 @
2a113c4a
...
@@ -195,9 +195,8 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener,
...
@@ -195,9 +195,8 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener,
}
}
ButtonModel
model
=
b
.
getModel
();
ButtonModel
model
=
b
.
getModel
();
model
.
setArmed
(
false
);
model
.
setPressed
(
false
);
model
.
setPressed
(
false
);
model
.
setArmed
(
false
);
b
.
repaint
();
b
.
repaint
();
}
}
...
...
src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java
浏览文件 @
2a113c4a
...
@@ -876,7 +876,7 @@ public class BasicTableHeaderUI extends TableHeaderUI {
...
@@ -876,7 +876,7 @@ public class BasicTableHeaderUI extends TableHeaderUI {
String
name
=
getName
();
String
name
=
getName
();
if
(
TOGGLE_SORT_ORDER
==
name
)
{
if
(
TOGGLE_SORT_ORDER
==
name
)
{
JTable
table
=
th
.
getTable
();
JTable
table
=
th
.
getTable
();
RowSorter
sorter
=
table
.
getRowSorter
();
RowSorter
sorter
=
table
==
null
?
null
:
table
.
getRowSorter
();
if
(
sorter
!=
null
)
{
if
(
sorter
!=
null
)
{
int
columnIndex
=
ui
.
getSelectedColumnIndex
();
int
columnIndex
=
ui
.
getSelectedColumnIndex
();
columnIndex
=
table
.
convertColumnIndexToModel
(
columnIndex
=
table
.
convertColumnIndexToModel
(
...
...
src/share/classes/javax/swing/plaf/nimbus/skin.laf
浏览文件 @
2a113c4a
...
@@ -21276,6 +21276,7 @@
...
@@ -21276,6 +21276,7 @@
<uiProperty name="centerOneTouchButtons" type="BOOLEAN" value="true"/>
<uiProperty name="centerOneTouchButtons" type="BOOLEAN" value="true"/>
<uiProperty name="oneTouchButtonOffset" type="INT" value="30"/>
<uiProperty name="oneTouchButtonOffset" type="INT" value="30"/>
<uiProperty name="oneTouchExpandable" type="BOOLEAN" value="false"/>
<uiProperty name="oneTouchExpandable" type="BOOLEAN" value="false"/>
<uiProperty name="continuousLayout" type="BOOLEAN" value="true"/>
</uiproperties>
</uiproperties>
</style>
</style>
<backgroundStates>
<backgroundStates>
src/share/classes/sun/swing/SwingUtilities2.java
浏览文件 @
2a113c4a
...
@@ -438,8 +438,12 @@ public class SwingUtilities2 {
...
@@ -438,8 +438,12 @@ public class SwingUtilities2 {
// c may be null here.
// c may be null here.
String
clipString
=
"..."
;
String
clipString
=
"..."
;
availTextWidth
-=
SwingUtilities2
.
stringWidth
(
c
,
fm
,
clipString
);
availTextWidth
-=
SwingUtilities2
.
stringWidth
(
c
,
fm
,
clipString
);
boolean
needsTextLayout
;
if
(
availTextWidth
<=
0
)
{
//can not fit any characters
return
clipString
;
}
boolean
needsTextLayout
;
synchronized
(
charsBufferLock
)
{
synchronized
(
charsBufferLock
)
{
int
stringLength
=
syncCharsBuffer
(
string
);
int
stringLength
=
syncCharsBuffer
(
string
);
needsTextLayout
=
needsTextLayout
=
...
...
test/ProblemList.txt
浏览文件 @
2a113c4a
...
@@ -295,9 +295,6 @@ java/math/BigInteger/ModPow65537.java generic-all
...
@@ -295,9 +295,6 @@ java/math/BigInteger/ModPow65537.java generic-all
# jdk_misc
# jdk_misc
# On Windows com.sun.java.swing.plaf.gtk does not exist, always fails there
com/sun/java/swing/plaf/gtk/Test6635110.java windows-all
# Need to be marked othervm, or changed to be samevm safe
# Need to be marked othervm, or changed to be samevm safe
com/sun/jndi/ldap/ReadTimeoutTest.java generic-all
com/sun/jndi/ldap/ReadTimeoutTest.java generic-all
com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java generic-all
com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java generic-all
...
@@ -848,9 +845,6 @@ sun/security/tools/keytool/selfissued.sh solaris-all
...
@@ -848,9 +845,6 @@ sun/security/tools/keytool/selfissued.sh solaris-all
# jdk_swing (not using samevm)
# jdk_swing (not using samevm)
# Fails on solaris 10 sparc, throws RuntimeException that just says "failed"
javax/swing/JLabel/6501991/bug6501991.java generic-all
# Fails on solaris 11 i586, with othervm
# Fails on solaris 11 i586, with othervm
javax/swing/JFileChooser/6570445/bug6570445.java generic-all
javax/swing/JFileChooser/6570445/bug6570445.java generic-all
javax/swing/JFileChooser/6738668/bug6738668.java generic-all
javax/swing/JFileChooser/6738668/bug6738668.java generic-all
...
...
test/com/sun/java/swing/plaf/gtk/Test6635110.java
浏览文件 @
2a113c4a
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
@run main Test6635110
@run main Test6635110
*/
*/
import
com.sun.java.swing.plaf.gtk.GTKLookAndFeel
;
import
javax.swing.*
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
...
@@ -59,7 +58,12 @@ public class Test6635110 implements Runnable {
...
@@ -59,7 +58,12 @@ public class Test6635110 implements Runnable {
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
UIManager
.
setLookAndFeel
(
new
GTKLookAndFeel
());
try
{
UIManager
.
setLookAndFeel
(
"com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"GTKLookAndFeel cannot be set, skipping this test"
);
return
;
}
SwingUtilities
.
invokeAndWait
(
new
Test6635110
());
SwingUtilities
.
invokeAndWait
(
new
Test6635110
());
}
}
}
}
test/com/sun/java/swing/plaf/gtk/Test6963870.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 6963870
@summary Tests that GTKPainter.ListTableFocusBorder.getBorderInsets()
doesn't return null
@author Peter Zhelezniakov
@run main Test6963870
*/
import
java.awt.Insets
;
import
javax.swing.SwingUtilities
;
import
javax.swing.UIManager
;
import
javax.swing.border.Border
;
public
class
Test6963870
implements
Runnable
{
final
static
String
[]
UI_NAMES
=
{
"List.focusCellHighlightBorder"
,
"List.focusSelectedCellHighlightBorder"
,
"List.noFocusBorder"
,
"Table.focusCellHighlightBorder"
,
"Table.focusSelectedCellHighlightBorder"
,
};
public
void
run
()
{
for
(
String
uiName:
UI_NAMES
)
{
test
(
uiName
);
}
}
void
test
(
String
uiName
)
{
Border
b
=
UIManager
.
getBorder
(
uiName
);
Insets
i
=
b
.
getBorderInsets
(
null
);
if
(
i
==
null
)
{
throw
new
RuntimeException
(
"getBorderInsets() returns null for "
+
uiName
);
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
try
{
UIManager
.
setLookAndFeel
(
"com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"GTKLookAndFeel cannot be set, skipping this test"
);
return
;
}
SwingUtilities
.
invokeAndWait
(
new
Test6963870
());
}
}
test/java/beans/Introspector/Test6707234.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6707234
* @summary Tests setter in a complex bean
* @author Sergey Malenkov
*/
public
class
Test6707234
{
public
static
void
main
(
String
[]
args
)
{
if
(
null
==
BeanUtils
.
getPropertyDescriptor
(
C
.
class
,
"number"
).
getWriteMethod
())
{
throw
new
Error
(
"no write method"
);
}
}
public
interface
I
{
void
setNumber
(
Object
number
);
Number
getNumber
();
}
public
class
C
implements
I
{
public
void
setNumber
(
Object
value
)
{
}
public
void
setNumber
(
Long
value
)
{
}
public
Long
getNumber
()
{
return
null
;
}
}
}
test/java/beans/Introspector/Test6963811.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6963811
* @summary Tests deadlock in Introspector
* @author Sergey Malenkov
*/
import
java.beans.Introspector
;
import
java.beans.SimpleBeanInfo
;
public
class
Test6963811
implements
Runnable
{
private
final
long
time
;
private
final
boolean
sync
;
public
Test6963811
(
long
time
,
boolean
sync
)
{
this
.
time
=
time
;
this
.
sync
=
sync
;
}
public
void
run
()
{
try
{
Thread
.
sleep
(
this
.
time
);
// increase the chance of the deadlock
Introspector
.
getBeanInfo
(
this
.
sync
?
Super
.
class
:
Sub
.
class
,
this
.
sync
?
null
:
Object
.
class
);
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Thread
[]
threads
=
new
Thread
[
2
];
for
(
int
i
=
0
;
i
<
threads
.
length
;
i
++)
{
threads
[
i
]
=
new
Thread
(
new
Test6963811
(
0L
,
i
>
0
));
threads
[
i
].
start
();
Thread
.
sleep
(
500L
);
// increase the chance of the deadlock
}
for
(
Thread
thread
:
threads
)
{
thread
.
join
();
}
}
public
static
class
Super
{
}
public
static
class
Sub
extends
Super
{
}
public
static
class
SubBeanInfo
extends
SimpleBeanInfo
{
public
SubBeanInfo
()
{
new
Test6963811
(
1000L
,
true
).
run
();
}
}
}
test/java/beans/PropertyEditor/Test6963811.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6963811
* @summary Tests deadlock in PropertyEditorManager
* @author Sergey Malenkov
*/
import
java.beans.PropertyEditorManager
;
import
sun.beans.editors.StringEditor
;
public
class
Test6963811
implements
Runnable
{
private
final
long
time
;
private
final
boolean
sync
;
public
Test6963811
(
long
time
,
boolean
sync
)
{
this
.
time
=
time
;
this
.
sync
=
sync
;
}
public
void
run
()
{
try
{
Thread
.
sleep
(
this
.
time
);
// increase the chance of the deadlock
if
(
this
.
sync
)
{
synchronized
(
Test6963811
.
class
)
{
PropertyEditorManager
.
findEditor
(
Super
.
class
);
}
}
else
{
PropertyEditorManager
.
findEditor
(
Sub
.
class
);
}
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Thread
[]
threads
=
new
Thread
[
2
];
for
(
int
i
=
0
;
i
<
threads
.
length
;
i
++)
{
threads
[
i
]
=
new
Thread
(
new
Test6963811
(
0L
,
i
>
0
));
threads
[
i
].
start
();
Thread
.
sleep
(
500L
);
// increase the chance of the deadlock
}
for
(
Thread
thread
:
threads
)
{
thread
.
join
();
}
}
public
static
class
Super
{
}
public
static
class
Sub
extends
Super
{
}
public
static
class
SubEditor
extends
StringEditor
{
public
SubEditor
()
{
new
Test6963811
(
1000L
,
true
).
run
();
}
}
}
test/java/beans/XMLEncoder/Test6963811.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6963811
* @summary Tests deadlock in Encoder
* @author Sergey Malenkov
*/
import
java.beans.Encoder
;
import
java.beans.DefaultPersistenceDelegate
;
public
class
Test6963811
implements
Runnable
{
private
static
final
Encoder
ENCODER
=
new
Encoder
();
private
final
long
time
;
private
final
boolean
sync
;
public
Test6963811
(
long
time
,
boolean
sync
)
{
this
.
time
=
time
;
this
.
sync
=
sync
;
}
public
void
run
()
{
try
{
Thread
.
sleep
(
this
.
time
);
// increase the chance of the deadlock
if
(
this
.
sync
)
{
synchronized
(
Test6963811
.
class
)
{
ENCODER
.
getPersistenceDelegate
(
Super
.
class
);
}
}
else
{
ENCODER
.
getPersistenceDelegate
(
Sub
.
class
);
}
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Thread
[]
threads
=
new
Thread
[
2
];
for
(
int
i
=
0
;
i
<
threads
.
length
;
i
++)
{
threads
[
i
]
=
new
Thread
(
new
Test6963811
(
0L
,
i
>
0
));
threads
[
i
].
start
();
Thread
.
sleep
(
500L
);
// increase the chance of the deadlock
}
for
(
Thread
thread
:
threads
)
{
thread
.
join
();
}
}
public
static
class
Super
{
}
public
static
class
Sub
extends
Super
{
}
public
static
class
SubPersistenceDelegate
extends
DefaultPersistenceDelegate
{
public
SubPersistenceDelegate
()
{
new
Test6963811
(
1000L
,
true
).
run
();
}
}
}
test/javax/swing/AbstractButton/6711682/bug6711682.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2009, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 6711682
@summary JCheckBox in JTable: checkbox doesn't alaways respond to the first mouse click
@author Alexander Potochkin
@run main bug6711682
*/
import
sun.awt.SunToolkit
;
import
javax.swing.*
;
import
javax.swing.event.CellEditorListener
;
import
javax.swing.table.TableCellEditor
;
import
javax.swing.table.TableCellRenderer
;
import
java.awt.*
;
import
java.awt.event.InputEvent
;
import
java.awt.event.KeyEvent
;
import
java.util.EventObject
;
public
class
bug6711682
{
private
static
JCheckBox
editorCb
;
private
static
JCheckBox
rendererCb
;
private
static
JTable
table
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
50
);
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
createAndShowGUI
();
}
});
toolkit
.
realSync
();
Point
l
=
table
.
getLocationOnScreen
();
int
h
=
table
.
getRowHeight
();
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
robot
.
mouseMove
(
l
.
x
+
5
,
l
.
y
+
5
+
i
*
h
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
}
// Without pressing F2 the last table's cell
// reported <code>false</code> value
// note that I can't press it inside the for loop
// because it doesn't reproduce the bug
robot
.
keyPress
(
KeyEvent
.
VK_F2
);
robot
.
keyRelease
(
KeyEvent
.
VK_F2
);
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
if
(!
Boolean
.
TRUE
.
equals
(
table
.
getValueAt
(
i
,
0
)))
{
throw
new
RuntimeException
(
"Row #"
+
i
+
" checkbox is not selected"
);
}
}
for
(
int
i
=
2
;
i
>=
0
;
i
--)
{
robot
.
mouseMove
(
l
.
x
+
5
,
l
.
y
+
5
+
i
*
h
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
}
robot
.
keyPress
(
KeyEvent
.
VK_F2
);
robot
.
keyRelease
(
KeyEvent
.
VK_F2
);
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
if
(
Boolean
.
TRUE
.
equals
(
table
.
getValueAt
(
i
,
0
)))
{
throw
new
RuntimeException
(
"Row #"
+
i
+
" checkbox is selected"
);
}
}
}
private
static
void
createAndShowGUI
()
{
editorCb
=
new
JCheckBox
();
rendererCb
=
new
JCheckBox
();
JFrame
f
=
new
JFrame
(
"Table with CheckBox"
);
Container
p
=
f
.
getContentPane
();
p
.
setLayout
(
new
BorderLayout
());
table
=
new
JTable
(
new
Object
[][]{{
false
},
{
false
},
{
false
}},
new
Object
[]{
"CheckBox"
});
TableCellEditor
editor
=
new
TableCellEditor
()
{
int
editedRow
;
public
Component
getTableCellEditorComponent
(
JTable
table
,
Object
value
,
boolean
isSelected
,
int
row
,
int
column
)
{
this
.
editedRow
=
row
;
editorCb
.
setSelected
(
Boolean
.
TRUE
.
equals
(
value
));
editorCb
.
setBackground
(
UIManager
.
getColor
(
"Table.selectionBackground"
));
return
editorCb
;
}
public
void
addCellEditorListener
(
CellEditorListener
l
)
{
}
public
void
cancelCellEditing
()
{
}
public
Object
getCellEditorValue
()
{
return
editorCb
.
isSelected
();
}
public
boolean
isCellEditable
(
EventObject
anEvent
)
{
return
true
;
}
public
void
removeCellEditorListener
(
CellEditorListener
l
)
{
}
public
boolean
shouldSelectCell
(
EventObject
anEvent
)
{
return
true
;
}
public
boolean
stopCellEditing
()
{
table
.
getModel
().
setValueAt
(
editorCb
.
isSelected
(),
editedRow
,
0
);
return
true
;
}
};
table
.
getColumnModel
().
getColumn
(
0
).
setCellEditor
(
editor
);
TableCellRenderer
renderer
=
new
TableCellRenderer
()
{
public
Component
getTableCellRendererComponent
(
JTable
table
,
Object
value
,
boolean
isSelected
,
boolean
hasFocus
,
int
row
,
int
column
)
{
rendererCb
.
setSelected
(
Boolean
.
TRUE
.
equals
(
value
));
return
rendererCb
;
}
};
table
.
getColumnModel
().
getColumn
(
0
).
setCellRenderer
(
renderer
);
p
.
add
(
table
,
BorderLayout
.
CENTER
);
f
.
pack
();
f
.
setVisible
(
true
);
}
}
test/javax/swing/JFileChooser/6520101/bug6520101.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test @(#)bug6520101
* @bug 6520101
* @summary JFileChooser throws OOM in 1.4.2, 5.0u4 and 1.6.0
* @author Praveen Gupta
* @run main/othervm/timeout=600 -Xmx8m -verify bug6520101
*/
import
javax.swing.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
public
class
bug6520101
implements
Runnable
{
private
static
final
int
ATTEMPTS
=
500
;
private
static
final
int
INTERVAL
=
100
;
private
static
final
boolean
ALWAYS_NEW_INSTANCE
=
false
;
private
static
final
boolean
DO_GC_EACH_INTERVAL
=
false
;
private
static
final
boolean
UPDATE_UI_EACH_INTERVAL
=
true
;
private
static
final
boolean
AUTO_CLOSE_DIALOG
=
true
;
private
static
JFileChooser
CHOOSER
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
UIManager
.
setLookAndFeel
(
"com.sun.java.swing.plaf.motif.MotifLookAndFeel"
);
for
(
int
i
=
0
;
i
<
ATTEMPTS
;
i
++)
{
doAttempt
();
}
System
.
out
.
println
(
"Test passed successfully"
);
}
private
static
void
doAttempt
()
throws
InterruptedException
{
if
(
ALWAYS_NEW_INSTANCE
||
(
CHOOSER
==
null
))
CHOOSER
=
new
JFileChooser
(
"."
);
if
(
UPDATE_UI_EACH_INTERVAL
)
{
CHOOSER
.
updateUI
();
}
if
(
AUTO_CLOSE_DIALOG
)
{
Thread
t
=
new
Thread
(
new
bug6520101
(
CHOOSER
));
t
.
start
();
CHOOSER
.
showOpenDialog
(
null
);
t
.
join
();
}
else
{
CHOOSER
.
showOpenDialog
(
null
);
}
if
(
DO_GC_EACH_INTERVAL
)
{
System
.
gc
();
}
}
private
final
JFileChooser
chooser
;
bug6520101
(
JFileChooser
chooser
)
{
this
.
chooser
=
chooser
;
}
public
void
run
()
{
while
(!
this
.
chooser
.
isShowing
())
{
try
{
Thread
.
sleep
(
30
);
}
catch
(
InterruptedException
exception
)
{
exception
.
printStackTrace
();
}
}
Timer
timer
=
new
Timer
(
INTERVAL
,
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
e
)
{
chooser
.
cancelSelection
();
}
});
timer
.
setRepeats
(
false
);
timer
.
start
();
}
}
test/javax/swing/JInternalFrame/6725409/bug6725409.java
浏览文件 @
2a113c4a
/*
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008,
2010,
Oracle and/or its affiliates. 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
...
@@ -43,7 +43,7 @@ public class bug6725409 {
...
@@ -43,7 +43,7 @@ public class bug6725409 {
new
com
.
sun
.
java
.
swing
.
plaf
.
windows
.
WindowsClassicLookAndFeel
());
new
com
.
sun
.
java
.
swing
.
plaf
.
windows
.
WindowsClassicLookAndFeel
());
}
catch
(
UnsupportedLookAndFeelException
e
)
{
}
catch
(
UnsupportedLookAndFeelException
e
)
{
System
.
out
.
println
(
"The test is for Windows LaF only"
);
System
.
out
.
println
(
"The test is for Windows LaF only"
);
System
.
exit
(
0
)
;
return
;
}
}
final
bug6725409
bug6725409
=
new
bug6725409
();
final
bug6725409
bug6725409
=
new
bug6725409
();
...
...
test/javax/swing/JPopupMenu/6495920/bug6495920.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6495920
* @summary Tests that if the JPopupMenu.setVisible method throws an exception,
interaction with GNOME is not crippled
* @author Sergey Malenkov
* @library ../..
*/
import
sun.awt.AppContext
;
import
java.awt.Point
;
import
java.awt.Robot
;
import
java.awt.event.InputEvent
;
import
java.lang.reflect.Field
;
import
javax.swing.JFrame
;
import
javax.swing.JMenuItem
;
import
javax.swing.JPanel
;
import
javax.swing.JPopupMenu
;
import
javax.swing.SwingUtilities
;
import
javax.swing.plaf.basic.BasicPopupMenuUI
;
public
class
bug6495920
implements
Thread
.
UncaughtExceptionHandler
{
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
SwingTest
.
start
(
bug6495920
.
class
);
}
private
static
Robot
robot
;
private
final
JPanel
panel
;
public
bug6495920
(
JFrame
frame
)
{
JPopupMenu
menu
=
new
JPopupMenu
()
{
public
void
setVisible
(
boolean
visible
)
{
super
.
setVisible
(
visible
);
throw
new
AssertionError
(
visible
?
"show popup"
:
"hide popup"
);
}
};
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
menu
.
add
(
new
JMenuItem
(
String
.
valueOf
(
i
)));
}
this
.
panel
=
new
JPanel
();
this
.
panel
.
setComponentPopupMenu
(
menu
);
frame
.
add
(
this
.
panel
);
}
public
void
firstShowPopup
()
throws
Exception
{
Point
point
=
this
.
panel
.
getLocation
();
SwingUtilities
.
convertPointToScreen
(
point
,
this
.
panel
);
robot
=
new
Robot
();
// initialize shared static field first time
robot
.
mouseMove
(
point
.
x
+
1
,
point
.
y
+
1
);
robot
.
mousePress
(
InputEvent
.
BUTTON3_MASK
);
Thread
.
currentThread
().
setUncaughtExceptionHandler
(
this
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON3_MASK
);
// causes first AssertionError on EDT
}
public
void
secondHidePopup
()
{
Point
point
=
this
.
panel
.
getLocation
();
SwingUtilities
.
convertPointToScreen
(
point
,
this
.
panel
);
robot
.
mouseMove
(
point
.
x
-
1
,
point
.
y
-
1
);
Thread
.
currentThread
().
setUncaughtExceptionHandler
(
this
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
// causes second AssertionError on EDT
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
}
public
void
thirdValidate
()
throws
Exception
{
Field
key
=
BasicPopupMenuUI
.
class
.
getDeclaredField
(
"MOUSE_GRABBER_KEY"
);
key
.
setAccessible
(
true
);
Object
grabber
=
AppContext
.
getAppContext
().
get
(
key
.
get
(
null
));
if
(
grabber
==
null
)
{
throw
new
Exception
(
"cannot find a mouse grabber in app's context"
);
}
Field
field
=
grabber
.
getClass
().
getDeclaredField
(
"grabbedWindow"
);
field
.
setAccessible
(
true
);
Object
window
=
field
.
get
(
grabber
);
if
(
window
!=
null
)
{
throw
new
Exception
(
"interaction with GNOME is crippled"
);
}
}
public
void
uncaughtException
(
Thread
thread
,
Throwable
throwable
)
{
System
.
out
.
println
(
throwable
);
}
}
test/javax/swing/JTable/6777378/bug6777378.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 6777378
@summary NullPointerException in XPDefaultRenderer.paint()
@author Alexander Potochkin
@run main bug6777378
*/
import
sun.awt.SunToolkit
;
import
javax.swing.*
;
import
javax.swing.table.AbstractTableModel
;
import
javax.swing.table.JTableHeader
;
import
javax.swing.plaf.metal.MetalLookAndFeel
;
import
java.awt.event.MouseEvent
;
import
java.awt.event.InputEvent
;
import
java.awt.*
;
public
class
bug6777378
{
private
static
JFrame
frame
;
private
static
JTableHeader
header
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
20
);
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
try
{
UIManager
.
setLookAndFeel
(
new
MetalLookAndFeel
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
JTable
table
=
new
JTable
(
new
AbstractTableModel
()
{
public
int
getRowCount
()
{
return
10
;
}
public
int
getColumnCount
()
{
return
10
;
}
public
Object
getValueAt
(
int
rowIndex
,
int
columnIndex
)
{
return
""
+
rowIndex
+
" "
+
columnIndex
;
}
});
header
=
new
JTableHeader
(
table
.
getColumnModel
());
header
.
setToolTipText
(
"hello"
);
frame
=
new
JFrame
();
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
add
(
header
);
frame
.
setSize
(
300
,
300
);
frame
.
setVisible
(
true
);
}
});
toolkit
.
realSync
();
Point
point
=
header
.
getLocationOnScreen
();
robot
.
mouseMove
(
point
.
x
+
20
,
point
.
y
+
50
);
robot
.
mouseMove
(
point
.
x
+
30
,
point
.
y
+
50
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
}
}
test/javax/swing/border/Test4129681.html
0 → 100644
浏览文件 @
2a113c4a
<html>
<body>
When applet starts, you'll see a checkbox and a label with a titled border.
Turn on the checkbox to disable the label.
The test passes if the title of the border is disabled as well as the label.
<applet
width=
"300"
height=
"200"
code=
"Test4129681.class"
>
</applet>
</body>
</html>
test/javax/swing/border/Test4129681.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4129681
* @summary Tests enabling/disabling of titled border's caption
* @author Sergey Malenkov
* @run applet/manual=yesno Test4129681.html
*/
import
java.awt.BorderLayout
;
import
java.awt.event.ItemEvent
;
import
java.awt.event.ItemListener
;
import
javax.swing.BorderFactory
;
import
javax.swing.JApplet
;
import
javax.swing.JCheckBox
;
import
javax.swing.JLabel
;
public
class
Test4129681
extends
JApplet
implements
ItemListener
{
private
JLabel
label
;
@Override
public
void
init
()
{
JCheckBox
check
=
new
JCheckBox
(
"disable"
);
check
.
addItemListener
(
this
);
this
.
label
=
new
JLabel
(
"message"
);
this
.
label
.
setBorder
(
BorderFactory
.
createTitledBorder
(
"label"
));
this
.
label
.
setEnabled
(!
check
.
isSelected
());
add
(
BorderLayout
.
NORTH
,
check
);
add
(
BorderLayout
.
CENTER
,
this
.
label
);
}
public
void
itemStateChanged
(
ItemEvent
event
)
{
this
.
label
.
setEnabled
(
ItemEvent
.
DESELECTED
==
event
.
getStateChange
());
}
}
test/javax/swing/border/Test4760089.html
0 → 100644
浏览文件 @
2a113c4a
<html>
<body>
When applet starts, you'll see a panel with a compound titled border.
If one of its titles is overstriken with the border's line then test fails.
Otherwise test passes.
<applet
width=
"600"
height=
"300"
code=
"Test4760089.class"
>
</applet>
</body>
</html>
test/javax/swing/border/Test4760089.java
0 → 100644
浏览文件 @
2a113c4a
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4760089
* @summary Tests that titled border do not paint inner titled border over its caption
* @author Sergey Malenkov
* @run applet/manual=yesno Test4760089.html
*/
import
javax.swing.JApplet
;
import
javax.swing.JPanel
;
import
javax.swing.border.Border
;
import
javax.swing.border.EtchedBorder
;
import
javax.swing.border.TitledBorder
;
public
class
Test4760089
extends
JApplet
{
@Override
public
void
init
()
{
Border
border
=
new
EtchedBorder
();
border
=
new
TitledBorder
(
border
,
"LEFT"
,
TitledBorder
.
LEFT
,
TitledBorder
.
TOP
);
border
=
new
TitledBorder
(
border
,
"RIGHT"
,
TitledBorder
.
RIGHT
,
TitledBorder
.
TOP
);
JPanel
panel
=
new
JPanel
();
panel
.
setBorder
(
border
);
getContentPane
().
add
(
panel
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录