Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
7216d912
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看板
提交
7216d912
编写于
7月 15, 2011
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6596915: JCK-runtime-6a/tests/api/java_awt/Component/index.html tesPaintAll fails
Reviewed-by: art, dcherepanov, anthony
上级
99bc636c
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
463 addition
and
206 deletion
+463
-206
src/solaris/classes/sun/awt/X11/XButtonPeer.java
src/solaris/classes/sun/awt/X11/XButtonPeer.java
+11
-32
src/solaris/classes/sun/awt/X11/XCheckboxPeer.java
src/solaris/classes/sun/awt/X11/XCheckboxPeer.java
+25
-32
src/solaris/classes/sun/awt/X11/XChoicePeer.java
src/solaris/classes/sun/awt/X11/XChoicePeer.java
+15
-9
src/solaris/classes/sun/awt/X11/XComponentPeer.java
src/solaris/classes/sun/awt/X11/XComponentPeer.java
+6
-15
src/solaris/classes/sun/awt/X11/XLabelPeer.java
src/solaris/classes/sun/awt/X11/XLabelPeer.java
+2
-1
src/solaris/classes/sun/awt/X11/XListPeer.java
src/solaris/classes/sun/awt/X11/XListPeer.java
+10
-13
src/solaris/classes/sun/awt/X11/XMenuBarPeer.java
src/solaris/classes/sun/awt/X11/XMenuBarPeer.java
+1
-1
src/solaris/classes/sun/awt/X11/XMenuWindow.java
src/solaris/classes/sun/awt/X11/XMenuWindow.java
+2
-2
src/solaris/classes/sun/awt/X11/XPanelPeer.java
src/solaris/classes/sun/awt/X11/XPanelPeer.java
+5
-6
src/solaris/classes/sun/awt/X11/XRepaintArea.java
src/solaris/classes/sun/awt/X11/XRepaintArea.java
+4
-4
src/solaris/classes/sun/awt/X11/XScrollPanePeer.java
src/solaris/classes/sun/awt/X11/XScrollPanePeer.java
+48
-56
src/solaris/classes/sun/awt/X11/XScrollbarPeer.java
src/solaris/classes/sun/awt/X11/XScrollbarPeer.java
+3
-9
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
+2
-3
src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
+2
-3
src/solaris/classes/sun/awt/X11/XWarningWindow.java
src/solaris/classes/sun/awt/X11/XWarningWindow.java
+17
-12
src/solaris/classes/sun/awt/X11/XWindow.java
src/solaris/classes/sun/awt/X11/XWindow.java
+9
-8
test/java/awt/Component/PaintAll/PaintAll.java
test/java/awt/Component/PaintAll/PaintAll.java
+301
-0
未找到文件。
src/solaris/classes/sun/awt/X11/XButtonPeer.java
浏览文件 @
7216d912
...
...
@@ -33,12 +33,9 @@ import java.awt.event.ActionEvent;
import
javax.swing.plaf.basic.*
;
import
javax.swing.SwingUtilities
;
import
javax.swing.SwingConstants
;
public
class
XButtonPeer
extends
XComponentPeer
implements
ButtonPeer
{
boolean
pressed
;
boolean
armed
;
private
boolean
pressed
;
private
boolean
armed
;
private
Insets
focusInsets
;
private
Insets
borderInsets
;
private
Insets
contentAreaInsets
;
...
...
@@ -86,11 +83,6 @@ public class XButtonPeer extends XComponentPeer implements ButtonPeer {
this
.
label
=
label
;
repaint
();
}
public
void
paint
(
Graphics
g
)
{
paint
(
g
,
target
);
}
public
void
setBackground
(
Color
c
)
{
updateMotifColors
(
c
);
super
.
setBackground
(
c
);
...
...
@@ -133,16 +125,10 @@ public class XButtonPeer extends XComponentPeer implements ButtonPeer {
case
MouseEvent
.
MOUSE_ENTERED
:
if
(
pressed
)
armed
=
true
;
// repaint();
break
;
case
MouseEvent
.
MOUSE_EXITED
:
armed
=
false
;
// repaint();
break
;
}
}
...
...
@@ -209,18 +195,14 @@ public class XButtonPeer extends XComponentPeer implements ButtonPeer {
public
Dimension
minimumSize
()
{
return
getMinimumSize
();
}
/*
This method is called from Toolkit Thread and so it should not call any client code
*/
public
void
paint
(
Graphics
g
,
Component
c
)
{
if
(!
disposed
&&
(
g
!=
null
))
{
/**
* This method is called from Toolkit Thread and so it should not call any
* client code.
*/
@Override
void
paintPeer
(
final
Graphics
g
)
{
if
(!
disposed
)
{
Dimension
size
=
getPeerSize
();
g
.
setColor
(
getPeerBackground
()
);
/* erase the existing button remains */
g
.
fillRect
(
0
,
0
,
size
.
width
,
size
.
height
);
paintBorder
(
g
,
borderInsets
.
left
,
...
...
@@ -239,11 +221,9 @@ public class XButtonPeer extends XComponentPeer implements ButtonPeer {
viewRect
.
width
=
size
.
width
-
(
contentAreaInsets
.
left
+
contentAreaInsets
.
right
);
viewRect
.
height
=
size
.
height
-
(
contentAreaInsets
.
top
+
contentAreaInsets
.
bottom
);
viewRect
.
x
=
contentAreaInsets
.
left
;
viewRect
.
y
=
contentAreaInsets
.
right
;
viewRect
.
y
=
contentAreaInsets
.
top
;
String
llabel
=
(
label
!=
null
)
?
label
:
""
;
// layout the text and icon
String
text
=
SwingUtilities
.
layoutCompoundLabel
(
fm
,
llabel
,
null
,
...
...
@@ -309,10 +289,9 @@ public class XButtonPeer extends XComponentPeer implements ButtonPeer {
else
{
/*** paint the text disabled ***/
g
.
setColor
(
getPeerBackground
().
brighter
());
BasicGraphicsUtils
.
drawStringUnderlineCharAt
(
g
,
text
,
mnemonicIndex
,
textRect
.
x
,
textRect
.
y
+
fm
.
getAscent
());
g
.
setColor
(
c
.
get
Background
().
darker
());
g
.
setColor
(
getPeer
Background
().
darker
());
BasicGraphicsUtils
.
drawStringUnderlineCharAt
(
g
,
text
,
mnemonicIndex
,
textRect
.
x
-
1
,
textRect
.
y
+
fm
.
getAscent
()
-
1
);
}
...
...
src/solaris/classes/sun/awt/X11/XCheckboxPeer.java
浏览文件 @
7216d912
...
...
@@ -297,40 +297,33 @@ class XCheckboxPeer extends XComponentPeer implements CheckboxPeer {
double
fsize
=
(
double
)
checkBoxSize
;
myCheckMark
=
AffineTransform
.
getScaleInstance
(
fsize
/
MASTER_SIZE
,
fsize
/
MASTER_SIZE
).
createTransformedShape
(
MASTER_CHECKMARK
);
}
@Override
void
paintPeer
(
final
Graphics
g
)
{
//layout();
Dimension
size
=
getPeerSize
();
Font
f
=
getPeerFont
();
flush
();
g
.
setColor
(
getPeerBackground
());
// erase the existing button
g
.
fillRect
(
0
,
0
,
size
.
width
,
size
.
height
);
if
(
label
!=
null
)
{
g
.
setFont
(
f
);
paintText
(
g
,
textRect
,
label
);
}
public
void
paint
(
Graphics
g
)
{
if
(
g
!=
null
)
{
//layout();
Dimension
size
=
getPeerSize
();
Font
f
=
getPeerFont
();
flush
();
g
.
setColor
(
getPeerBackground
());
// erase the existing button
g
.
fillRect
(
0
,
0
,
size
.
width
,
size
.
height
);
if
(
label
!=
null
)
{
g
.
setFont
(
f
);
paintText
(
g
,
textRect
,
label
);
}
if
(
hasFocus
())
{
paintFocus
(
g
,
focusRect
.
x
,
focusRect
.
y
,
focusRect
.
width
,
focusRect
.
height
);
}
// Paint the checkbox or radio button
if
(
checkBoxGroup
==
null
)
{
paintCheckbox
(
g
,
cbX
,
cbY
,
checkBoxSize
,
checkBoxSize
);
}
else
{
paintRadioButton
(
g
,
cbX
,
cbY
,
checkBoxSize
,
checkBoxSize
);
}
if
(
hasFocus
())
{
paintFocus
(
g
,
focusRect
.
x
,
focusRect
.
y
,
focusRect
.
width
,
focusRect
.
height
);
}
// Paint the checkbox or radio button
if
(
checkBoxGroup
==
null
)
{
paintCheckbox
(
g
,
cbX
,
cbY
,
checkBoxSize
,
checkBoxSize
);
}
else
{
paintRadioButton
(
g
,
cbX
,
cbY
,
checkBoxSize
,
checkBoxSize
);
}
flush
();
}
...
...
src/solaris/classes/sun/awt/X11/XChoicePeer.java
浏览文件 @
7216d912
...
...
@@ -550,10 +550,10 @@ public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelS
/**
* Paint the choice
*/
public
void
paint
(
Graphics
g
)
{
@Override
void
paintPeer
(
final
Graphics
g
)
{
flush
();
Dimension
size
=
getPeerSize
();
// TODO: when mouse is down over button, widget should be drawn depressed
g
.
setColor
(
getPeerBackground
());
g
.
fillRect
(
0
,
0
,
width
,
height
);
...
...
@@ -912,16 +912,22 @@ public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelS
/*
* fillRect with current Background color on the whole dropdown list.
*/
public
void
paintBackground
(){
Graphics
g
=
getGraphics
();
g
.
setColor
(
getPeerBackground
());
g
.
fillRect
(
0
,
0
,
width
,
height
);
public
void
paintBackground
()
{
final
Graphics
g
=
getGraphics
();
if
(
g
!=
null
)
{
try
{
g
.
setColor
(
getPeerBackground
());
g
.
fillRect
(
0
,
0
,
width
,
height
);
}
finally
{
g
.
dispose
();
}
}
}
/*
* 6405689. In some cases we should erase background to eliminate painting
* artefacts.
*/
@Override
public
void
repaint
()
{
if
(!
isVisible
())
{
return
;
...
...
@@ -931,8 +937,8 @@ public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelS
}
super
.
repaint
();
}
public
void
paint
(
Graphics
g
)
{
@Override
public
void
paint
Peer
(
Graphics
g
)
{
//System.out.println("UC.paint()");
Choice
choice
=
(
Choice
)
target
;
Color
colors
[]
=
XChoicePeer
.
this
.
getGUIcolors
();
...
...
src/solaris/classes/sun/awt/X11/XComponentPeer.java
浏览文件 @
7216d912
...
...
@@ -38,7 +38,6 @@ import java.awt.Graphics;
import
java.awt.GraphicsConfiguration
;
import
java.awt.Image
;
import
java.awt.Insets
;
import
java.awt.KeyboardFocusManager
;
import
java.awt.Rectangle
;
import
java.awt.SystemColor
;
import
java.awt.Toolkit
;
...
...
@@ -59,15 +58,11 @@ import java.awt.image.ImageProducer;
import
java.awt.image.VolatileImage
;
import
java.awt.peer.ComponentPeer
;
import
java.awt.peer.ContainerPeer
;
import
java.awt.peer.LightweightPeer
;
import
java.lang.reflect.*
;
import
java.security.*
;
import
java.util.Collection
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.Vector
;
import
sun.util.logging.PlatformLogger
;
import
sun.awt.*
;
import
sun.awt.event.IgnorePaintEvent
;
import
sun.awt.image.SunVolatileImage
;
...
...
@@ -428,27 +423,23 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
public
void
disable
()
{
setEnabled
(
false
);
}
public
void
paint
(
Graphics
g
)
{
}
public
void
repaint
(
long
tm
,
int
x
,
int
y
,
int
width
,
int
height
)
{
repaint
(
);
@Override
public
void
paint
(
final
Graphics
g
)
{
super
.
paint
(
g
);
// allow target to change the picture
target
.
paint
(
g
);
}
public
Graphics
getGraphics
()
{
return
getGraphics
(
surfaceData
,
getPeerForeground
(),
getPeerBackground
(),
getPeerFont
());
}
public
void
print
(
Graphics
g
)
{
// clear rect here to emulate X clears rect before Expose
g
.
setColor
(
target
.
getBackground
());
g
.
fillRect
(
0
,
0
,
target
.
getWidth
(),
target
.
getHeight
());
g
.
setColor
(
target
.
getForeground
());
// paint peer
paint
(
g
);
paint
Peer
(
g
);
// allow target to change the picture
target
.
print
(
g
);
}
...
...
src/solaris/classes/sun/awt/X11/XLabelPeer.java
浏览文件 @
7216d912
...
...
@@ -85,7 +85,8 @@ class XLabelPeer extends XComponentPeer implements LabelPeer {
*/
// NOTE: This method is called by privileged threads.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
public
void
paint
(
Graphics
g
)
{
@Override
void
paintPeer
(
final
Graphics
g
)
{
int
textX
=
0
;
int
textY
=
0
;
g
.
setColor
(
getPeerBackground
());
...
...
src/solaris/classes/sun/awt/X11/XListPeer.java
浏览文件 @
7216d912
...
...
@@ -363,9 +363,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
return
Math
.
min
(
items
.
size
()-
1
,
itemsInWindow
()-
1
);
}
}
public
void
repaintScrollbarRequest
(
XScrollbar
scrollbar
)
{
Graphics
g
=
getGraphics
();
if
(
scrollbar
==
hsb
)
{
repaint
(
PAINT_HSCROLL
);
}
...
...
@@ -373,9 +371,6 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
repaint
(
PAINT_VSCROLL
);
}
}
/**
* Overridden for performance
*/
...
...
@@ -410,18 +405,20 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
* @param distance the distance to copy the source area
*/
private
void
repaint
(
int
firstItem
,
int
lastItem
,
int
options
,
Rectangle
source
,
Point
distance
)
{
Graphics
g
=
getGraphics
();
try
{
painter
.
paint
(
g
,
firstItem
,
lastItem
,
options
,
source
,
distance
);
}
finally
{
g
.
dispose
();
final
Graphics
g
=
getGraphics
();
if
(
g
!=
null
)
{
try
{
painter
.
paint
(
g
,
firstItem
,
lastItem
,
options
,
source
,
distance
);
target
.
paint
(
g
);
}
finally
{
g
.
dispose
();
}
}
}
public
void
paint
(
Graphics
g
)
{
@Override
void
paintPeer
(
final
Graphics
g
)
{
painter
.
paint
(
g
,
getFirstVisibleItem
(),
getLastVisibleItem
(),
PAINT_ALL
);
}
public
boolean
isFocusable
()
{
return
true
;
}
// TODO: share/promote the Focus methods?
...
...
src/solaris/classes/sun/awt/X11/XMenuBarPeer.java
浏览文件 @
7216d912
...
...
@@ -415,7 +415,7 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
* Overriden XWindow painting & printing
*
************************************************/
public
void
paint
(
Graphics
g
)
{
public
void
paint
Peer
(
Graphics
g
)
{
resetColors
();
/* Calculate menubar dimension. */
int
width
=
getWidth
();
...
...
src/solaris/classes/sun/awt/X11/XMenuWindow.java
浏览文件 @
7216d912
...
...
@@ -432,9 +432,9 @@ public class XMenuWindow extends XBaseMenuWindow {
/**
* Paints menu window
*/
public
void
paint
(
Graphics
g
)
{
@Override
public
void
paintPeer
(
Graphics
g
)
{
resetColors
();
int
width
=
getWidth
();
int
height
=
getHeight
();
...
...
src/solaris/classes/sun/awt/X11/XPanelPeer.java
浏览文件 @
7216d912
...
...
@@ -60,14 +60,13 @@ public class XPanelPeer extends XCanvasPeer implements PanelPeer {
public
Insets
getInsets
()
{
return
new
Insets
(
0
,
0
,
0
,
0
);
}
public
void
paint
(
Graphics
g
)
{
super
.
paint
(
g
);
/*
SunGraphicsCallback.PaintHeavyweightComponentsCallback.getInstance().
runComponents(((Container)target).getComponents(), g,
SunGraphicsCallback.LIGHTWEIGHTS |
SunGraphicsCallback.HEAVYWEIGHTS);
*/
}
SunGraphicsCallback
.
PaintHeavyweightComponentsCallback
.
getInstance
().
runComponents
(((
Container
)
target
).
getComponents
(),
g
,
SunGraphicsCallback
.
LIGHTWEIGHTS
|
SunGraphicsCallback
.
HEAVYWEIGHTS
);
}
public
void
print
(
Graphics
g
)
{
super
.
print
(
g
);
SunGraphicsCallback
.
PrintHeavyweightComponentsCallback
.
getInstance
().
...
...
src/solaris/classes/sun/awt/X11/XRepaintArea.java
浏览文件 @
7216d912
...
...
@@ -53,9 +53,9 @@ class XRepaintArea extends RepaintArea {
*/
protected
void
updateComponent
(
Component
comp
,
Graphics
g
)
{
if
(
comp
!=
null
)
{
ComponentPeer
peer
=
comp
.
getPeer
();
final
XComponentPeer
peer
=
(
XComponentPeer
)
comp
.
getPeer
();
if
(
peer
!=
null
)
{
peer
.
paint
(
g
);
peer
.
paint
Peer
(
g
);
}
super
.
updateComponent
(
comp
,
g
);
}
...
...
@@ -66,9 +66,9 @@ class XRepaintArea extends RepaintArea {
*/
protected
void
paintComponent
(
Component
comp
,
Graphics
g
)
{
if
(
comp
!=
null
)
{
ComponentPeer
peer
=
comp
.
getPeer
();
final
XComponentPeer
peer
=
(
XComponentPeer
)
comp
.
getPeer
();
if
(
peer
!=
null
)
{
peer
.
paint
(
g
);
peer
.
paint
Peer
(
g
);
}
super
.
paintComponent
(
comp
,
g
);
}
...
...
src/solaris/classes/sun/awt/X11/XScrollPanePeer.java
浏览文件 @
7216d912
...
...
@@ -293,10 +293,12 @@ class XScrollPanePeer extends XComponentPeer implements ScrollPanePeer, XScrollb
setAdjustableValue
(
hadj
,
hsb
.
getValue
(),
type
);
sx
=
-(
hsb
.
getValue
());
Graphics
g
=
getGraphics
();
try
{
paintHorScrollbar
(
g
,
colors
,
true
);
}
finally
{
g
.
dispose
();
if
(
g
!=
null
)
{
try
{
paintHorScrollbar
(
g
,
colors
,
true
);
}
finally
{
g
.
dispose
();
}
}
}
if
((
flag
&
VERTICAL
)
!=
0
)
{
...
...
@@ -305,10 +307,12 @@ class XScrollPanePeer extends XComponentPeer implements ScrollPanePeer, XScrollb
setAdjustableValue
(
vadj
,
vsb
.
getValue
(),
type
);
sy
=
-(
vsb
.
getValue
());
Graphics
g
=
getGraphics
();
try
{
paintVerScrollbar
(
g
,
colors
,
true
);
}
finally
{
g
.
dispose
();
if
(
g
!=
null
)
{
try
{
paintVerScrollbar
(
g
,
colors
,
true
);
}
finally
{
g
.
dispose
();
}
}
}
}
...
...
@@ -327,14 +331,21 @@ class XScrollPanePeer extends XComponentPeer implements ScrollPanePeer, XScrollb
ite
.
getCause
().
printStackTrace
();
}
}
public
void
paint
(
Graphics
g
)
{
paintComponent
(
g
);
@Override
void
paintPeer
(
final
Graphics
g
)
{
final
Color
[]
colors
=
getGUIcolors
();
g
.
setColor
(
colors
[
BACKGROUND_COLOR
]);
final
int
h
=
height
-
hsbSpace
;
final
int
w
=
width
-
vsbSpace
;
g
.
fillRect
(
0
,
0
,
w
,
h
);
// paint rectangular region between scrollbars
g
.
fillRect
(
w
,
h
,
vsbSpace
,
hsbSpace
);
if
(
MARGIN
>
0
)
{
draw3DRect
(
g
,
colors
,
0
,
0
,
w
-
1
,
h
-
1
,
false
);
}
paintScrollBars
(
g
,
colors
);
}
void
paintScrollBars
(
Graphics
g
,
Color
[]
colors
)
{
private
void
paintScrollBars
(
Graphics
g
,
Color
[]
colors
)
{
if
(
vsbSpace
>
0
)
{
paintVerScrollbar
(
g
,
colors
,
true
);
// paint the whole scrollbar
...
...
@@ -345,51 +356,32 @@ class XScrollPanePeer extends XComponentPeer implements ScrollPanePeer, XScrollb
// paint the whole scrollbar
}
}
void
repaintScrollBars
()
{
Graphics
g
=
getGraphics
();
Color
colors
[]
=
getGUIcolors
();
if
(
g
!=
null
)
{
paintScrollBars
(
g
,
colors
);
}
g
.
dispose
();
}
public
void
repaintScrollbarRequest
(
XScrollbar
sb
)
{
Graphics
g
=
getGraphics
();
Color
colors
[]
=
getGUIcolors
();
if
(
g
!=
null
)
{
if
(
sb
==
vsb
)
{
paintVerScrollbar
(
g
,
colors
,
true
);
}
else
if
(
sb
==
hsb
)
{
paintHorScrollbar
(
g
,
colors
,
true
);
}
}
void
repaintScrollBars
()
{
Graphics
g
=
getGraphics
();
Color
colors
[]
=
getGUIcolors
();
if
(
g
!=
null
)
{
try
{
paintScrollBars
(
g
,
colors
);
}
finally
{
g
.
dispose
();
}
}
}
/**
* Paint the scrollpane.
*/
public
void
paintComponent
(
Graphics
g
)
{
public
void
repaintScrollbarRequest
(
XScrollbar
sb
)
{
Graphics
g
=
getGraphics
();
Color
colors
[]
=
getGUIcolors
();
g
.
setColor
(
colors
[
BACKGROUND_COLOR
]);
int
h
=
height
-
hsbSpace
;
int
w
=
width
-
vsbSpace
;
g
.
fillRect
(
0
,
0
,
w
,
h
);
// paint rectangular region between scrollbars
g
.
fillRect
(
w
,
h
,
vsbSpace
,
hsbSpace
);
if
(
MARGIN
>
0
)
{
draw3DRect
(
g
,
colors
,
0
,
0
,
w
-
1
,
h
-
1
,
false
);
if
(
g
!=
null
)
{
try
{
if
(
sb
==
vsb
)
{
paintVerScrollbar
(
g
,
colors
,
true
);
}
else
if
(
sb
==
hsb
)
{
paintHorScrollbar
(
g
,
colors
,
true
);
}
}
finally
{
g
.
dispose
();
}
}
paintScrollBars
(
g
,
colors
);
}
public
void
handleEvent
(
java
.
awt
.
AWTEvent
e
)
{
super
.
handleEvent
(
e
);
...
...
src/solaris/classes/sun/awt/X11/XScrollbarPeer.java
浏览文件 @
7216d912
...
...
@@ -90,18 +90,12 @@ class XScrollbarPeer extends XComponentPeer implements ScrollbarPeer, XScrollbar
?
new
Dimension
(
getDefaultDimension
(),
DEFAULT_LENGTH
)
:
new
Dimension
(
DEFAULT_LENGTH
,
getDefaultDimension
());
}
public
void
repaint
()
{
Graphics
g
=
getGraphics
();
if
(
g
!=
null
)
paint
(
g
);
}
/**
* Paint the scrollbar.
*/
public
void
paint
(
Graphics
g
)
{
Scrollbar
sb
=
(
Scrollbar
)
target
;
Color
colors
[]
=
getGUIcolors
();
@Override
void
paintPeer
(
final
Graphics
g
)
{
final
Color
[]
colors
=
getGUIcolors
();
g
.
setColor
(
colors
[
BACKGROUND_COLOR
]);
tsb
.
paint
(
g
,
colors
,
true
);
// paint the whole scrollbar
...
...
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
浏览文件 @
7216d912
...
...
@@ -298,15 +298,14 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
* Paint the component
* this method is called when the repaint instruction has been used
*/
public
void
repaint
()
{
if
(
textPane
!=
null
)
{
//textPane.validate();
textPane
.
repaint
();
}
}
public
void
paint
(
Graphics
g
)
{
@Override
void
paintPeer
(
final
Graphics
g
)
{
if
(
textPane
!=
null
)
{
textPane
.
paint
(
g
);
}
...
...
src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
浏览文件 @
7216d912
...
...
@@ -370,12 +370,11 @@ public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
public
void
repaint
()
{
if
(
xtext
!=
null
)
xtext
.
repaint
();
}
public
void
paint
(
Graphics
g
)
{
@Override
void
paintPeer
(
final
Graphics
g
)
{
if
(
xtext
!=
null
)
xtext
.
paint
(
g
);
}
public
void
print
(
Graphics
g
)
{
if
(
xtext
!=
null
)
{
xtext
.
print
(
g
);
...
...
src/solaris/classes/sun/awt/X11/XWarningWindow.java
浏览文件 @
7216d912
...
...
@@ -241,16 +241,19 @@ class XWarningWindow extends XWindow {
Font
getFont
()
{
return
ownerWindow
.
getFont
();
}
@Override
public
void
repaint
()
{
Rectangle
bounds
=
getBounds
();
Graphics
g
=
getGraphics
();
try
{
paint
(
g
,
0
,
0
,
bounds
.
width
,
bounds
.
height
);
}
finally
{
g
.
dispose
();
final
Rectangle
bounds
=
getBounds
();
final
Graphics
g
=
getGraphics
();
if
(
g
!=
null
)
{
try
{
paint
(
g
,
0
,
0
,
bounds
.
width
,
bounds
.
height
);
}
finally
{
g
.
dispose
();
}
}
}
@Override
public
void
handleExposeEvent
(
XEvent
xev
)
{
super
.
handleExposeEvent
(
xev
);
...
...
@@ -263,11 +266,13 @@ class XWarningWindow extends XWindow {
SunToolkit
.
executeOnEventHandlerThread
(
target
,
new
Runnable
()
{
public
void
run
()
{
Graphics
g
=
getGraphics
();
try
{
paint
(
g
,
x
,
y
,
width
,
height
);
}
finally
{
g
.
dispose
();
final
Graphics
g
=
getGraphics
();
if
(
g
!=
null
)
{
try
{
paint
(
g
,
x
,
y
,
width
,
height
);
}
finally
{
g
.
dispose
();
}
}
}
});
...
...
src/solaris/classes/sun/awt/X11/XWindow.java
浏览文件 @
7216d912
...
...
@@ -502,9 +502,8 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
public
boolean
isEmbedded
()
{
return
embedded
;
}
public
void
repaint
(
int
x
,
int
y
,
int
width
,
int
height
)
{
if
(!
isVisible
())
{
if
(!
isVisible
()
||
getWidth
()
==
0
||
getHeight
()
==
0
)
{
return
;
}
Graphics
g
=
getGraphics
();
...
...
@@ -517,12 +516,11 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
}
}
}
public
void
repaint
()
{
if
(!
isVisible
())
{
void
repaint
()
{
if
(!
isVisible
()
||
getWidth
()
==
0
||
getHeight
()
==
0
)
{
return
;
}
Graphics
g
=
getGraphics
();
final
Graphics
g
=
getGraphics
();
if
(
g
!=
null
)
{
try
{
paint
(
g
);
...
...
@@ -531,10 +529,13 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
}
}
}
void
paint
(
Graphics
g
)
{
public
void
paint
(
final
Graphics
g
)
{
// paint peer
paintPeer
(
g
);
}
void
paintPeer
(
final
Graphics
g
)
{
}
//used by Peers to avoid flickering withing paint()
protected
void
flush
(){
XToolkit
.
awtLock
();
...
...
test/java/awt/Component/PaintAll/PaintAll.java
0 → 100644
浏览文件 @
7216d912
/*
* Copyright (c) 2011, 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.Button
;
import
java.awt.Canvas
;
import
java.awt.Checkbox
;
import
java.awt.Choice
;
import
java.awt.Component
;
import
java.awt.Container
;
import
java.awt.Dimension
;
import
java.awt.Frame
;
import
java.awt.Graphics
;
import
java.awt.GridLayout
;
import
java.awt.Label
;
import
java.awt.List
;
import
java.awt.Panel
;
import
java.awt.ScrollPane
;
import
java.awt.Scrollbar
;
import
java.awt.TextArea
;
import
java.awt.TextField
;
import
java.awt.Toolkit
;
import
java.awt.image.BufferedImage
;
/*
@test
@bug 6596915
@summary Test Component.paintAll() method
@author sergey.bylokhov@oracle.com: area=awt.component
@run main PaintAll
*/
public
class
PaintAll
{
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
;
private
static
final
Button
buttonStub
=
new
Button
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
buttonPainted
=
true
;
}
};
private
static
final
Canvas
canvasStub
=
new
Canvas
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
canvasPainted
=
true
;
}
};
private
static
final
Checkbox
checkboxStub
=
new
Checkbox
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
checkboxPainted
=
true
;
}
};
private
static
final
Choice
choiceStub
=
new
Choice
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
choicePainted
=
true
;
}
};
private
static
final
Component
lwComponentStub
=
new
Component
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
lwPainted
=
true
;
}
};
private
static
final
Container
containerStub
=
new
Container
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
containerPainted
=
true
;
}
};
private
static
final
Frame
frame
=
new
Frame
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
super
.
paint
(
g
);
framePainted
=
true
;
}
};
private
static
final
Label
labelStub
=
new
Label
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
labelPainted
=
true
;
}
};
private
static
final
List
listStub
=
new
List
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
listPainted
=
true
;
}
};
private
static
final
Panel
panelStub
=
new
Panel
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
panelPainted
=
true
;
}
};
private
static
final
Scrollbar
scrollbarStub
=
new
Scrollbar
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
scrollbarPainted
=
true
;
}
};
private
static
final
ScrollPane
scrollPaneStub
=
new
ScrollPane
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
scrollPanePainted
=
true
;
}
};
private
static
final
TextArea
textAreaStub
=
new
TextArea
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
textAreaPainted
=
true
;
}
};
private
static
final
TextField
textFieldStub
=
new
TextField
()
{
@Override
public
void
paint
(
final
Graphics
g
)
{
textFieldPainted
=
true
;
}
};
public
static
void
main
(
final
String
[]
args
)
throws
Exception
{
//Frame initialisation
final
BufferedImage
graphicsProducer
=
new
BufferedImage
(
BufferedImage
.
TYPE_INT_ARGB
,
1
,
1
);
final
Graphics
g
=
graphicsProducer
.
getGraphics
();
frame
.
setLayout
(
new
GridLayout
());
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
.
setSize
(
new
Dimension
(
500
,
500
));
frame
.
setLocationRelativeTo
(
null
);
frame
.
setVisible
(
true
);
sleep
();
//Check results.
validation
();
//Reset all flags to 'false'.
initPaintedFlags
();
//Tested method.
frame
.
paintAll
(
g
);
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 "
+
"when paintAll() invoked on a parent"
);
}
if
(!
canvasPainted
)
{
fail
(
"Paint is not called a Canvas "
+
"when paintAll() invoked on a parent"
);
}
if
(!
checkboxPainted
)
{
fail
(
"Paint is not called a Checkbox "
+
"when paintAll() invoked on a parent"
);
}
if
(!
choicePainted
)
{
fail
(
"Paint is not called a Choice "
+
"when paintAll() invoked on a parent"
);
}
if
(!
lwPainted
)
{
fail
(
"Paint is not called on a lightweight"
+
" subcomponent when paintAll() invoked on a parent"
);
}
if
(!
containerPainted
)
{
fail
(
"Paint is not called on a Container"
+
" subcomponent when paintAll() invoked on a parent"
);
}
if
(!
labelPainted
)
{
fail
(
"Paint is not called on a Label"
+
" subcomponent when paintAll() invoked on a parent"
);
}
if
(!
listPainted
)
{
fail
(
"Paint is not called on a List"
+
" subcomponent when paintAll() invoked on a parent"
);
}
if
(!
panelPainted
)
{
fail
(
"Paint is not called on a Panel"
+
" subcomponent when paintAll() invoked on a parent"
);
}
if
(!
scrollbarPainted
)
{
fail
(
"Paint is not called on a Scrollbar"
+
" subcomponent when paintAll() invoked on a parent"
);
}
if
(!
scrollPanePainted
)
{
fail
(
"Paint is not called on a ScrollPane"
+
" subcomponent when paintAll() invoked on a parent"
);
}
if
(!
textAreaPainted
)
{
fail
(
"Paint is not called on a TextArea"
+
" subcomponent when paintAll() invoked on a parent"
);
}
if
(!
textFieldPainted
)
{
fail
(
"Paint is not called on a TextField"
+
" subcomponent when paintAll() invoked on a parent"
);
}
if
(!
framePainted
)
{
fail
(
"Paint is not called on a Frame when paintAll()"
);
}
}
private
static
void
sleep
()
{
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
try
{
Thread
.
sleep
(
500L
);
}
catch
(
InterruptedException
ignored
)
{
}
}
private
static
void
fail
(
final
String
message
)
{
cleanup
();
throw
new
RuntimeException
(
message
);
}
private
static
void
cleanup
()
{
frame
.
dispose
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录