Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
42f0da49
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看板
提交
42f0da49
编写于
10月 24, 2013
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7090424: TestGlyphVectorLayout failed automately with java.lang.StackOverflowError
Reviewed-by: anthony, art
上级
44b81e08
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
744 addition
and
77 deletion
+744
-77
src/solaris/classes/sun/awt/X11/XButtonPeer.java
src/solaris/classes/sun/awt/X11/XButtonPeer.java
+11
-8
src/solaris/classes/sun/awt/X11/XCanvasPeer.java
src/solaris/classes/sun/awt/X11/XCanvasPeer.java
+0
-11
src/solaris/classes/sun/awt/X11/XCheckboxPeer.java
src/solaris/classes/sun/awt/X11/XCheckboxPeer.java
+18
-14
src/solaris/classes/sun/awt/X11/XComponentPeer.java
src/solaris/classes/sun/awt/X11/XComponentPeer.java
+17
-5
src/solaris/classes/sun/awt/X11/XContentWindow.java
src/solaris/classes/sun/awt/X11/XContentWindow.java
+4
-4
src/solaris/classes/sun/awt/X11/XLabelPeer.java
src/solaris/classes/sun/awt/X11/XLabelPeer.java
+13
-11
src/solaris/classes/sun/awt/X11/XListPeer.java
src/solaris/classes/sun/awt/X11/XListPeer.java
+9
-7
src/solaris/classes/sun/awt/X11/XWindow.java
src/solaris/classes/sun/awt/X11/XWindow.java
+14
-17
test/java/awt/Paint/ButtonRepaint.java
test/java/awt/Paint/ButtonRepaint.java
+88
-0
test/java/awt/Paint/CheckboxRepaint.java
test/java/awt/Paint/CheckboxRepaint.java
+93
-0
test/java/awt/Paint/ExposeOnEDT.java
test/java/awt/Paint/ExposeOnEDT.java
+293
-0
test/java/awt/Paint/LabelRepaint.java
test/java/awt/Paint/LabelRepaint.java
+93
-0
test/java/awt/Paint/ListRepaint.java
test/java/awt/Paint/ListRepaint.java
+91
-0
未找到文件。
src/solaris/classes/sun/awt/X11/XButtonPeer.java
浏览文件 @
42f0da49
/*
* Copyright (c) 2002, 20
0
3, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
1
3, 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
...
...
@@ -79,10 +79,17 @@ public class XButtonPeer extends XComponentPeer implements ButtonPeer {
return
true
;
}
public
void
setLabel
(
java
.
lang
.
String
label
)
{
this
.
label
=
label
;
repaint
();
@Override
public
void
setLabel
(
String
label
)
{
if
(
label
==
null
)
{
label
=
""
;
}
if
(!
label
.
equals
(
this
.
label
))
{
this
.
label
=
label
;
repaint
();
}
}
public
void
setBackground
(
Color
c
)
{
updateMotifColors
(
c
);
super
.
setBackground
(
c
);
...
...
@@ -257,10 +264,6 @@ public class XButtonPeer extends XComponentPeer implements ButtonPeer {
drawMotif3DRect
(
g
,
x
,
y
,
w
-
1
,
h
-
1
,
pressed
);
}
public
void
setFont
(
Font
f
)
{
super
.
setFont
(
f
);
target
.
repaint
();
}
protected
void
paintFocus
(
Graphics
g
,
int
x
,
int
y
,
int
w
,
int
h
){
g
.
setColor
(
focusColor
);
g
.
drawRect
(
x
,
y
,
w
,
h
);
...
...
src/solaris/classes/sun/awt/X11/XCanvasPeer.java
浏览文件 @
42f0da49
...
...
@@ -103,15 +103,4 @@ class XCanvasPeer extends XComponentPeer implements CanvasPeer {
protected
boolean
doEraseBackground
()
{
return
!
eraseBackgroundDisabled
;
}
public
void
setBackground
(
Color
c
)
{
boolean
doRepaint
=
false
;
if
(
getPeerBackground
()
==
null
||
!
getPeerBackground
().
equals
(
c
)
)
{
doRepaint
=
true
;
}
super
.
setBackground
(
c
);
if
(
doRepaint
)
{
target
.
repaint
();
}
}
}
src/solaris/classes/sun/awt/X11/XCheckboxPeer.java
浏览文件 @
42f0da49
...
...
@@ -31,6 +31,7 @@ import java.awt.event.*;
import
java.awt.image.BufferedImage
;
import
javax.swing.plaf.basic.BasicGraphicsUtils
;
import
java.awt.geom.AffineTransform
;
import
java.util.Objects
;
import
sun.util.logging.PlatformLogger
;
...
...
@@ -135,14 +136,16 @@ class XCheckboxPeer extends XComponentPeer implements CheckboxPeer {
public
void
keyReleased
(
KeyEvent
e
)
{}
public
void
setLabel
(
java
.
lang
.
String
label
)
{
if
(
label
==
null
)
{
this
.
label
=
""
;
}
else
{
@Override
public
void
setLabel
(
String
label
)
{
if
(
label
==
null
)
{
label
=
""
;
}
if
(!
label
.
equals
(
this
.
label
))
{
this
.
label
=
label
;
layout
();
repaint
();
}
layout
();
repaint
();
}
void
handleJavaMouseEvent
(
MouseEvent
e
)
{
...
...
@@ -377,10 +380,6 @@ class XCheckboxPeer extends XComponentPeer implements CheckboxPeer {
g
.
drawImage
(
buffer
,
x
,
y
,
null
);
}
}
public
void
setFont
(
Font
f
)
{
super
.
setFont
(
f
);
target
.
repaint
();
}
public
void
paintRadioButton
(
Graphics
g
,
int
x
,
int
y
,
int
w
,
int
h
)
{
...
...
@@ -424,16 +423,21 @@ class XCheckboxPeer extends XComponentPeer implements CheckboxPeer {
g
.
drawRect
(
x
,
y
,
w
,
h
);
}
@Override
public
void
setState
(
boolean
state
)
{
if
(
selected
!=
state
)
{
selected
=
state
;
repaint
();
}
}
public
void
setCheckboxGroup
(
CheckboxGroup
g
)
{
// If changed from grouped/ungrouped, need to repaint()
checkBoxGroup
=
g
;
repaint
();
@Override
public
void
setCheckboxGroup
(
final
CheckboxGroup
g
)
{
if
(!
Objects
.
equals
(
g
,
checkBoxGroup
))
{
// If changed from grouped/ungrouped, need to repaint()
checkBoxGroup
=
g
;
repaint
();
}
}
// NOTE: This method is called by privileged threads.
...
...
src/solaris/classes/sun/awt/X11/XComponentPeer.java
浏览文件 @
42f0da49
...
...
@@ -61,6 +61,7 @@ import java.awt.peer.ContainerPeer;
import
java.lang.reflect.*
;
import
java.security.*
;
import
java.util.Collection
;
import
java.util.Objects
;
import
java.util.Set
;
import
sun.util.logging.PlatformLogger
;
import
sun.awt.*
;
...
...
@@ -635,22 +636,30 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
g
.
drawLine
(
x
+
width
,
y
+
height
,
x
+
width
,
y
+
1
);
// right
}
@Override
public
void
setBackground
(
Color
c
)
{
if
(
log
.
isLoggable
(
PlatformLogger
.
Level
.
FINE
))
{
log
.
fine
(
"Set background to "
+
c
);
}
synchronized
(
getStateLock
())
{
if
(
Objects
.
equals
(
background
,
c
))
{
return
;
}
background
=
c
;
}
super
.
setBackground
(
c
);
repaint
();
}
@Override
public
void
setForeground
(
Color
c
)
{
if
(
log
.
isLoggable
(
PlatformLogger
.
Level
.
FINE
))
{
log
.
fine
(
"Set foreground to "
+
c
);
}
synchronized
(
getStateLock
())
{
if
(
Objects
.
equals
(
foreground
,
c
))
{
return
;
}
foreground
=
c
;
}
repaint
();
...
...
@@ -674,18 +683,21 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
return
sun
.
font
.
FontDesignMetrics
.
getMetrics
(
font
);
}
@Override
public
void
setFont
(
Font
f
)
{
if
(
f
==
null
)
{
f
=
XWindow
.
getDefaultFont
();
}
synchronized
(
getStateLock
())
{
if
(
f
==
null
)
{
f
=
XWindow
.
getDefaultFont
()
;
if
(
f
.
equals
(
font
)
)
{
return
;
}
font
=
f
;
}
// as it stands currently we dont need to do layout
or repaint
since
// as it stands currently we dont need to do layout since
// layout is done in the Component upon setFont.
//layout();
// target.repaint();
//repaint()?
repaint
();
}
public
Font
getFont
()
{
...
...
src/solaris/classes/sun/awt/X11/XContentWindow.java
浏览文件 @
42f0da49
/*
* Copyright (c) 2003, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
13
, 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
...
...
@@ -142,7 +142,7 @@ public final class XContentWindow extends XWindow {
}
public
void
handleExpose
Event
(
Component
target
,
int
x
,
int
y
,
int
w
,
int
h
)
{
public
void
postPaint
Event
(
Component
target
,
int
x
,
int
y
,
int
w
,
int
h
)
{
// TODO: ?
// get rid of 'istanceof' by subclassing:
// XContentWindow -> XFrameContentWindow
...
...
@@ -160,13 +160,13 @@ public final class XContentWindow extends XWindow {
iconifiedExposeEvents
.
add
(
new
SavedExposeEvent
(
target
,
x
,
y
,
w
,
h
));
}
else
{
// Normal case: [it is not a frame or] the frame is not iconified.
super
.
handleExpose
Event
(
target
,
x
,
y
,
w
,
h
);
super
.
postPaint
Event
(
target
,
x
,
y
,
w
,
h
);
}
}
void
purgeIconifiedExposeEvents
()
{
for
(
SavedExposeEvent
evt
:
iconifiedExposeEvents
)
{
super
.
handleExpose
Event
(
evt
.
target
,
evt
.
x
,
evt
.
y
,
evt
.
w
,
evt
.
h
);
super
.
postPaint
Event
(
evt
.
target
,
evt
.
x
,
evt
.
y
,
evt
.
w
,
evt
.
h
);
}
iconifiedExposeEvents
.
clear
();
}
...
...
src/solaris/classes/sun/awt/X11/XLabelPeer.java
浏览文件 @
42f0da49
/*
* Copyright (c) 2002, 20
0
3, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
1
3, 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
...
...
@@ -132,20 +132,22 @@ class XLabelPeer extends XComponentPeer implements LabelPeer {
}
}
public
void
setText
(
String
text
)
{
label
=
text
;
@Override
public
void
setText
(
String
label
)
{
if
(
label
==
null
)
{
label
=
""
;
}
repaint
();
}
public
void
setFont
(
Font
f
)
{
super
.
setFont
(
f
);
repaint
();
if
(!
label
.
equals
(
this
.
label
))
{
this
.
label
=
label
;
repaint
();
}
}
public
void
setAlignment
(
int
align
)
{
alignment
=
align
;
repaint
();
@Override
public
void
setAlignment
(
final
int
alignment
)
{
if
(
this
.
alignment
!=
alignment
)
{
this
.
alignment
=
alignment
;
repaint
();
}
}
}
src/solaris/classes/sun/awt/X11/XListPeer.java
浏览文件 @
42f0da49
...
...
@@ -31,8 +31,8 @@ package sun.awt.X11;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.awt.peer.*
;
import
java.util.Objects
;
import
java.util.Vector
;
import
java.awt.geom.*
;
import
java.awt.image.*
;
import
sun.util.logging.PlatformLogger
;
...
...
@@ -409,7 +409,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
if
(
g
!=
null
)
{
try
{
painter
.
paint
(
g
,
firstItem
,
lastItem
,
options
,
source
,
distance
);
target
.
paint
(
g
);
postPaintEvent
(
target
,
0
,
0
,
getWidth
(),
getHeight
()
);
}
finally
{
g
.
dispose
();
}
...
...
@@ -1682,11 +1682,13 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
* The bug is due to incorrent caching of the list item size
* So we should recalculate font metrics on setFont
*/
public
void
setFont
(
Font
f
){
super
.
setFont
(
f
);
initFontMetrics
();
layout
();
repaint
();
public
void
setFont
(
Font
f
)
{
if
(!
Objects
.
equals
(
getFont
(),
f
))
{
super
.
setFont
(
f
);
initFontMetrics
();
layout
();
repaint
();
}
}
/**
...
...
src/solaris/classes/sun/awt/X11/XWindow.java
浏览文件 @
42f0da49
...
...
@@ -32,7 +32,6 @@ import java.awt.image.ColorModel;
import
java.lang.ref.WeakReference
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
sun.util.logging.PlatformLogger
;
...
...
@@ -491,33 +490,31 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
public
boolean
isEmbedded
()
{
return
embedded
;
}
public
void
repaint
(
int
x
,
int
y
,
int
width
,
int
height
)
{
public
final
void
repaint
(
int
x
,
int
y
,
int
width
,
int
height
)
{
if
(!
isVisible
()
||
getWidth
()
==
0
||
getHeight
()
==
0
)
{
return
;
}
Graphics
g
=
getGraphics
();
if
(
g
!=
null
)
{
try
{
g
.
setClip
(
x
,
y
,
width
,
height
);
paint
(
g
);
g
.
setClip
(
x
,
y
,
width
,
height
);
if
(
SunToolkit
.
isDispatchThreadForAppContext
(
getTarget
()))
{
paint
(
g
);
// The native and target will be painted in place.
}
else
{
paintPeer
(
g
);
postPaintEvent
(
target
,
x
,
y
,
width
,
height
);
}
}
finally
{
g
.
dispose
();
}
}
}
void
repaint
()
{
if
(!
isVisible
()
||
getWidth
()
==
0
||
getHeight
()
==
0
)
{
return
;
}
final
Graphics
g
=
getGraphics
();
if
(
g
!=
null
)
{
try
{
paint
(
g
);
}
finally
{
g
.
dispose
();
}
}
repaint
(
0
,
0
,
getWidth
(),
getHeight
());
}
public
void
paint
(
final
Graphics
g
)
{
// paint peer
paintPeer
(
g
);
...
...
@@ -558,11 +555,11 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
&&
compAccessor
.
getWidth
(
target
)
!=
0
&&
compAccessor
.
getHeight
(
target
)
!=
0
)
{
handleExpose
Event
(
target
,
x
,
y
,
w
,
h
);
postPaint
Event
(
target
,
x
,
y
,
w
,
h
);
}
}
public
void
handleExpose
Event
(
Component
target
,
int
x
,
int
y
,
int
w
,
int
h
)
{
public
void
postPaint
Event
(
Component
target
,
int
x
,
int
y
,
int
w
,
int
h
)
{
PaintEvent
event
=
PaintEventDispatcher
.
getPaintEventDispatcher
().
createPaintEvent
(
target
,
x
,
y
,
w
,
h
);
if
(
event
!=
null
)
{
...
...
test/java/awt/Paint/ButtonRepaint.java
0 → 100644
浏览文件 @
42f0da49
/*
* Copyright (c) 2013, 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.
*/
import
java.awt.*
;
import
java.awt.peer.ButtonPeer
;
/**
* @test
* @bug 7090424
* @author Sergey Bylokhov
*/
public
final
class
ButtonRepaint
extends
Button
{
public
static
void
main
(
final
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
final
Frame
frame
=
new
Frame
();
frame
.
setSize
(
300
,
300
);
frame
.
setLocationRelativeTo
(
null
);
ButtonRepaint
button
=
new
ButtonRepaint
();
frame
.
add
(
button
);
frame
.
setVisible
(
true
);
sleep
();
button
.
test
();
frame
.
dispose
();
}
}
private
static
void
sleep
()
{
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
ignored
)
{
}
}
@Override
public
void
paint
(
final
Graphics
g
)
{
super
.
paint
(
g
);
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
test
();
}
void
test
()
{
setLabel
(
""
);
setLabel
(
null
);
setLabel
(
getLabel
());
((
ButtonPeer
)
getPeer
()).
setLabel
(
""
);
((
ButtonPeer
)
getPeer
()).
setLabel
(
null
);
((
ButtonPeer
)
getPeer
()).
setLabel
(
getLabel
());
setFont
(
null
);
setFont
(
getFont
());
getPeer
().
setFont
(
getFont
());
setBackground
(
null
);
setBackground
(
getBackground
());
getPeer
().
setBackground
(
getBackground
());
setForeground
(
null
);
setForeground
(
getForeground
());
getPeer
().
setForeground
(
getForeground
());
setEnabled
(
isEnabled
());
getPeer
().
setEnabled
(
isEnabled
());
}
}
test/java/awt/Paint/CheckboxRepaint.java
0 → 100644
浏览文件 @
42f0da49
/*
* Copyright (c) 2013, 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.
*/
import
java.awt.*
;
import
java.awt.peer.CheckboxPeer
;
/**
* @test
* @bug 7090424
* @author Sergey Bylokhov
*/
public
final
class
CheckboxRepaint
extends
Checkbox
{
public
static
void
main
(
final
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
final
Frame
frame
=
new
Frame
();
frame
.
setSize
(
300
,
300
);
frame
.
setLocationRelativeTo
(
null
);
CheckboxRepaint
checkbox
=
new
CheckboxRepaint
();
frame
.
add
(
checkbox
);
frame
.
setVisible
(
true
);
sleep
();
checkbox
.
test
();
frame
.
dispose
();
}
}
private
static
void
sleep
()
{
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
ignored
)
{
}
}
@Override
public
void
paint
(
final
Graphics
g
)
{
super
.
paint
(
g
);
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
test
();
}
void
test
()
{
setState
(
getState
());
((
CheckboxPeer
)
getPeer
()).
setState
(
getState
());
setCheckboxGroup
(
getCheckboxGroup
());
((
CheckboxPeer
)
getPeer
()).
setCheckboxGroup
(
getCheckboxGroup
());
setLabel
(
""
);
setLabel
(
null
);
setLabel
(
getLabel
());
((
CheckboxPeer
)
getPeer
()).
setLabel
(
""
);
((
CheckboxPeer
)
getPeer
()).
setLabel
(
null
);
((
CheckboxPeer
)
getPeer
()).
setLabel
(
getLabel
());
setFont
(
null
);
setFont
(
getFont
());
getPeer
().
setFont
(
getFont
());
setBackground
(
null
);
setBackground
(
getBackground
());
getPeer
().
setBackground
(
getBackground
());
setForeground
(
null
);
setForeground
(
getForeground
());
getPeer
().
setForeground
(
getForeground
());
setEnabled
(
isEnabled
());
getPeer
().
setEnabled
(
isEnabled
());
}
}
test/java/awt/Paint/ExposeOnEDT.java
0 → 100644
浏览文件 @
42f0da49
/*
* Copyright (c) 2013, 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.
*/
import
sun.awt.SunToolkit
;
import
java.awt.*
;
/**
* @test
* @bug 7090424
* @author Sergey Bylokhov
* @run main ExposeOnEDT
*/
public
final
class
ExposeOnEDT
{
private
static
final
Button
buttonStub
=
new
Button
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
buttonPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
Canvas
canvasStub
=
new
Canvas
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
canvasPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
Checkbox
checkboxStub
=
new
Checkbox
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
checkboxPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
Choice
choiceStub
=
new
Choice
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
choicePainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
Component
lwComponentStub
=
new
Component
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
lwPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
Container
containerStub
=
new
Container
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
containerPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
Frame
frame
=
new
Frame
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
super
.
paint
(
g
);
framePainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
Label
labelStub
=
new
Label
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
labelPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
List
listStub
=
new
List
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
listPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
Panel
panelStub
=
new
Panel
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
panelPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
Scrollbar
scrollbarStub
=
new
Scrollbar
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
scrollbarPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
ScrollPane
scrollPaneStub
=
new
ScrollPane
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
scrollPanePainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
TextArea
textAreaStub
=
new
TextArea
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
textAreaPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
final
TextField
textFieldStub
=
new
TextField
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
textFieldPainted
=
true
;
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
}
};
private
static
volatile
boolean
lwPainted
;
private
static
volatile
boolean
buttonPainted
;
private
static
volatile
boolean
canvasPainted
;
private
static
volatile
boolean
checkboxPainted
;
private
static
volatile
boolean
choicePainted
;
private
static
volatile
boolean
containerPainted
;
private
static
volatile
boolean
framePainted
;
private
static
volatile
boolean
labelPainted
;
private
static
volatile
boolean
listPainted
;
private
static
volatile
boolean
panelPainted
;
private
static
volatile
boolean
scrollbarPainted
;
private
static
volatile
boolean
scrollPanePainted
;
private
static
volatile
boolean
textAreaPainted
;
private
static
volatile
boolean
textFieldPainted
;
public
static
void
main
(
final
String
[]
args
)
throws
Exception
{
//Frame initialisation
frame
.
setLayout
(
new
GridLayout
());
frame
.
setSize
(
new
Dimension
(
200
,
200
));
frame
.
setLocationRelativeTo
(
null
);
frame
.
setVisible
(
true
);
sleep
();
frame
.
add
(
buttonStub
);
frame
.
add
(
canvasStub
);
frame
.
add
(
checkboxStub
);
frame
.
add
(
choiceStub
);
frame
.
add
(
lwComponentStub
);
frame
.
add
(
containerStub
);
frame
.
add
(
labelStub
);
frame
.
add
(
listStub
);
frame
.
add
(
panelStub
);
frame
.
add
(
scrollbarStub
);
frame
.
add
(
scrollPaneStub
);
frame
.
add
(
textAreaStub
);
frame
.
add
(
textFieldStub
);
frame
.
validate
();
sleep
();
// Force expose event from the native system.
initPaintedFlags
();
frame
.
setSize
(
300
,
300
);
frame
.
validate
();
sleep
();
//Check results.
validation
();
cleanup
();
}
private
static
void
initPaintedFlags
()
{
lwPainted
=
false
;
buttonPainted
=
false
;
canvasPainted
=
false
;
checkboxPainted
=
false
;
choicePainted
=
false
;
containerPainted
=
false
;
framePainted
=
false
;
labelPainted
=
false
;
listPainted
=
false
;
panelPainted
=
false
;
scrollbarPainted
=
false
;
scrollPanePainted
=
false
;
textAreaPainted
=
false
;
textFieldPainted
=
false
;
}
private
static
void
validation
()
{
if
(!
buttonPainted
)
{
fail
(
"Paint is not called a Button "
);
}
if
(!
canvasPainted
)
{
fail
(
"Paint is not called a Canvas "
);
}
if
(!
checkboxPainted
)
{
fail
(
"Paint is not called a Checkbox "
);
}
if
(!
choicePainted
)
{
fail
(
"Paint is not called a Choice "
);
}
if
(!
lwPainted
)
{
fail
(
"Paint is not called on a lightweight"
);
}
if
(!
containerPainted
)
{
fail
(
"Paint is not called on a Container"
);
}
if
(!
labelPainted
)
{
fail
(
"Paint is not called on a Label"
);
}
if
(!
listPainted
)
{
fail
(
"Paint is not called on a List"
);
}
if
(!
panelPainted
)
{
fail
(
"Paint is not called on a Panel"
);
}
if
(!
scrollbarPainted
)
{
fail
(
"Paint is not called on a Scrollbar"
);
}
if
(!
scrollPanePainted
)
{
fail
(
"Paint is not called on a ScrollPane"
);
}
if
(!
textAreaPainted
)
{
fail
(
"Paint is not called on a TextArea"
);
}
if
(!
textFieldPainted
)
{
fail
(
"Paint is not called on a TextField"
);
}
if
(!
framePainted
)
{
fail
(
"Paint is not called on a Frame when paintAll()"
);
}
}
private
static
void
sleep
()
{
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
try
{
Thread
.
sleep
(
1000L
);
}
catch
(
InterruptedException
ignored
)
{
}
}
private
static
void
fail
(
final
String
message
)
{
cleanup
();
throw
new
RuntimeException
(
message
);
}
private
static
void
cleanup
()
{
frame
.
dispose
();
}
}
test/java/awt/Paint/LabelRepaint.java
0 → 100644
浏览文件 @
42f0da49
/*
* Copyright (c) 2013, 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.
*/
import
java.awt.EventQueue
;
import
java.awt.Frame
;
import
java.awt.Graphics
;
import
java.awt.Label
;
import
java.awt.peer.LabelPeer
;
/**
* @test
* @bug 7090424
* @author Sergey Bylokhov
*/
public
final
class
LabelRepaint
extends
Label
{
public
static
void
main
(
final
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
final
Frame
frame
=
new
Frame
();
frame
.
setSize
(
300
,
300
);
frame
.
setLocationRelativeTo
(
null
);
LabelRepaint
label
=
new
LabelRepaint
();
frame
.
add
(
label
);
frame
.
setVisible
(
true
);
sleep
();
label
.
test
();
frame
.
dispose
();
}
}
private
static
void
sleep
()
{
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
ignored
)
{
}
}
@Override
public
void
paint
(
final
Graphics
g
)
{
super
.
paint
(
g
);
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
test
();
}
void
test
()
{
setAlignment
(
getAlignment
());
((
LabelPeer
)
getPeer
()).
setAlignment
(
getAlignment
());
setText
(
""
);
setText
(
null
);
setText
(
getText
());
((
LabelPeer
)
getPeer
()).
setText
(
""
);
((
LabelPeer
)
getPeer
()).
setText
(
null
);
((
LabelPeer
)
getPeer
()).
setText
(
getText
());
setFont
(
null
);
setFont
(
getFont
());
getPeer
().
setFont
(
getFont
());
setBackground
(
null
);
setBackground
(
getBackground
());
getPeer
().
setBackground
(
getBackground
());
setForeground
(
null
);
setForeground
(
getForeground
());
getPeer
().
setForeground
(
getForeground
());
setEnabled
(
isEnabled
());
getPeer
().
setEnabled
(
isEnabled
());
}
}
test/java/awt/Paint/ListRepaint.java
0 → 100644
浏览文件 @
42f0da49
/*
* Copyright (c) 2013, 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.
*/
import
java.awt.EventQueue
;
import
java.awt.Frame
;
import
java.awt.Graphics
;
import
java.awt.List
;
import
java.awt.peer.ListPeer
;
/**
* @test
* @bug 7090424
* @author Sergey Bylokhov
*/
public
final
class
ListRepaint
extends
List
{
public
static
void
main
(
final
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
final
Frame
frame
=
new
Frame
();
frame
.
setSize
(
300
,
300
);
frame
.
setLocationRelativeTo
(
null
);
ListRepaint
list
=
new
ListRepaint
();
list
.
add
(
"1"
);
list
.
add
(
"2"
);
list
.
add
(
"3"
);
list
.
add
(
"4"
);
list
.
select
(
0
);
frame
.
add
(
list
);
frame
.
setVisible
(
true
);
sleep
();
list
.
test
();
frame
.
dispose
();
}
}
private
static
void
sleep
()
{
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
ignored
)
{
}
}
@Override
public
void
paint
(
final
Graphics
g
)
{
super
.
paint
(
g
);
if
(!
EventQueue
.
isDispatchThread
())
{
throw
new
RuntimeException
(
"Wrong thread"
);
}
test
();
}
void
test
()
{
select
(
0
);
((
ListPeer
)
getPeer
()).
select
(
getSelectedIndex
());
setFont
(
null
);
setFont
(
getFont
());
getPeer
().
setFont
(
getFont
());
setBackground
(
null
);
setBackground
(
getBackground
());
getPeer
().
setBackground
(
getBackground
());
setForeground
(
null
);
setForeground
(
getForeground
());
getPeer
().
setForeground
(
getForeground
());
setEnabled
(
isEnabled
());
getPeer
().
setEnabled
(
isEnabled
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录