Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f7a6ec10
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看板
提交
f7a6ec10
编写于
10月 04, 2010
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
9a4f6fde
203ac497
变更
26
显示空白变更内容
内联
并排
Showing
26 changed file
with
671 addition
and
396 deletion
+671
-396
src/share/classes/java/beans/EventSetDescriptor.java
src/share/classes/java/beans/EventSetDescriptor.java
+3
-2
src/share/classes/java/beans/IndexedPropertyDescriptor.java
src/share/classes/java/beans/IndexedPropertyDescriptor.java
+7
-3
src/share/classes/java/beans/Introspector.java
src/share/classes/java/beans/Introspector.java
+81
-19
src/share/classes/java/beans/MethodDescriptor.java
src/share/classes/java/beans/MethodDescriptor.java
+2
-2
src/share/classes/java/beans/PropertyDescriptor.java
src/share/classes/java/beans/PropertyDescriptor.java
+6
-4
src/share/classes/java/util/Locale.java
src/share/classes/java/util/Locale.java
+3
-0
src/share/classes/java/util/ResourceBundle.java
src/share/classes/java/util/ResourceBundle.java
+11
-105
src/share/classes/javax/swing/GroupLayout.java
src/share/classes/javax/swing/GroupLayout.java
+2
-2
src/share/classes/javax/swing/JComponent.java
src/share/classes/javax/swing/JComponent.java
+11
-0
src/share/classes/javax/swing/JDesktopPane.java
src/share/classes/javax/swing/JDesktopPane.java
+2
-1
src/share/classes/javax/swing/JLayer.java
src/share/classes/javax/swing/JLayer.java
+114
-121
src/share/classes/javax/swing/JTable.java
src/share/classes/javax/swing/JTable.java
+4
-5
src/share/classes/javax/swing/ToolTipManager.java
src/share/classes/javax/swing/ToolTipManager.java
+1
-1
src/share/classes/javax/swing/plaf/LayerUI.java
src/share/classes/javax/swing/plaf/LayerUI.java
+81
-93
src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
...hare/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
+1
-0
src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java
...share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java
+1
-1
src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
...are/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
+3
-0
src/share/classes/sun/util/locale/BaseLocale.java
src/share/classes/sun/util/locale/BaseLocale.java
+8
-6
src/solaris/native/sun/awt/awt_InputMethod.c
src/solaris/native/sun/awt/awt_InputMethod.c
+4
-0
src/windows/lib/tzmappings
src/windows/lib/tzmappings
+27
-23
test/java/beans/Introspector/6976577/Test6976577.java
test/java/beans/Introspector/6976577/Test6976577.java
+71
-0
test/java/beans/Introspector/6976577/test/Accessor.java
test/java/beans/Introspector/6976577/test/Accessor.java
+81
-0
test/javax/swing/JComboBox/6632953/bug6632953.java
test/javax/swing/JComboBox/6632953/bug6632953.java
+44
-0
test/javax/swing/JScrollBar/6542335/bug6542335.java
test/javax/swing/JScrollBar/6542335/bug6542335.java
+92
-0
test/javax/swing/JTable/Test6888156.java
test/javax/swing/JTable/Test6888156.java
+10
-8
test/javax/swing/JTextArea/6940863/bug6940863.java
test/javax/swing/JTextArea/6940863/bug6940863.java
+1
-0
未找到文件。
src/share/classes/java/beans/EventSetDescriptor.java
浏览文件 @
f7a6ec10
...
...
@@ -176,8 +176,9 @@ public class EventSetDescriptor extends FeatureDescriptor {
setRemoveListenerMethod
(
getMethod
(
sourceClass
,
removeListenerMethodName
,
1
));
// Be more forgiving of not finding the getListener method.
if
(
getListenerMethodName
!=
null
)
{
setGetListenerMethod
(
Introspector
.
findInstanceMethod
(
sourceClass
,
getListenerMethodName
));
Method
method
=
Introspector
.
findMethod
(
sourceClass
,
getListenerMethodName
,
0
);
if
(
method
!=
null
)
{
setGetListenerMethod
(
method
);
}
}
...
...
src/share/classes/java/beans/IndexedPropertyDescriptor.java
浏览文件 @
f7a6ec10
...
...
@@ -189,11 +189,13 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
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
)
{
// no "is" method, so look for a "get" method.
indexedReadMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
();
indexedReadMethod
=
Introspector
.
find
InstanceMethod
(
cls
,
indexedReadMethodName
,
int
.
clas
s
);
indexedReadMethod
=
Introspector
.
find
Method
(
cls
,
indexedReadMethodName
,
1
,
arg
s
);
}
setIndexedReadMethod0
(
indexedReadMethod
);
}
...
...
@@ -265,7 +267,9 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
if
(
indexedWriteMethodName
==
null
)
{
indexedWriteMethodName
=
Introspector
.
SET_PREFIX
+
getBaseName
();
}
indexedWriteMethod
=
Introspector
.
findInstanceMethod
(
cls
,
indexedWriteMethodName
,
int
.
class
,
type
);
Class
[]
args
=
(
type
==
null
)
?
null
:
new
Class
[]
{
int
.
class
,
type
};
indexedWriteMethod
=
Introspector
.
findMethod
(
cls
,
indexedWriteMethodName
,
2
,
args
);
if
(
indexedWriteMethod
!=
null
)
{
if
(!
indexedWriteMethod
.
getReturnType
().
equals
(
void
.
class
))
{
indexedWriteMethod
=
null
;
...
...
src/share/classes/java/beans/Introspector.java
浏览文件 @
f7a6ec10
...
...
@@ -28,7 +28,6 @@ package java.beans;
import
com.sun.beans.WeakCache
;
import
com.sun.beans.finder.BeanInfoFinder
;
import
com.sun.beans.finder.ClassFinder
;
import
com.sun.beans.finder.MethodFinder
;
import
java.lang.ref.Reference
;
import
java.lang.ref.SoftReference
;
...
...
@@ -843,8 +842,8 @@ public class Introspector {
Method
read
=
result
.
getReadMethod
();
if
(
read
==
null
&&
write
!=
null
)
{
read
=
find
Instance
Method
(
result
.
getClass0
(),
GET_PREFIX
+
NameGenerator
.
capitalize
(
result
.
getName
())
);
read
=
findMethod
(
result
.
getClass0
(),
GET_PREFIX
+
NameGenerator
.
capitalize
(
result
.
getName
()),
0
);
if
(
read
!=
null
)
{
try
{
result
.
setReadMethod
(
read
);
...
...
@@ -854,9 +853,9 @@ public class Introspector {
}
}
if
(
write
==
null
&&
read
!=
null
)
{
write
=
find
Instance
Method
(
result
.
getClass0
(),
SET_PREFIX
+
NameGenerator
.
capitalize
(
result
.
getName
())
,
FeatureDescriptor
.
getReturnType
(
result
.
getClass0
(),
read
)
);
write
=
findMethod
(
result
.
getClass0
(),
SET_PREFIX
+
NameGenerator
.
capitalize
(
result
.
getName
()),
1
,
new
Class
[]
{
FeatureDescriptor
.
getReturnType
(
result
.
getClass0
(),
read
)
}
);
if
(
write
!=
null
)
{
try
{
result
.
setWriteMethod
(
write
);
...
...
@@ -1280,27 +1279,90 @@ public class Introspector {
// Package private support methods.
//======================================================================
static
Method
findMethod
(
Class
<?>
type
,
String
name
,
int
args
)
{
for
(
Method
method
:
type
.
getMethods
())
{
if
(
method
.
getName
().
equals
(
name
)
&&
(
args
==
method
.
getParameterTypes
().
length
))
{
try
{
return
MethodFinder
.
findAccessibleMethod
(
method
);
/**
* Internal support for finding a target methodName with a given
* parameter list on a given class.
*/
private
static
Method
internalFindMethod
(
Class
start
,
String
methodName
,
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
)
{
// continue search for a method with the specified count of parameters
// make sure method signature matches.
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
;
}
return
null
;
}
}
method
=
null
;
static
Method
findInstanceMethod
(
Class
<?>
type
,
String
name
,
Class
<?>...
args
)
{
try
{
return
MethodFinder
.
findInstanceMethod
(
type
,
name
,
args
);
// 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
);
}
catch
(
NoSuchMethodException
exception
)
{
/**
* Find a target methodName with specific parameter list on a given class.
* <p>
* Used in the contructors of the EventSetDescriptor,
* PropertyDescriptor and the IndexedPropertyDescriptor.
* <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
internalFindMethod
(
cls
,
methodName
,
argCount
,
args
);
}
/**
...
...
src/share/classes/java/beans/MethodDescriptor.java
浏览文件 @
f7a6ec10
...
...
@@ -90,13 +90,13 @@ public class MethodDescriptor extends FeatureDescriptor {
// Find methods for up to 2 params. We are guessing here.
// This block should never execute unless the classloader
// that loaded the argument classes disappears.
method
=
Introspector
.
findMethod
(
cls
,
name
,
i
);
method
=
Introspector
.
findMethod
(
cls
,
name
,
i
,
null
);
if
(
method
!=
null
)
{
break
;
}
}
}
else
{
method
=
Statement
.
getMethod
(
cls
,
name
,
params
);
method
=
Introspector
.
findMethod
(
cls
,
name
,
params
.
length
,
params
);
}
setMethod
(
method
);
}
...
...
src/share/classes/java/beans/PropertyDescriptor.java
浏览文件 @
f7a6ec10
...
...
@@ -112,7 +112,8 @@ public class PropertyDescriptor extends FeatureDescriptor {
// If this class or one of its base classes allow PropertyChangeListener,
// then we assume that any properties we discover are "bound".
// See Introspector.getTargetPropertyInfo() method.
this
.
bound
=
null
!=
Introspector
.
findInstanceMethod
(
beanClass
,
"addPropertyChangeListener"
,
PropertyChangeListener
.
class
);
Class
[]
args
=
{
PropertyChangeListener
.
class
};
this
.
bound
=
null
!=
Introspector
.
findMethod
(
beanClass
,
"addPropertyChangeListener"
,
args
.
length
,
args
);
}
/**
...
...
@@ -223,10 +224,10 @@ public class PropertyDescriptor extends FeatureDescriptor {
// property type is. For booleans, there can be "is" and "get"
// methods. If an "is" method exists, this is the official
// reader method so look for this one first.
readMethod
=
Introspector
.
find
InstanceMethod
(
cls
,
readMethodName
);
readMethod
=
Introspector
.
find
Method
(
cls
,
readMethodName
,
0
);
if
(
readMethod
==
null
)
{
readMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
();
readMethod
=
Introspector
.
find
InstanceMethod
(
cls
,
readMethodName
);
readMethod
=
Introspector
.
find
Method
(
cls
,
readMethodName
,
0
);
}
try
{
setReadMethod
(
readMethod
);
...
...
@@ -291,7 +292,8 @@ public class PropertyDescriptor extends FeatureDescriptor {
writeMethodName
=
Introspector
.
SET_PREFIX
+
getBaseName
();
}
writeMethod
=
Introspector
.
findInstanceMethod
(
cls
,
writeMethodName
,
type
);
Class
[]
args
=
(
type
==
null
)
?
null
:
new
Class
[]
{
type
};
writeMethod
=
Introspector
.
findMethod
(
cls
,
writeMethodName
,
1
,
args
);
if
(
writeMethod
!=
null
)
{
if
(!
writeMethod
.
getReturnType
().
equals
(
void
.
class
))
{
writeMethod
=
null
;
...
...
src/share/classes/java/util/Locale.java
浏览文件 @
f7a6ec10
...
...
@@ -569,6 +569,9 @@ public final class Locale implements Cloneable, Serializable {
* @exception NullPointerException thrown if any argument is null.
*/
public
Locale
(
String
language
,
String
country
,
String
variant
)
{
if
(
language
==
null
||
country
==
null
||
variant
==
null
)
{
throw
new
NullPointerException
();
}
_baseLocale
=
BaseLocale
.
getInstance
(
convertOldISOCodes
(
language
),
""
,
country
,
variant
);
_extensions
=
getCompatibilityExtensions
(
language
,
""
,
country
,
variant
);
}
...
...
src/share/classes/java/util/ResourceBundle.java
浏览文件 @
f7a6ec10
...
...
@@ -292,16 +292,6 @@ public abstract class ResourceBundle {
private
static
final
ConcurrentMap
<
CacheKey
,
BundleReference
>
cacheList
=
new
ConcurrentHashMap
<
CacheKey
,
BundleReference
>(
INITIAL_CACHE_SIZE
);
/**
* This ConcurrentMap is used to keep multiple threads from loading the
* same bundle concurrently. The table entries are <CacheKey, Thread>
* where CacheKey is the key for the bundle that is under construction
* and Thread is the thread that is constructing the bundle.
* This list is manipulated in findBundleInCache and putBundleInCache.
*/
private
static
final
ConcurrentMap
<
CacheKey
,
Thread
>
underConstruction
=
new
ConcurrentHashMap
<
CacheKey
,
Thread
>();
/**
* Queue for reference objects referring to class loaders or bundles.
*/
...
...
@@ -1381,7 +1371,7 @@ public abstract class ResourceBundle {
boolean
expiredBundle
=
false
;
// First, look up the cache to see if it's in the cache, without
//
declaring beginLoading
.
//
attempting to load bundle
.
cacheKey
.
setLocale
(
targetLocale
);
ResourceBundle
bundle
=
findBundleInCache
(
cacheKey
,
control
);
if
(
isValidBundle
(
bundle
))
{
...
...
@@ -1407,33 +1397,6 @@ public abstract class ResourceBundle {
if
(
bundle
!=
NONEXISTENT_BUNDLE
)
{
CacheKey
constKey
=
(
CacheKey
)
cacheKey
.
clone
();
try
{
// Try declaring loading. If beginLoading() returns true,
// then we can proceed. Otherwise, we need to take a look
// at the cache again to see if someone else has loaded
// the bundle and put it in the cache while we've been
// waiting for other loading work to complete.
while
(!
beginLoading
(
constKey
))
{
bundle
=
findBundleInCache
(
cacheKey
,
control
);
if
(
bundle
==
null
)
{
continue
;
}
if
(
bundle
==
NONEXISTENT_BUNDLE
)
{
// If the bundle is NONEXISTENT_BUNDLE, the bundle doesn't exist.
return
parent
;
}
expiredBundle
=
bundle
.
expired
;
if
(!
expiredBundle
)
{
if
(
bundle
.
parent
==
parent
)
{
return
bundle
;
}
BundleReference
bundleRef
=
cacheList
.
get
(
cacheKey
);
if
(
bundleRef
!=
null
&&
bundleRef
.
get
()
==
bundle
)
{
cacheList
.
remove
(
cacheKey
,
bundleRef
);
}
}
}
try
{
bundle
=
loadBundle
(
cacheKey
,
formats
,
control
,
expiredBundle
);
if
(
bundle
!=
null
)
{
...
...
@@ -1448,16 +1411,12 @@ public abstract class ResourceBundle {
// Put NONEXISTENT_BUNDLE in the cache as a mark that there's no bundle
// instance for the locale.
putBundleInCache
(
cacheKey
,
NONEXISTENT_BUNDLE
,
control
);
}
finally
{
endLoading
(
constKey
);
}
}
finally
{
if
(
constKey
.
getCause
()
instanceof
InterruptedException
)
{
Thread
.
currentThread
().
interrupt
();
}
}
}
assert
underConstruction
.
get
(
cacheKey
)
!=
Thread
.
currentThread
();
return
parent
;
}
...
...
@@ -1465,7 +1424,6 @@ public abstract class ResourceBundle {
List
<
String
>
formats
,
Control
control
,
boolean
reload
)
{
assert
underConstruction
.
get
(
cacheKey
)
==
Thread
.
currentThread
();
// Here we actually load the bundle in the order of formats
// specified by the getFormats() value.
...
...
@@ -1498,7 +1456,6 @@ public abstract class ResourceBundle {
break
;
}
}
assert
underConstruction
.
get
(
cacheKey
)
==
Thread
.
currentThread
();
return
bundle
;
}
...
...
@@ -1529,57 +1486,6 @@ public abstract class ResourceBundle {
return
true
;
}
/**
* Declares the beginning of actual resource bundle loading. This method
* returns true if the declaration is successful and the current thread has
* been put in underConstruction. If someone else has already begun
* loading, this method waits until that loading work is complete and
* returns false.
*/
private
static
final
boolean
beginLoading
(
CacheKey
constKey
)
{
Thread
me
=
Thread
.
currentThread
();
Thread
worker
;
// We need to declare by putting the current Thread (me) to
// underConstruction that we are working on loading the specified
// resource bundle. If we are already working the loading, it means
// that the resource loading requires a recursive call. In that case,
// we have to proceed. (4300693)
if
(((
worker
=
underConstruction
.
putIfAbsent
(
constKey
,
me
))
==
null
)
||
worker
==
me
)
{
return
true
;
}
// If someone else is working on the loading, wait until
// the Thread finishes the bundle loading.
synchronized
(
worker
)
{
while
(
underConstruction
.
get
(
constKey
)
==
worker
)
{
try
{
worker
.
wait
();
}
catch
(
InterruptedException
e
)
{
// record the interruption
constKey
.
setCause
(
e
);
}
}
}
return
false
;
}
/**
* Declares the end of the bundle loading. This method calls notifyAll
* for those who are waiting for this completion.
*/
private
static
final
void
endLoading
(
CacheKey
constKey
)
{
// Remove this Thread from the underConstruction map and wake up
// those who have been waiting for me to complete this bundle
// loading.
Thread
me
=
Thread
.
currentThread
();
assert
(
underConstruction
.
get
(
constKey
)
==
me
);
underConstruction
.
remove
(
constKey
);
synchronized
(
me
)
{
me
.
notifyAll
();
}
}
/**
* Throw a MissingResourceException with proper message
*/
...
...
src/share/classes/javax/swing/GroupLayout.java
浏览文件 @
f7a6ec10
...
...
@@ -1464,8 +1464,8 @@ public class GroupLayout implements LayoutManager2 {
* <= {@code pref} <= {@code max}.
* <p>
* Similarly any methods that take a {@code Component} throw a
* {@code
NullPointer
Exception} if passed {@code null} and any methods
* that take a {@code Group} throw an {@code
IllegalArgument
Exception} if
* {@code
IllegalArgument
Exception} if passed {@code null} and any methods
* that take a {@code Group} throw an {@code
NullPointer
Exception} if
* passed {@code null}.
*
* @see #createSequentialGroup
...
...
src/share/classes/javax/swing/JComponent.java
浏览文件 @
f7a6ec10
...
...
@@ -4787,6 +4787,17 @@ public abstract class JComponent extends Container implements Serializable,
* @see RepaintManager#addDirtyRegion
*/
public
void
repaint
(
long
tm
,
int
x
,
int
y
,
int
width
,
int
height
)
{
Container
p
=
this
;
while
((
p
=
p
.
getParent
())
instanceof
JComponent
)
{
JComponent
jp
=
(
JComponent
)
p
;
if
(
jp
.
isPaintingOrigin
())
{
Rectangle
rectangle
=
SwingUtilities
.
convertRectangle
(
this
,
new
Rectangle
(
x
,
y
,
width
,
height
),
jp
);
jp
.
repaint
(
tm
,
rectangle
.
x
,
rectangle
.
y
,
rectangle
.
width
,
rectangle
.
height
);
return
;
}
}
RepaintManager
.
currentManager
(
this
).
addDirtyRegion
(
this
,
x
,
y
,
width
,
height
);
}
...
...
src/share/classes/javax/swing/JDesktopPane.java
浏览文件 @
f7a6ec10
...
...
@@ -215,7 +215,8 @@ public class JDesktopPane extends JLayeredPane implements Accessible
/**
* Sets the <code>DesktopManger</code> that will handle
* desktop-specific UI actions.
* desktop-specific UI actions. This may be overridden by
* {@code LookAndFeel}.
*
* @param d the <code>DesktopManager</code> to use
*
...
...
src/share/classes/javax/swing/JLayer.java
浏览文件 @
f7a6ec10
...
...
@@ -25,17 +25,17 @@
package
javax.swing
;
import
sun.awt.AWTAccessor
;
import
javax.swing.plaf.LayerUI
;
import
javax.swing.border.Border
;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.beans.PropertyChangeEvent
;
import
java.beans.PropertyChangeListener
;
import
java.io.IOException
;
import
java.io.ObjectInputStream
;
import
java.io.Serializable
;
import
java.lang.ref.WeakReference
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
...
...
@@ -156,8 +156,6 @@ public final class JLayer<V extends Component>
private
LayerUI
<?
super
V
>
layerUI
;
private
JPanel
glassPane
;
private
boolean
isPainting
;
private
static
final
DefaultLayerLayout
sharedLayoutInstance
=
new
DefaultLayerLayout
();
private
long
eventMask
;
private
static
final
LayerEventController
eventController
=
...
...
@@ -165,7 +163,7 @@ public final class JLayer<V extends Component>
/**
* Creates a new {@code JLayer} object with a {@code null} view component
* and
{@code null}
{@link javax.swing.plaf.LayerUI}.
* and
default
{@link javax.swing.plaf.LayerUI}.
*
* @see #setView
* @see #setUI
...
...
@@ -176,14 +174,14 @@ public final class JLayer<V extends Component>
/**
* Creates a new {@code JLayer} object
* with
{@code null}
{@link javax.swing.plaf.LayerUI}.
* with
default
{@link javax.swing.plaf.LayerUI}.
*
* @param view the component to be decorated by this {@code JLayer}
*
* @see #setUI
*/
public
JLayer
(
V
view
)
{
this
(
view
,
n
ull
);
this
(
view
,
n
ew
LayerUI
<
V
>()
);
}
/**
...
...
@@ -195,7 +193,6 @@ public final class JLayer<V extends Component>
* to be used by this {@code JLayer}
*/
public
JLayer
(
V
view
,
LayerUI
<
V
>
ui
)
{
setLayout
(
sharedLayoutInstance
);
setGlassPane
(
createGlassPane
());
setView
(
view
);
setUI
(
ui
);
...
...
@@ -279,10 +276,15 @@ public final class JLayer<V extends Component>
*/
public
void
setGlassPane
(
JPanel
glassPane
)
{
Component
oldGlassPane
=
getGlassPane
();
boolean
isGlassPaneVisible
=
false
;
if
(
oldGlassPane
!=
null
)
{
isGlassPaneVisible
=
oldGlassPane
.
isVisible
();
super
.
remove
(
oldGlassPane
);
}
if
(
glassPane
!=
null
)
{
AWTAccessor
.
getComponentAccessor
().
setMixingCutoutShape
(
glassPane
,
new
Rectangle
());
glassPane
.
setVisible
(
isGlassPaneVisible
);
super
.
addImpl
(
glassPane
,
null
,
0
);
}
this
.
glassPane
=
glassPane
;
...
...
@@ -302,6 +304,40 @@ public final class JLayer<V extends Component>
return
new
DefaultLayerGlassPane
();
}
/**
* Sets the layout manager for this container. This method is
* overridden to prevent the layout manager from being set.
* <p/>Note: If {@code mgr} is non-{@code null}, this
* method will throw an exception as layout managers are not supported on
* a {@code JLayer}.
*
* @param mgr the specified layout manager
* @exception IllegalArgumentException this method is not supported
*/
public
void
setLayout
(
LayoutManager
mgr
)
{
if
(
mgr
!=
null
)
{
throw
new
IllegalArgumentException
(
"JLayer.setLayout() not supported"
);
}
}
/**
* A non-{@code null] border, or non-zero insets, isn't supported, to prevent the geometry
* of this component from becoming complex enough to inhibit
* subclassing of {@code LayerUI} class. To create a {@code JLayer} with a border,
* add it to a {@code JPanel} that has a border.
* <p/>Note: If {@code border} is non-{@code null}, this
* method will throw an exception as borders are not supported on
* a {@code JLayer}.
*
* @param border the {@code Border} to set
* @exception IllegalArgumentException this method is not supported
*/
public
void
setBorder
(
Border
border
)
{
if
(
border
!=
null
)
{
throw
new
IllegalArgumentException
(
"JLayer.setBorder() not supported"
);
}
}
/**
* This method is not supported by {@code JLayer}
* and always throws {@code UnsupportedOperationException}
...
...
@@ -340,6 +376,32 @@ public final class JLayer<V extends Component>
setGlassPane
(
null
);
}
/**
* Always returns {@code true} to cause painting to originate from {@code JLayer},
* or one of its ancestors.
*
* @return true
* @see JComponent#isPaintingOrigin()
*/
boolean
isPaintingOrigin
()
{
return
true
;
}
/**
* Delegates repainting to {@link javax.swing.plaf.LayerUI#repaint} method.
*
* @param tm this parameter is not used
* @param x the x value of the dirty region
* @param y the y value of the dirty region
* @param width the width of the dirty region
* @param height the height of the dirty region
*/
public
void
repaint
(
long
tm
,
int
x
,
int
y
,
int
width
,
int
height
)
{
if
(
getUI
()
!=
null
)
{
getUI
().
repaint
(
tm
,
x
,
y
,
width
,
height
,
this
);
}
}
/**
* Delegates all painting to the {@link javax.swing.plaf.LayerUI} object.
*
...
...
@@ -364,14 +426,18 @@ public final class JLayer<V extends Component>
}
/**
* To enable the correct painting of the {@code glassPane} and view component,
* the {@code JLayer} overrides the default implementation of
* this method to return {@code false} when the {@code glassPane} is visible.
* The {@code JLayer} overrides the default implementation of
* this method (in {@code JComponent}) to return {@code false}.
* This ensures
* that the drawing machinery will call the {@code JLayer}'s
* {@code paint}
* implementation rather than messaging the {@code JLayer}'s
* children directly.
*
* @return false
if {@code JLayer}'s {@code glassPane} is visible
* @return false
*/
public
boolean
isOptimizedDrawingEnabled
()
{
return
glassPane
==
null
||
!
glassPane
.
isVisible
()
;
return
false
;
}
/**
...
...
@@ -461,17 +527,16 @@ public final class JLayer<V extends Component>
/**
* Returns the preferred size of the viewport for a view component.
* <p/>
* If the
ui delegate of this layer is not {@code null
}, this method delegates its
* implementation to the
{@code LayerUI.getPreferredScrollableViewportSize(JLayer)}
* If the
view component of this layer implements {@link Scrollable
}, this method delegates its
* implementation to the
view component.
*
* @return the preferred size of the viewport for a view component
*
* @see Scrollable
* @see LayerUI#getPreferredScrollableViewportSize(JLayer)
*/
public
Dimension
getPreferredScrollableViewportSize
()
{
if
(
get
UI
()
!=
null
)
{
return
getUI
().
getPreferredScrollableViewportSize
(
this
);
if
(
get
View
()
instanceof
Scrollable
)
{
return
((
Scrollable
)
getView
()).
getPreferredScrollableViewportSize
(
);
}
return
getPreferredSize
();
}
...
...
@@ -481,18 +546,17 @@ public final class JLayer<V extends Component>
* that display logical rows or columns in order to completely expose
* one block of rows or columns, depending on the value of orientation.
* <p/>
* If the
ui delegate of this layer is not {@code null
}, this method delegates its
* implementation to the
{@code LayerUI.getScrollableBlockIncrement(JLayer,Rectangle,int,int)}
* If the
view component of this layer implements {@link Scrollable
}, this method delegates its
* implementation to the
view component.
*
* @return the "block" increment for scrolling in the specified direction
*
* @see Scrollable
* @see LayerUI#getScrollableBlockIncrement(JLayer, Rectangle, int, int)
*/
public
int
getScrollableBlockIncrement
(
Rectangle
visibleRect
,
int
orientation
,
int
direction
)
{
if
(
get
UI
()
!=
null
)
{
return
getUI
().
getScrollableBlockIncrement
(
this
,
visibleRect
,
if
(
get
View
()
instanceof
Scrollable
)
{
return
((
Scrollable
)
getView
()).
getScrollableBlockIncrement
(
visibleRect
,
orientation
,
direction
);
}
return
(
orientation
==
SwingConstants
.
VERTICAL
)
?
visibleRect
.
height
:
...
...
@@ -504,17 +568,16 @@ public final class JLayer<V extends Component>
* determine the height of the layer, unless the preferred height
* of the layer is smaller than the height of the viewport.
* <p/>
* If the
ui delegate of this layer is not null
, this method delegates its
* implementation to the
{@code LayerUI.getScrollableTracksViewportHeight(JLayer)}
* If the
view component of this layer implements {@link Scrollable}
, this method delegates its
* implementation to the
view component.
*
* @return whether the layer should track the height of the viewport
*
* @see Scrollable
* @see LayerUI#getScrollableTracksViewportHeight(JLayer)
*/
public
boolean
getScrollableTracksViewportHeight
()
{
if
(
get
UI
()
!=
null
)
{
return
getUI
().
getScrollableTracksViewportHeight
(
this
);
if
(
get
View
()
instanceof
Scrollable
)
{
return
((
Scrollable
)
getView
()).
getScrollableTracksViewportHeight
(
);
}
return
false
;
}
...
...
@@ -524,17 +587,16 @@ public final class JLayer<V extends Component>
* determine the width of the layer, unless the preferred width
* of the layer is smaller than the width of the viewport.
* <p/>
* If the
ui delegate of this layer is not null
, this method delegates its
* implementation to the
{@code LayerUI.getScrollableTracksViewportWidth(JLayer)}
* If the
view component of this layer implements {@link Scrollable}
, this method delegates its
* implementation to the
view component.
*
* @return whether the layer should track the width of the viewport
*
* @see Scrollable
* @see LayerUI#getScrollableTracksViewportWidth(JLayer)
*/
public
boolean
getScrollableTracksViewportWidth
()
{
if
(
get
UI
()
!=
null
)
{
return
getUI
().
getScrollableTracksViewportWidth
(
this
);
if
(
get
View
()
instanceof
Scrollable
)
{
return
((
Scrollable
)
getView
()).
getScrollableTracksViewportWidth
(
);
}
return
false
;
}
...
...
@@ -549,20 +611,19 @@ public final class JLayer<V extends Component>
* Scrolling containers, like {@code JScrollPane}, will use this method
* each time the user requests a unit scroll.
* <p/>
* If the
ui delegate of this layer is not {@code null
}, this method delegates its
* implementation to the
{@code LayerUI.getScrollableUnitIncrement(JLayer,Rectangle,int,int)}
* If the
view component of this layer implements {@link Scrollable
}, this method delegates its
* implementation to the
view component.
*
* @return The "unit" increment for scrolling in the specified direction.
* This value should always be positive.
*
* @see Scrollable
* @see LayerUI#getScrollableUnitIncrement(JLayer, Rectangle, int, int)
*/
public
int
getScrollableUnitIncrement
(
Rectangle
visibleRect
,
int
orientation
,
int
direction
)
{
if
(
get
UI
()
!=
null
)
{
return
getUI
(
).
getScrollableUnitIncrement
(
this
,
visibleRect
,
orientation
,
direction
);
if
(
get
View
()
instanceof
Scrollable
)
{
return
((
Scrollable
)
getView
()
).
getScrollableUnitIncrement
(
visibleRect
,
orientation
,
direction
);
}
return
1
;
}
...
...
@@ -594,6 +655,16 @@ public final class JLayer<V extends Component>
eventController
.
updateAWTEventListener
(
eventMask
,
0
);
}
/**
* Delegates its functionality to the {@link javax.swing.plaf.LayerUI#doLayout(JLayer)} method,
* if {@code LayerUI} is set.
*/
public
void
doLayout
()
{
if
(
getUI
()
!=
null
)
{
getUI
().
doLayout
(
this
);
}
}
/**
* static AWTEventListener to be shared with all AbstractLayerUIs
*/
...
...
@@ -625,8 +696,8 @@ public final class JLayer<V extends Component>
JLayer
l
=
(
JLayer
)
component
;
LayerUI
ui
=
l
.
getUI
();
if
(
ui
!=
null
&&
isEventEnabled
(
l
.
getLayerEventMask
(),
event
.
getID
()))
{
isEventEnabled
(
l
.
getLayerEventMask
(),
event
.
getID
())
&&
(!(
event
instanceof
InputEvent
)
||
!((
InputEvent
)
event
).
isConsumed
()))
{
ui
.
eventDispatched
(
event
,
l
);
}
}
...
...
@@ -758,82 +829,4 @@ public final class JLayer<V extends Component>
return
super
.
contains
(
x
,
y
);
}
}
/**
* The default layout manager for the {@link javax.swing.JLayer}.<br/>
* It places the glassPane on top of the view component
* and makes it the same size as {@code JLayer},
* it also makes the view component the same size but minus layer's insets<br/>
*/
private
static
class
DefaultLayerLayout
implements
LayoutManager
,
Serializable
{
/**
* {@inheritDoc}
*/
public
void
layoutContainer
(
Container
parent
)
{
JLayer
layer
=
(
JLayer
)
parent
;
Component
view
=
layer
.
getView
();
Component
glassPane
=
layer
.
getGlassPane
();
if
(
view
!=
null
)
{
Insets
insets
=
layer
.
getInsets
();
view
.
setLocation
(
insets
.
left
,
insets
.
top
);
view
.
setSize
(
layer
.
getWidth
()
-
insets
.
left
-
insets
.
right
,
layer
.
getHeight
()
-
insets
.
top
-
insets
.
bottom
);
}
if
(
glassPane
!=
null
)
{
glassPane
.
setLocation
(
0
,
0
);
glassPane
.
setSize
(
layer
.
getWidth
(),
layer
.
getHeight
());
}
}
/**
* {@inheritDoc}
*/
public
Dimension
minimumLayoutSize
(
Container
parent
)
{
JLayer
layer
=
(
JLayer
)
parent
;
Insets
insets
=
layer
.
getInsets
();
Dimension
ret
=
new
Dimension
(
insets
.
left
+
insets
.
right
,
insets
.
top
+
insets
.
bottom
);
Component
view
=
layer
.
getView
();
if
(
view
!=
null
)
{
Dimension
size
=
view
.
getMinimumSize
();
ret
.
width
+=
size
.
width
;
ret
.
height
+=
size
.
height
;
}
if
(
ret
.
width
==
0
||
ret
.
height
==
0
)
{
ret
.
width
=
ret
.
height
=
4
;
}
return
ret
;
}
/**
* {@inheritDoc}
*/
public
Dimension
preferredLayoutSize
(
Container
parent
)
{
JLayer
layer
=
(
JLayer
)
parent
;
Insets
insets
=
layer
.
getInsets
();
Dimension
ret
=
new
Dimension
(
insets
.
left
+
insets
.
right
,
insets
.
top
+
insets
.
bottom
);
Component
view
=
layer
.
getView
();
if
(
view
!=
null
)
{
Dimension
size
=
view
.
getPreferredSize
();
if
(
size
.
width
>
0
&&
size
.
height
>
0
)
{
ret
.
width
+=
size
.
width
;
ret
.
height
+=
size
.
height
;
}
}
return
ret
;
}
/**
* {@inheritDoc}
*/
public
void
addLayoutComponent
(
String
name
,
Component
comp
)
{
}
/**
* {@inheritDoc}
*/
public
void
removeLayoutComponent
(
Component
comp
)
{
}
}
}
src/share/classes/javax/swing/JTable.java
浏览文件 @
f7a6ec10
...
...
@@ -4574,9 +4574,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* @see TableColumnModelListener
*/
public
void
columnMoved
(
TableColumnModelEvent
e
)
{
// If I'm currently editing, then I should stop editing
if
(
isEditing
())
{
removeEditor
();
if
(
isEditing
()
&&
!
getCellEditor
().
stopCellEditing
())
{
getCellEditor
().
cancelCellEditing
();
}
repaint
();
}
...
...
@@ -4593,8 +4592,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* @see TableColumnModelListener
*/
public
void
columnMarginChanged
(
ChangeEvent
e
)
{
if
(
isEditing
())
{
removeEditor
();
if
(
isEditing
()
&&
!
getCellEditor
().
stopCellEditing
()
)
{
getCellEditor
().
cancelCellEditing
();
}
TableColumn
resizingColumn
=
getResizingColumn
();
// Need to do this here, before the parent's
...
...
src/share/classes/javax/swing/ToolTipManager.java
浏览文件 @
f7a6ec10
...
...
@@ -459,7 +459,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
if
(
insideComponent
==
null
)
{
// Drag exit
}
if
(
window
!=
null
&&
event
.
getSource
()
==
window
)
{
if
(
window
!=
null
&&
event
.
getSource
()
==
window
&&
insideComponent
!=
null
)
{
// if we get an exit and have a heavy window
// we need to check if it if overlapping the inside component
Container
insideComponentWindow
=
insideComponent
.
getTopLevelAncestor
();
...
...
src/share/classes/javax/swing/plaf/LayerUI.java
浏览文件 @
f7a6ec10
...
...
@@ -600,136 +600,124 @@ public class LayerUI<V extends Component>
}
/**
* Returns the preferred size of the viewport for a view component.
* If the {@code JLayer}'s view component is not {@code null},
* this calls the view's {@code getBaseline()} method.
* Otherwise, the default implementation is called.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
* @return the preferred size of the viewport for a view component
* @see Scrollable#getPreferredScrollableViewportSize()
* @param c {@code JLayer} to return baseline resize behavior for
* @param width the width to get the baseline for
* @param height the height to get the baseline for
* @return baseline or a value < 0 indicating there is no reasonable
* baseline
*/
public
Dimension
getPreferredScrollableViewportSize
(
JLayer
<?
extends
V
>
l
)
{
if
(
l
.
getView
()
instanceof
Scrollable
)
{
return
((
Scrollable
)
l
.
getView
()).
getPreferredScrollableViewportSize
();
public
int
getBaseline
(
JComponent
c
,
int
width
,
int
height
)
{
JLayer
l
=
(
JLayer
)
c
;
if
(
l
.
getView
()
!=
null
)
{
return
l
.
getView
().
getBaseline
(
width
,
height
);
}
return
l
.
getPreferredSize
(
);
return
super
.
getBaseline
(
c
,
width
,
height
);
}
/**
*
Returns a scroll increment, which is required for components
* th
at display logical rows or columns in order to completely expose
*
one block of rows or columns, depending on the value of orientation
.
*
If the {@code JLayer}'s view component is not {@code null},
* th
is returns the result of the view's {@code getBaselineResizeBehavior()} method.
*
Otherwise, the default implementation is called
.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
* @param visibleRect The view area visible within the viewport
* @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
* @param direction Less than zero to scroll up/left, greater than zero for down/right.
* @return the "block" increment for scrolling in the specified direction
* @see Scrollable#getScrollableBlockIncrement(Rectangle, int, int)
* @param c {@code JLayer} to return baseline resize behavior for
* @return an enum indicating how the baseline changes as the component
* size changes
*/
public
int
getScrollableBlockIncrement
(
JLayer
<?
extends
V
>
l
,
Rectangle
visibleRect
,
int
orientation
,
int
direction
)
{
if
(
l
.
getView
()
instanceof
Scrollable
)
{
return
((
Scrollable
)
l
.
getView
()).
getScrollableBlockIncrement
(
visibleRect
,
orientation
,
direction
);
public
Component
.
BaselineResizeBehavior
getBaselineResizeBehavior
(
JComponent
c
)
{
JLayer
l
=
(
JLayer
)
c
;
if
(
l
.
getView
()
!=
null
)
{
return
l
.
getView
().
getBaselineResizeBehavior
();
}
return
(
orientation
==
SwingConstants
.
VERTICAL
)
?
visibleRect
.
height
:
visibleRect
.
width
;
return
super
.
getBaselineResizeBehavior
(
c
);
}
/**
* Returns {@code false} to indicate that the height of the viewport does not
* determine the height of the layer, unless the preferred height
* of the layer is smaller than the height of the viewport.
* Causes the passed instance of {@code JLayer} to lay out its components.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
* @return whether the layer should track the height of the viewport
* @see Scrollable#getScrollableTracksViewportHeight()
*/
public
boolean
getScrollableTracksViewportHeight
(
JLayer
<?
extends
V
>
l
)
{
if
(
l
.
getView
()
instanceof
Scrollable
)
{
return
((
Scrollable
)
l
.
getView
()).
getScrollableTracksViewportHeight
();
public
void
doLayout
(
JLayer
<?
extends
V
>
l
)
{
Component
view
=
l
.
getView
();
if
(
view
!=
null
)
{
view
.
setBounds
(
0
,
0
,
l
.
getWidth
(),
l
.
getHeight
());
}
Component
glassPane
=
l
.
getGlassPane
();
if
(
glassPane
!=
null
)
{
glassPane
.
setBounds
(
0
,
0
,
l
.
getWidth
(),
l
.
getHeight
());
}
return
false
;
}
/**
*
Returns {@code false} to indicate that the width of the viewport does not
*
determine the width of the layer, unless the preferred width
*
of the layer is smaller than the width of the viewport
.
*
If the {@code JLayer}'s view component is not {@code null},
*
this returns the result of the view's {@code getPreferredSize()} method.
*
Otherwise, the default implementation is used
.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
* @return whether the layer should track the width of the viewport
* @see Scrollable
* @see LayerUI#getScrollableTracksViewportWidth(JLayer)
* @param c {@code JLayer} to return preferred size for
* @return preferred size for the passed {@code JLayer}
*/
public
boolean
getScrollableTracksViewportWidth
(
JLayer
<?
extends
V
>
l
)
{
if
(
l
.
getView
()
instanceof
Scrollable
)
{
return
((
Scrollable
)
l
.
getView
()).
getScrollableTracksViewportWidth
();
public
Dimension
getPreferredSize
(
JComponent
c
)
{
JLayer
l
=
(
JLayer
)
c
;
Component
view
=
l
.
getView
();
if
(
view
!=
null
)
{
return
view
.
getPreferredSize
();
}
return
false
;
return
super
.
getPreferredSize
(
c
)
;
}
/**
* Returns a scroll increment, which is required for components
* that display logical rows or columns in order to completely expose
* one new row or column, depending on the value of orientation.
* Ideally, components should handle a partially exposed row or column
* by returning the distance required to completely expose the item.
* <p>
* Scrolling containers, like JScrollPane, will use this method
* each time the user requests a unit scroll.
* If the {@code JLayer}'s view component is not {@code null},
* this returns the result of the view's {@code getMinimalSize()} method.
* Otherwise, the default implementation is used.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
* @param visibleRect The view area visible within the viewport
* @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
* @param direction Less than zero to scroll up/left, greater than zero for down/right.
* @return The "unit" increment for scrolling in the specified direction.
* This value should always be positive.
* @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int)
* @param c {@code JLayer} to return preferred size for
* @return minimal size for the passed {@code JLayer}
*/
public
int
getScrollableUnitIncrement
(
JLayer
<?
extends
V
>
l
,
Rectangle
visibleRect
,
int
orientation
,
int
direction
)
{
if
(
l
.
getView
()
instanceof
Scrollable
)
{
return
((
Scrollable
)
l
.
getView
()).
getScrollableUnitIncrement
(
visibleRect
,
orientation
,
direction
);
public
Dimension
getMinimumSize
(
JComponent
c
)
{
JLayer
l
=
(
JLayer
)
c
;
Component
view
=
l
.
getView
();
if
(
view
!=
null
)
{
return
view
.
getMinimumSize
();
}
return
1
;
return
super
.
getMinimumSize
(
c
)
;
}
/**
* If the {@code JLayer}'s view component is not {@code null},
* this
calls the view's {@code getBaselin
e()} method.
* Otherwise, the default implementation is
call
ed.
* this
returns the result of the view's {@code getMaximumSiz
e()} method.
* Otherwise, the default implementation is
us
ed.
*
* @param c {@code JLayer} to return baseline resize behavior for
* @param width the width to get the baseline for
* @param height the height to get the baseline for
* @return baseline or a value < 0 indicating there is no reasonable
* baseline
* @param c {@code JLayer} to return preferred size for
* @return maximun size for the passed {@code JLayer}
*/
public
int
getBaseline
(
JComponent
c
,
int
width
,
int
height
)
{
public
Dimension
getMaximumSize
(
JComponent
c
)
{
JLayer
l
=
(
JLayer
)
c
;
if
(
l
.
getView
()
!=
null
)
{
return
l
.
getView
().
getBaseline
(
width
,
height
);
Component
view
=
l
.
getView
();
if
(
view
!=
null
)
{
return
view
.
getMaximumSize
();
}
return
super
.
get
Baseline
(
c
,
width
,
height
);
return
super
.
get
MaximumSize
(
c
);
}
/**
* If the {@code JLayer}'s view component is not {@code null},
* this calls the view's {@code getBaselineResizeBehavior()} method.
* Otherwise, the default implementation is called.
*
* @param c {@code JLayer} to return baseline resize behavior for
* @return an enum indicating how the baseline changes as the component
* size changes
* Adds the specified region to the dirty region list if the component
* is showing. The component will be repainted after all of the
* currently pending events have been dispatched.
* <p/>
* This method is to be overridden when the dirty region needs to be changed.
*
* @param tm this parameter is not used
* @param x the x value of the dirty region
* @param y the y value of the dirty region
* @param width the width of the dirty region
* @param height the height of the dirty region
* @see java.awt.Component#isShowing
* @see RepaintManager#addDirtyRegion
*/
public
Component
.
BaselineResizeBehavior
getBaselineResizeBehavior
(
JComponent
c
)
{
JLayer
l
=
(
JLayer
)
c
;
if
(
l
.
getView
()
!=
null
)
{
return
l
.
getView
().
getBaselineResizeBehavior
();
}
return
super
.
getBaselineResizeBehavior
(
c
);
public
void
repaint
(
long
tm
,
int
x
,
int
y
,
int
width
,
int
height
,
JLayer
<?
extends
V
>
l
)
{
RepaintManager
.
currentManager
(
l
).
addDirtyRegion
(
l
,
x
,
y
,
width
,
height
);
}
}
src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
浏览文件 @
f7a6ec10
...
...
@@ -1603,6 +1603,7 @@ public class BasicScrollBarUI
BoundedRangeModel
newModel
=
(
BoundedRangeModel
)
e
.
getNewValue
();
oldModel
.
removeChangeListener
(
modelListener
);
newModel
.
addChangeListener
(
modelListener
);
scrollBarValue
=
scrollbar
.
getValue
();
scrollbar
.
repaint
();
scrollbar
.
revalidate
();
}
else
if
(
"orientation"
==
propertyName
)
{
...
...
src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java
浏览文件 @
f7a6ec10
...
...
@@ -144,7 +144,7 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
*/
public
int
getBaseline
(
JComponent
c
,
int
width
,
int
height
)
{
int
baseline
;
if
(
MetalLookAndFeel
.
usingOcean
())
{
if
(
MetalLookAndFeel
.
usingOcean
()
&&
height
>=
4
)
{
height
-=
4
;
baseline
=
super
.
getBaseline
(
c
,
width
,
height
);
if
(
baseline
>=
0
)
{
...
...
src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
浏览文件 @
f7a6ec10
...
...
@@ -115,6 +115,9 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
return
new
SynthTabbedPaneUI
();
}
private
SynthTabbedPaneUI
()
{
}
private
boolean
scrollableTabLayoutEnabled
()
{
return
(
tabPane
.
getTabLayoutPolicy
()
==
JTabbedPane
.
SCROLL_TAB_LAYOUT
);
}
...
...
src/share/classes/sun/util/locale/BaseLocale.java
浏览文件 @
f7a6ec10
...
...
@@ -64,6 +64,7 @@ public final class BaseLocale {
public
static
BaseLocale
getInstance
(
String
language
,
String
script
,
String
region
,
String
variant
)
{
// JDK uses deprecated ISO639.1 language codes for he, yi and id
if
(
language
!=
null
)
{
if
(
AsciiUtil
.
caseIgnoreMatch
(
language
,
"he"
))
{
language
=
"iw"
;
}
else
if
(
AsciiUtil
.
caseIgnoreMatch
(
language
,
"yi"
))
{
...
...
@@ -71,6 +72,7 @@ public final class BaseLocale {
}
else
if
(
AsciiUtil
.
caseIgnoreMatch
(
language
,
"id"
))
{
language
=
"in"
;
}
}
Key
key
=
new
Key
(
language
,
script
,
region
,
variant
);
BaseLocale
baseLocale
=
CACHE
.
get
(
key
);
...
...
src/solaris/native/sun/awt/awt_InputMethod.c
浏览文件 @
f7a6ec10
...
...
@@ -1473,6 +1473,10 @@ static void OpenXIMCallback(Display *display, XPointer client_data, XPointer cal
static
void
DestroyXIMCallback
(
XIM
im
,
XPointer
client_data
,
XPointer
call_data
)
{
/* mark that XIM server was destroyed */
X11im
=
NULL
;
JNIEnv
*
env
=
(
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
);
/* free the old pX11IMData and set it to null. this also avoids crashing
* the jvm if the XIM server reappears */
X11InputMethodData
*
pX11IMData
=
getX11InputMethodData
(
env
,
currentX11InputMethodInstance
);
}
/*
...
...
src/windows/lib/tzmappings
浏览文件 @
f7a6ec10
#
#
# This file describes mapping information between Windows and Java
# time zones.
# Format: Each line should include a colon separated fields of Windows
...
...
@@ -84,8 +83,8 @@ Ekaterinburg:10,11::Asia/Yekaterinburg:
Ekaterinburg Standard Time:10,11::Asia/Yekaterinburg:
West Asia:10,11:UZ:Asia/Tashkent:
West Asia Standard Time:10,11:UZ:Asia/Tashkent:
Central Asia:12,13::Asia/
Dhaka
:
Central Asia Standard Time:12,13::Asia/
Dhaka
:
Central Asia:12,13::Asia/
Almaty
:
Central Asia Standard Time:12,13::Asia/
Almaty
:
N. Central Asia Standard Time:12,13::Asia/Novosibirsk:
Bangkok:14,15::Asia/Bangkok:
Bangkok Standard Time:14,15::Asia/Bangkok:
...
...
@@ -167,22 +166,27 @@ Greenwich:88,89::GMT:
Greenwich Standard Time:88,89::GMT:
Argentina Standard Time:900,900::America/Buenos_Aires:
Azerbaijan Standard Time:901,901:AZ:Asia/Baku:
Central Brazilian Standard Time:902,902:BR:America/Manaus:
Central Standard Time (Mexico):903,903::America/Mexico_City:
Georgian Standard Time:904,904:GE:Asia/Tbilisi:
Jordan Standard Time:905,905:JO:Asia/Amman:
Mauritius Standard Time:906,906:MU:Indian/Mauritius:
Middle East Standard Time:907,907:LB:Asia/Beirut:
Montevideo Standard Time:908,908:UY:America/Montevideo:
Morocco Standard Time:909,909:MA:Africa/Casablanca:
Mountain Standard Time (Mexico):910,910:MX:America/Chihuahua:
Namibia Standard Time:911,911:NA:Africa/Windhoek:
Pacific Standard Time (Mexico):912,912:MX:America/Tijuana:
Pakistan Standard Time:913,913::Asia/Karachi:
UTC:914,914::UTC:
Venezuela Standard Time:915,915::America/Caracas:
Kamchatka Standard Time:916,916:RU:Asia/Kamchatka:
Paraguay Standard Time:917,917:PY:America/Asuncion:
Western Brazilian Standard Time:918,918:BR:America/Rio_Branco:
Ulaanbaatar Standard Time:919,919::Asia/Ulaanbaatar:
Armenian Standard Time:920,920:AM:Asia/Yerevan:
Bangladesh Standard Time:902,902::Asia/Dhaka:
Central Brazilian Standard Time:903,903:BR:America/Manaus:
Central Standard Time (Mexico):904,904::America/Mexico_City:
Georgian Standard Time:905,905:GE:Asia/Tbilisi:
Jordan Standard Time:906,906:JO:Asia/Amman:
Kamchatka Standard Time:907,907:RU:Asia/Kamchatka:
Mauritius Standard Time:908,908:MU:Indian/Mauritius:
Middle East Standard Time:909,909:LB:Asia/Beirut:
Montevideo Standard Time:910,910:UY:America/Montevideo:
Morocco Standard Time:911,911:MA:Africa/Casablanca:
Mountain Standard Time (Mexico):912,912:MX:America/Chihuahua:
Namibia Standard Time:913,913:NA:Africa/Windhoek:
Pacific Standard Time (Mexico):914,914:MX:America/Tijuana:
Pakistan Standard Time:915,915::Asia/Karachi:
Paraguay Standard Time:916,916:PY:America/Asuncion:
Syria Standard Time:917,917:SY:Asia/Damascus:
UTC:918,918::UTC:
UTC+12:919,919::GMT+1200:
UTC-02:920,920::GMT-0200:
UTC-11:921,921::GMT-1100:
Ulaanbaatar Standard Time:922,922::Asia/Ulaanbaatar:
Venezuela Standard Time:923,923::America/Caracas:
Western Brazilian Standard Time:924,924:BR:America/Rio_Branco:
Armenian Standard Time:925,925:AM:Asia/Yerevan:
test/java/beans/Introspector/6976577/Test6976577.java
0 → 100644
浏览文件 @
f7a6ec10
/*
* 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 6976577
* @summary Tests public methods in non-public beans
* @author Sergey Malenkov
*/
import
test.Accessor
;
import
java.beans.EventSetDescriptor
;
import
java.beans.IndexedPropertyDescriptor
;
import
java.beans.PropertyDescriptor
;
import
java.lang.reflect.Method
;
public
class
Test6976577
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Class
<?>
bt
=
Accessor
.
getBeanType
();
Class
<?>
lt
=
Accessor
.
getListenerType
();
// test PropertyDescriptor
PropertyDescriptor
pd
=
new
PropertyDescriptor
(
"boolean"
,
bt
);
test
(
pd
.
getReadMethod
());
test
(
pd
.
getWriteMethod
());
// test IndexedPropertyDescriptor
IndexedPropertyDescriptor
ipd
=
new
IndexedPropertyDescriptor
(
"indexed"
,
bt
);
test
(
ipd
.
getReadMethod
());
test
(
ipd
.
getWriteMethod
());
test
(
ipd
.
getIndexedReadMethod
());
test
(
ipd
.
getIndexedWriteMethod
());
// test EventSetDescriptor
EventSetDescriptor
esd
=
new
EventSetDescriptor
(
bt
,
"test"
,
lt
,
"process"
);
test
(
esd
.
getAddListenerMethod
());
test
(
esd
.
getRemoveListenerMethod
());
test
(
esd
.
getGetListenerMethod
());
test
(
esd
.
getListenerMethods
());
}
private
static
void
test
(
Method
...
methods
)
{
for
(
Method
method
:
methods
)
{
if
(
method
==
null
)
{
throw
new
Error
(
"public method is not found"
);
}
}
}
}
test/java/beans/Introspector/6976577/test/Accessor.java
0 → 100644
浏览文件 @
f7a6ec10
package
test
;
import
java.beans.PropertyChangeListener
;
import
java.beans.PropertyChangeSupport
;
import
java.util.EventListener
;
import
java.util.TooManyListenersException
;
public
class
Accessor
{
public
static
Class
<?>
getBeanType
()
{
return
Bean
.
class
;
}
public
static
Class
<?>
getListenerType
()
{
return
TestListener
.
class
;
}
}
interface
TestEvent
{
}
interface
TestListener
extends
EventListener
{
void
process
(
TestEvent
event
);
}
class
Bean
{
private
boolean
b
;
private
int
[]
indexed
;
private
TestListener
listener
;
private
final
PropertyChangeSupport
pcs
=
new
PropertyChangeSupport
(
this
);
public
void
addPropertyChangeListener
(
PropertyChangeListener
listener
)
{
this
.
pcs
.
addPropertyChangeListener
(
listener
);
}
public
void
addTestListener
(
TestListener
listener
)
throws
TooManyListenersException
{
if
(
listener
!=
null
)
{
if
(
this
.
listener
!=
null
)
{
throw
new
TooManyListenersException
();
}
this
.
listener
=
listener
;
}
}
public
void
removeTestListener
(
TestListener
listener
)
{
if
(
this
.
listener
==
listener
)
{
this
.
listener
=
null
;
}
}
public
TestListener
[]
getTestListeners
()
{
return
(
this
.
listener
!=
null
)
?
new
TestListener
[]
{
this
.
listener
}
:
new
TestListener
[
0
];
}
public
boolean
isBoolean
()
{
return
this
.
b
;
}
public
void
setBoolean
(
boolean
b
)
{
this
.
b
=
b
;
}
public
int
[]
getIndexed
()
{
return
this
.
indexed
;
}
public
void
setIndexed
(
int
[]
values
)
{
this
.
indexed
=
values
;
}
public
int
getIndexed
(
int
index
)
{
return
this
.
indexed
[
index
];
}
public
void
setIndexed
(
int
index
,
int
value
)
{
this
.
indexed
[
index
]
=
value
;
}
}
test/javax/swing/JComboBox/6632953/bug6632953.java
0 → 100644
浏览文件 @
f7a6ec10
/*
* 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 6632953
* @summary MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
* @author Alexander Potochkin
*/
import
javax.swing.JComboBox
;
import
javax.swing.plaf.metal.MetalComboBoxUI
;
public
class
bug6632953
{
public
static
void
main
(
String
...
args
)
throws
Exception
{
MetalComboBoxUI
ui
=
new
MetalComboBoxUI
();
ui
.
installUI
(
new
JComboBox
());
ui
.
getBaseline
(
new
JComboBox
(),
0
,
0
);
ui
.
getBaseline
(
new
JComboBox
(),
1
,
1
);
ui
.
getBaseline
(
new
JComboBox
(),
2
,
2
);
ui
.
getBaseline
(
new
JComboBox
(),
3
,
3
);
ui
.
getBaseline
(
new
JComboBox
(),
4
,
4
);
}
}
test/javax/swing/JScrollBar/6542335/bug6542335.java
0 → 100644
浏览文件 @
f7a6ec10
/*
* 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 6542335
@summary different behavior on knob of scroll bar between 1.4.2 and 5.0
@author Alexander Potochkin
@run main bug6542335
*/
import
sun.awt.SunToolkit
;
import
javax.swing.*
;
import
javax.swing.plaf.basic.BasicScrollBarUI
;
import
java.awt.*
;
import
java.awt.event.InputEvent
;
public
class
bug6542335
{
private
static
JScrollBar
sb
;
private
static
MyScrollBarUI
ui
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
10
);
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
final
JFrame
frame
=
new
JFrame
(
"bug6542335"
);
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
sb
=
new
JScrollBar
(
0
,
0
,
1
,
0
,
1
);
ui
=
new
MyScrollBarUI
();
sb
.
setUI
(
ui
);
sb
.
setPreferredSize
(
new
Dimension
(
200
,
17
));
DefaultBoundedRangeModel
rangeModel
=
new
DefaultBoundedRangeModel
();
rangeModel
.
setMaximum
(
100
);
rangeModel
.
setMinimum
(
0
);
rangeModel
.
setExtent
(
50
);
rangeModel
.
setValue
(
50
);
sb
.
setModel
(
rangeModel
);
frame
.
add
(
sb
);
frame
.
setSize
(
200
,
100
);
frame
.
setVisible
(
true
);
}
});
Rectangle
thumbBounds
=
new
Rectangle
(
ui
.
getThumbBounds
());
toolkit
.
realSync
();
Point
l
=
sb
.
getLocationOnScreen
();
robot
.
mouseMove
(
l
.
x
+
(
int
)
(
0.75
*
sb
.
getWidth
()),
l
.
y
+
sb
.
getHeight
()/
2
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
toolkit
.
realSync
();
if
(!
thumbBounds
.
equals
(
ui
.
getThumbBounds
()))
{
throw
new
RuntimeException
(
"Test failed"
);
}
}
static
class
MyScrollBarUI
extends
BasicScrollBarUI
{
public
Rectangle
getThumbBounds
()
{
return
super
.
getThumbBounds
();
}
}
}
test/javax/swing/JTable/Test6888156.java
浏览文件 @
f7a6ec10
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
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
...
...
@@ -71,14 +71,14 @@ public class Test6888156 {
table
=
new
JTable
(
model
);
}
public
void
test
(
final
LookAndFeel
laf
)
throws
Exception
{
public
void
test
(
final
String
laf
)
throws
Exception
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
System
.
out
.
println
(
laf
);
UIManager
.
setLookAndFeel
(
laf
);
}
catch
(
UnsupportedLookAndFeelException
e
)
{
System
.
err
.
println
(
laf
.
getDescription
()
+
" is unsupported; continuing"
);
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
laf
+
" is unsupported; continuing"
);
return
;
}
SwingUtilities
.
updateComponentTreeUI
(
table
);
...
...
@@ -92,8 +92,10 @@ public class Test6888156 {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Test6888156
t
=
new
Test6888156
();
t
.
test
(
new
javax
.
swing
.
plaf
.
nimbus
.
NimbusLookAndFeel
());
t
.
test
(
new
com
.
sun
.
java
.
swing
.
plaf
.
gtk
.
GTKLookAndFeel
());
t
.
test
(
"javax.swing.plaf.nimbus.NimbusLookAndFeel"
);
t
.
test
(
"com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
);
for
(
UIManager
.
LookAndFeelInfo
laf
:
UIManager
.
getInstalledLookAndFeels
())
{
t
.
test
(
laf
.
getClassName
());
}
}
}
test/javax/swing/JTextArea/6940863/bug6940863.java
浏览文件 @
f7a6ec10
...
...
@@ -56,6 +56,7 @@ public class bug6940863 {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(
OSInfo
.
getOSType
()
!=
OSInfo
.
OSType
.
WINDOWS
)
{
System
.
out
.
println
(
"The test is suitable only for Windows OS. Skipped"
);
return
;
}
UIManager
.
setLookAndFeel
(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录