Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a0158dbd
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看板
提交
a0158dbd
编写于
6月 18, 2008
作者:
D
dav
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
15cd2c3b
6ea83095
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
276 addition
and
262 deletion
+276
-262
src/share/classes/java/awt/Component.java
src/share/classes/java/awt/Component.java
+1
-1
src/share/classes/java/awt/Container.java
src/share/classes/java/awt/Container.java
+184
-212
src/share/classes/java/awt/ScrollPane.java
src/share/classes/java/awt/ScrollPane.java
+41
-37
src/windows/native/sun/windows/awt_Container.cpp
src/windows/native/sun/windows/awt_Container.cpp
+1
-9
src/windows/native/sun/windows/awt_Container.h
src/windows/native/sun/windows/awt_Container.h
+1
-3
test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java
...va/awt/Container/CheckZOrderChange/CheckZOrderChange.java
+48
-0
未找到文件。
src/share/classes/java/awt/Component.java
浏览文件 @
a0158dbd
...
...
@@ -2141,7 +2141,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
Toolkit
.
getEventQueue
().
postEvent
(
e
);
}
}
else
{
if
(
this
instanceof
Container
&&
((
Container
)
this
).
ncomponents
>
0
)
{
if
(
this
instanceof
Container
&&
((
Container
)
this
).
countComponents
()
>
0
)
{
boolean
enabledOnToolkit
=
Toolkit
.
enabledOnToolkit
(
AWTEvent
.
HIERARCHY_BOUNDS_EVENT_MASK
);
if
(
resized
)
{
...
...
src/share/classes/java/awt/Container.java
浏览文件 @
a0158dbd
此差异已折叠。
点击以展开。
src/share/classes/java/awt/ScrollPane.java
浏览文件 @
a0158dbd
...
...
@@ -357,7 +357,7 @@ public class ScrollPane extends Container implements Accessible {
*/
public
void
setScrollPosition
(
int
x
,
int
y
)
{
synchronized
(
getTreeLock
())
{
if
(
ncomponents
<=
0
)
{
if
(
getComponentCount
()==
0
)
{
throw
new
NullPointerException
(
"child is null"
);
}
hAdjustable
.
setValue
(
x
);
...
...
@@ -393,10 +393,12 @@ public class ScrollPane extends Container implements Accessible {
*/
@Transient
public
Point
getScrollPosition
()
{
if
(
ncomponents
<=
0
)
{
throw
new
NullPointerException
(
"child is null"
);
synchronized
(
getTreeLock
())
{
if
(
getComponentCount
()==
0
)
{
throw
new
NullPointerException
(
"child is null"
);
}
return
new
Point
(
hAdjustable
.
getValue
(),
vAdjustable
.
getValue
());
}
return
new
Point
(
hAdjustable
.
getValue
(),
vAdjustable
.
getValue
());
}
/**
...
...
@@ -486,26 +488,27 @@ public class ScrollPane extends Container implements Accessible {
*/
@Deprecated
public
void
layout
()
{
if
(
ncomponents
>
0
)
{
Component
c
=
getComponent
(
0
);
Point
p
=
getScrollPosition
();
Dimension
cs
=
calculateChildSize
();
Dimension
vs
=
getViewportSize
();
Insets
i
=
getInsets
();
c
.
reshape
(
i
.
left
-
p
.
x
,
i
.
top
-
p
.
y
,
cs
.
width
,
cs
.
height
);
ScrollPanePeer
peer
=
(
ScrollPanePeer
)
this
.
peer
;
if
(
peer
!=
null
)
{
peer
.
childResized
(
cs
.
width
,
cs
.
height
);
}
if
(
getComponentCount
()==
0
)
{
return
;
}
Component
c
=
getComponent
(
0
);
Point
p
=
getScrollPosition
();
Dimension
cs
=
calculateChildSize
();
Dimension
vs
=
getViewportSize
();
Insets
i
=
getInsets
();
// update adjustables... the viewport size may have changed
// with the scrollbars coming or going so the viewport size
// is updated before the adjustables.
vs
=
getViewportSize
();
hAdjustable
.
setSpan
(
0
,
cs
.
width
,
vs
.
width
);
vAdjustable
.
setSpan
(
0
,
cs
.
height
,
vs
.
height
);
c
.
reshape
(
i
.
left
-
p
.
x
,
i
.
top
-
p
.
y
,
cs
.
width
,
cs
.
height
);
ScrollPanePeer
peer
=
(
ScrollPanePeer
)
this
.
peer
;
if
(
peer
!=
null
)
{
peer
.
childResized
(
cs
.
width
,
cs
.
height
);
}
// update adjustables... the viewport size may have changed
// with the scrollbars coming or going so the viewport size
// is updated before the adjustables.
vs
=
getViewportSize
();
hAdjustable
.
setSpan
(
0
,
cs
.
width
,
vs
.
width
);
vAdjustable
.
setSpan
(
0
,
cs
.
height
,
vs
.
height
);
}
/**
...
...
@@ -515,20 +518,21 @@ public class ScrollPane extends Container implements Accessible {
* @see Component#printAll
*/
public
void
printComponents
(
Graphics
g
)
{
if
(
ncomponents
>
0
)
{
Component
c
=
component
[
0
];
Point
p
=
c
.
getLocation
();
Dimension
vs
=
getViewportSize
();
Insets
i
=
getInsets
();
Graphics
cg
=
g
.
create
();
try
{
cg
.
clipRect
(
i
.
left
,
i
.
top
,
vs
.
width
,
vs
.
height
);
cg
.
translate
(
p
.
x
,
p
.
y
);
c
.
printAll
(
cg
);
}
finally
{
cg
.
dispose
();
}
if
(
getComponentCount
()==
0
)
{
return
;
}
Component
c
=
getComponent
(
0
);
Point
p
=
c
.
getLocation
();
Dimension
vs
=
getViewportSize
();
Insets
i
=
getInsets
();
Graphics
cg
=
g
.
create
();
try
{
cg
.
clipRect
(
i
.
left
,
i
.
top
,
vs
.
width
,
vs
.
height
);
cg
.
translate
(
p
.
x
,
p
.
y
);
c
.
printAll
(
cg
);
}
finally
{
cg
.
dispose
();
}
}
...
...
@@ -589,7 +593,7 @@ public class ScrollPane extends Container implements Accessible {
default
:
sdpStr
=
"invalid display policy"
;
}
Point
p
=
ncomponents
>
0
?
getScrollPosition
()
:
new
Point
(
0
,
0
);
Point
p
=
(
getComponentCount
()>
0
)
?
getScrollPosition
()
:
new
Point
(
0
,
0
);
Insets
i
=
getInsets
();
return
super
.
paramString
()+
",ScrollPosition=("
+
p
.
x
+
","
+
p
.
y
+
")"
+
",Insets=("
+
i
.
top
+
","
+
i
.
left
+
","
+
i
.
bottom
+
","
+
i
.
right
+
")"
+
...
...
src/windows/native/sun/windows/awt_Container.cpp
浏览文件 @
a0158dbd
/*
* Copyright 1998-200
0
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-200
8
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -30,8 +30,6 @@
* AwtContainer fields
*/
jfieldID
AwtContainer
::
ncomponentsID
;
jfieldID
AwtContainer
::
componentID
;
jfieldID
AwtContainer
::
layoutMgrID
;
jmethodID
AwtContainer
::
findComponentAtMID
;
...
...
@@ -45,18 +43,12 @@ JNIEXPORT void JNICALL
Java_java_awt_Container_initIDs
(
JNIEnv
*
env
,
jclass
cls
)
{
TRY
;
AwtContainer
::
ncomponentsID
=
env
->
GetFieldID
(
cls
,
"ncomponents"
,
"I"
);
AwtContainer
::
componentID
=
env
->
GetFieldID
(
cls
,
"component"
,
"[Ljava/awt/Component;"
);
AwtContainer
::
layoutMgrID
=
env
->
GetFieldID
(
cls
,
"layoutMgr"
,
"Ljava/awt/LayoutManager;"
);
AwtContainer
::
findComponentAtMID
=
env
->
GetMethodID
(
cls
,
"findComponentAt"
,
"(IIZ)Ljava/awt/Component;"
);
DASSERT
(
AwtContainer
::
ncomponentsID
!=
NULL
);
DASSERT
(
AwtContainer
::
componentID
!=
NULL
);
DASSERT
(
AwtContainer
::
layoutMgrID
!=
NULL
);
DASSERT
(
AwtContainer
::
findComponentAtMID
);
...
...
src/windows/native/sun/windows/awt_Container.h
浏览文件 @
a0158dbd
/*
* Copyright 1998-
1999
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-
2008
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -37,8 +37,6 @@ class AwtContainer {
public:
/* java.awt.Container field ids */
static
jfieldID
ncomponentsID
;
static
jfieldID
componentID
;
static
jfieldID
layoutMgrID
;
static
jmethodID
findComponentAtMID
;
...
...
test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java
0 → 100644
浏览文件 @
a0158dbd
/*
@test %I% %E%
@bug 2161766
@summary Component is missing after changing the z-order of the component & focus is not transfered in
@author Andrei Dmitriev : area=awt.container
@run main CheckZOrderChange
*/
import
java.awt.*
;
import
java.awt.event.*
;
public
class
CheckZOrderChange
{
private
static
Button
content
[]
=
new
Button
[]{
new
Button
(
"Button 1"
),
new
Button
(
"Button 2"
),
new
Button
(
"Button 3"
),
new
Button
(
"Button 4"
)};
private
static
Frame
frame
;
public
static
void
main
(
String
[]
args
)
{
frame
=
new
Frame
(
"Test Frame"
);
frame
.
setLayout
(
new
FlowLayout
());
for
(
Button
b:
content
){
frame
.
add
(
b
);
}
frame
.
setSize
(
300
,
300
);
frame
.
setVisible
(
true
);
/* INITIAL ZORDERS ARE*/
for
(
Button
b:
content
){
System
.
out
.
println
(
"frame.getComponentZOrder("
+
b
+
") = "
+
frame
.
getComponentZOrder
(
b
));
}
//Change the Z Order
frame
.
setComponentZOrder
(
content
[
0
],
2
);
System
.
out
.
println
(
"ZOrder of button1 changed to 2"
);
if
(
frame
.
getComponentZOrder
(
content
[
0
])
!=
2
||
frame
.
getComponentZOrder
(
content
[
1
])
!=
0
||
frame
.
getComponentZOrder
(
content
[
2
])
!=
1
||
frame
.
getComponentZOrder
(
content
[
3
])
!=
3
)
{
for
(
Button
b:
content
){
System
.
out
.
println
(
"frame.getComponentZOrder("
+
b
+
") = "
+
frame
.
getComponentZOrder
(
b
));
}
throw
new
RuntimeException
(
"TEST FAILED: getComponentZOrder did not return the correct value"
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录