Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
4f58ed9d
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看板
提交
4f58ed9d
编写于
2月 15, 2012
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
d24dab4a
3d38fe6f
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
499 addition
and
112 deletion
+499
-112
src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
...com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
+5
-0
src/share/classes/java/awt/List.java
src/share/classes/java/awt/List.java
+7
-7
src/share/classes/java/awt/Window.java
src/share/classes/java/awt/Window.java
+3
-3
src/share/classes/java/awt/color/ICC_Profile.java
src/share/classes/java/awt/color/ICC_Profile.java
+3
-3
src/share/classes/java/awt/event/InputEvent.java
src/share/classes/java/awt/event/InputEvent.java
+14
-9
src/share/classes/java/awt/event/MouseEvent.java
src/share/classes/java/awt/event/MouseEvent.java
+21
-18
src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java
...s/javax/print/attribute/standard/PrinterStateReasons.java
+1
-2
src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java
...rint/attribute/standard/ReferenceUriSchemesSupported.java
+1
-1
src/share/classes/javax/swing/JOptionPane.java
src/share/classes/javax/swing/JOptionPane.java
+1
-3
src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java
...are/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java
+1
-0
src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
+2
-0
src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java
...are/classes/javax/swing/tree/DefaultTreeCellRenderer.java
+1
-1
src/share/classes/sun/beans/infos/ComponentBeanInfo.java
src/share/classes/sun/beans/infos/ComponentBeanInfo.java
+1
-1
src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
+60
-4
test/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java
...awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java
+4
-1
test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java
...rint/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java
+12
-7
test/javax/swing/JFileChooser/6396844/TwentyThousandTest.java
.../javax/swing/JFileChooser/6396844/TwentyThousandTest.java
+58
-52
test/javax/swing/JOptionPane/7138665/bug7138665.java
test/javax/swing/JOptionPane/7138665/bug7138665.java
+70
-0
test/javax/swing/JProgressBar/7141573/bug7141573.java
test/javax/swing/JProgressBar/7141573/bug7141573.java
+62
-0
test/javax/swing/JTree/4314199/bug4314199.html
test/javax/swing/JTree/4314199/bug4314199.html
+8
-0
test/javax/swing/JTree/4314199/bug4314199.java
test/javax/swing/JTree/4314199/bug4314199.java
+92
-0
test/javax/swing/tree/DefaultTreeCellRenderer/7142955/bug7142955.java
...wing/tree/DefaultTreeCellRenderer/7142955/bug7142955.java
+72
-0
未找到文件。
src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
浏览文件 @
4f58ed9d
...
...
@@ -137,6 +137,11 @@ public class WindowsProgressBarUI extends BasicProgressBarUI
g
.
setColor
(
progressBar
.
getForeground
());
barRectHeight
-=
2
;
barRectWidth
-=
2
;
if
(
barRectWidth
<=
0
||
barRectHeight
<=
0
)
{
return
;
}
Graphics2D
g2
=
(
Graphics2D
)
g
;
g2
.
setStroke
(
new
BasicStroke
((
float
)(
vertical
?
barRectWidth
:
barRectHeight
),
BasicStroke
.
CAP_BUTT
,
BasicStroke
.
JOIN_BEVEL
));
...
...
src/share/classes/java/awt/List.java
浏览文件 @
4f58ed9d
...
...
@@ -115,7 +115,7 @@ public class List extends Component implements ItemSelectable, Accessible {
* @see #addItem(String)
* @see #getItem(int)
*/
Vector
items
=
new
Vector
();
Vector
<
String
>
items
=
new
Vector
<>
();
/**
* This field will represent the number of visible rows in the
...
...
@@ -306,7 +306,7 @@ public class List extends Component implements ItemSelectable, Accessible {
// to insure that it cannot be overridden by client subclasses.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
final
String
getItemImpl
(
int
index
)
{
return
(
String
)
items
.
elementAt
(
index
);
return
items
.
elementAt
(
index
);
}
/**
...
...
@@ -415,7 +415,7 @@ public class List extends Component implements ItemSelectable, Accessible {
if
(
peer
!=
null
)
{
peer
.
removeAll
();
}
items
=
new
Vector
();
items
=
new
Vector
<>
();
selected
=
new
int
[
0
];
}
...
...
@@ -490,9 +490,9 @@ public class List extends Component implements ItemSelectable, Accessible {
public
synchronized
int
[]
getSelectedIndexes
()
{
ListPeer
peer
=
(
ListPeer
)
this
.
peer
;
if
(
peer
!=
null
)
{
selected
=
((
ListPeer
)
peer
)
.
getSelectedIndexes
();
selected
=
peer
.
getSelectedIndexes
();
}
return
(
int
[])
selected
.
clone
();
return
selected
.
clone
();
}
/**
...
...
@@ -908,7 +908,7 @@ public class List extends Component implements ItemSelectable, Accessible {
* @since 1.4
*/
public
synchronized
ItemListener
[]
getItemListeners
()
{
return
(
ItemListener
[])(
getListeners
(
ItemListener
.
class
)
);
return
getListeners
(
ItemListener
.
class
);
}
/**
...
...
@@ -975,7 +975,7 @@ public class List extends Component implements ItemSelectable, Accessible {
* @since 1.4
*/
public
synchronized
ActionListener
[]
getActionListeners
()
{
return
(
ActionListener
[])(
getListeners
(
ActionListener
.
class
)
);
return
getListeners
(
ActionListener
.
class
);
}
/**
...
...
src/share/classes/java/awt/Window.java
浏览文件 @
4f58ed9d
...
...
@@ -398,10 +398,10 @@ public class Window extends Container implements Accessible {
initIDs
();
}
String
s
=
(
String
)
java
.
security
.
AccessController
.
doPrivileged
(
String
s
=
java
.
security
.
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"java.awt.syncLWRequests"
));
systemSyncLWRequests
=
(
s
!=
null
&&
s
.
equals
(
"true"
));
s
=
(
String
)
java
.
security
.
AccessController
.
doPrivileged
(
s
=
java
.
security
.
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"java.awt.Window.locationByPlatform"
));
locationByPlatformProp
=
(
s
!=
null
&&
s
.
equals
(
"true"
));
}
...
...
@@ -1378,7 +1378,7 @@ public class Window extends Container implements Accessible {
// make sure the privileged action is only
// for getting the property! We don't want the
// above checkTopLevelWindow call to always succeed!
warningString
=
(
String
)
AccessController
.
doPrivileged
(
warningString
=
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"awt.appletWarning"
,
"Java Applet Window"
));
}
...
...
src/share/classes/java/awt/color/ICC_Profile.java
浏览文件 @
4f58ed9d
...
...
@@ -921,9 +921,9 @@ public class ICC_Profile implements Serializable {
*/
private
static
ICC_Profile
getStandardProfile
(
final
String
name
)
{
return
(
ICC_Profile
)
AccessController
.
doPrivileged
(
new
PrivilegedAction
()
{
public
Object
run
()
{
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
ICC_Profile
>
()
{
public
ICC_Profile
run
()
{
ICC_Profile
p
=
null
;
try
{
p
=
getInstance
(
name
);
...
...
src/share/classes/java/awt/event/InputEvent.java
浏览文件 @
4f58ed9d
...
...
@@ -321,14 +321,15 @@ public abstract class InputEvent extends ComponentEvent {
* @param when a long int that gives the time the event occurred.
* Passing negative or zero value
* is not recommended
* @param modifiers the modifier keys down during event (e.g. shift, ctrl,
* alt, meta)
* Passing negative parameter is not recommended.
* Zero value means no modifiers.
* Either extended _DOWN_MASK or old _MASK modifiers
* should be used, but both models should not be mixed
* in one event. Use of the extended modifiers is
* preferred
* @param modifiers a modifier mask describing the modifier keys and mouse
* buttons (for example, shift, ctrl, alt, and meta) that
* are down during the event.
* Only extended modifiers are allowed to be used as a
* value for this parameter (see the {@link InputEvent#getModifiersEx}
* class for the description of extended modifiers).
* Passing negative parameter
* is not recommended.
* Zero value means that no modifiers were passed
* @throws IllegalArgumentException if <code>source</code> is null
* @see #getSource()
* @see #getID()
...
...
@@ -416,9 +417,13 @@ public abstract class InputEvent extends ComponentEvent {
/**
* Returns the extended modifier mask for this event.
* <P>
* Extended modifiers are the modifiers that ends with the _DOWN_MASK suffix,
* such as ALT_DOWN_MASK, BUTTON1_DOWN_MASK, and others.
* <P>
* Extended modifiers represent the state of all modal keys,
* such as ALT, CTRL, META, and the mouse buttons just after
* the event occurred
* the event occurred
.
* <P>
* For example, if the user presses <b>button 1</b> followed by
* <b>button 2</b>, and then releases them in the same order,
...
...
src/share/classes/java/awt/event/MouseEvent.java
浏览文件 @
4f58ed9d
...
...
@@ -488,14 +488,15 @@ public class MouseEvent extends InputEvent {
* @param when A long integer that gives the time the event occurred.
* Passing negative or zero value
* is not recommended
* @param modifiers The modifier keys down during event (e.g. shift, ctrl,
* alt, meta)
* @param modifiers a modifier mask describing the modifier keys and mouse
* buttons (for example, shift, ctrl, alt, and meta) that
* are down during the event.
* Only extended modifiers are allowed to be used as a
* value for this parameter (see the {@link InputEvent#getModifiersEx}
* class for the description of extended modifiers).
* Passing negative parameter
* is not recommended.
* Zero value means that no modifiers were passed.
* Use either an extended _DOWN_MASK or old _MASK modifiers,
* however do not mix models in the one event.
* The extended modifiers are preferred for using
* Zero value means that no modifiers were passed
* @param x The horizontal x coordinate for the mouse location.
* It is allowed to pass negative values
* @param y The vertical y coordinate for the mouse location.
...
...
@@ -586,14 +587,15 @@ public class MouseEvent extends InputEvent {
* @param when A long integer that gives the time the event occurred.
* Passing negative or zero value
* is not recommended
* @param modifiers The modifier keys down during event (e.g. shift, ctrl,
* alt, meta)
* @param modifiers a modifier mask describing the modifier keys and mouse
* buttons (for example, shift, ctrl, alt, and meta) that
* are down during the event.
* Only extended modifiers are allowed to be used as a
* value for this parameter (see the {@link InputEvent#getModifiersEx}
* class for the description of extended modifiers).
* Passing negative parameter
* is not recommended.
* Zero value means that no modifiers were passed.
* Use either an extended _DOWN_MASK or old _MASK modifiers,
* however do not mix models in the one event.
* The extended modifiers are preferred for using
* Zero value means that no modifiers were passed
* @param x The horizontal x coordinate for the mouse location.
* It is allowed to pass negative values
* @param y The vertical y coordinate for the mouse location.
...
...
@@ -657,14 +659,15 @@ public class MouseEvent extends InputEvent {
* @param when A long integer that gives the time the event occurred.
* Passing negative or zero value
* is not recommended
* @param modifiers The modifier keys down during event (e.g. shift, ctrl,
* alt, meta)
* @param modifiers a modifier mask describing the modifier keys and mouse
* buttons (for example, shift, ctrl, alt, and meta) that
* are down during the event.
* Only extended modifiers are allowed to be used as a
* value for this parameter (see the {@link InputEvent#getModifiersEx}
* class for the description of extended modifiers).
* Passing negative parameter
* is not recommended.
* Zero value means that no modifiers were passed.
* Use either an extended _DOWN_MASK or old _MASK modifiers,
* however do not mix models in the one event.
* The extended modifiers are preferred for using
* Zero value means that no modifiers were passed
* @param x The horizontal x coordinate for the mouse location.
* It is allowed to pass negative values
* @param y The vertical y coordinate for the mouse location.
...
...
src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java
浏览文件 @
4f58ed9d
...
...
@@ -180,8 +180,7 @@ public final class PrinterStateReasons
if
(
severity
==
null
)
{
throw
new
NullPointerException
(
"severity is null"
);
}
return
super
.
put
((
PrinterStateReason
)
reason
,
(
Severity
)
severity
);
return
super
.
put
(
reason
,
severity
);
}
/**
...
...
src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java
浏览文件 @
4f58ed9d
...
...
@@ -141,7 +141,7 @@ public class ReferenceUriSchemesSupported
* Returns the string table for class ReferenceUriSchemesSupported.
*/
protected
String
[]
getStringTable
()
{
return
(
String
[])
myStringTable
.
clone
();
return
myStringTable
.
clone
();
}
/**
...
...
src/share/classes/javax/swing/JOptionPane.java
浏览文件 @
4f58ed9d
...
...
@@ -34,7 +34,6 @@ import java.awt.KeyboardFocusManager;
import
java.awt.Frame
;
import
java.awt.Point
;
import
java.awt.HeadlessException
;
import
java.awt.Toolkit
;
import
java.awt.Window
;
import
java.beans.PropertyChangeEvent
;
import
java.beans.PropertyChangeListener
;
...
...
@@ -994,8 +993,7 @@ public class JOptionPane extends JComponent implements Accessible
// if the user closed the window without selecting a button
// (newValue = null in that case). Otherwise, close the dialog.
if
(
dialog
.
isVisible
()
&&
event
.
getSource
()
==
JOptionPane
.
this
&&
(
event
.
getPropertyName
().
equals
(
VALUE_PROPERTY
)
||
event
.
getPropertyName
().
equals
(
INPUT_VALUE_PROPERTY
))
&&
(
event
.
getPropertyName
().
equals
(
VALUE_PROPERTY
))
&&
event
.
getNewValue
()
!=
null
&&
event
.
getNewValue
()
!=
JOptionPane
.
UNINITIALIZED_VALUE
)
{
dialog
.
setVisible
(
false
);
...
...
src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java
浏览文件 @
4f58ed9d
...
...
@@ -1236,6 +1236,7 @@ public class BasicOptionPaneUI extends OptionPaneUI {
int
index
=
list
.
locationToIndex
(
e
.
getPoint
());
optionPane
.
setInputValue
(
list
.
getModel
().
getElementAt
(
index
));
optionPane
.
setValue
(
JOptionPane
.
OK_OPTION
);
}
}
...
...
src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
浏览文件 @
4f58ed9d
...
...
@@ -434,6 +434,8 @@ public class SynthTreeUI extends BasicTreeUI
// Empty out the renderer pane, allowing renderers to be gc'ed.
rendererPane
.
removeAll
();
paintContext
=
null
;
}
private
void
configureRenderer
(
SynthContext
context
)
{
...
...
src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java
浏览文件 @
4f58ed9d
...
...
@@ -156,7 +156,7 @@ public class DefaultTreeCellRenderer extends JLabel implements TreeCellRenderer
protected
Color
borderSelectionColor
;
private
boolean
isDropCell
;
private
boolean
fillBackground
=
true
;
private
boolean
fillBackground
;
/**
* Set to true after the constructor has run.
...
...
src/share/classes/sun/beans/infos/ComponentBeanInfo.java
浏览文件 @
4f58ed9d
...
...
@@ -32,7 +32,7 @@ import java.beans.*;
*/
public
class
ComponentBeanInfo
extends
SimpleBeanInfo
{
private
static
final
Class
beanClass
=
java
.
awt
.
Component
.
class
;
private
static
final
Class
<
java
.
awt
.
Component
>
beanClass
=
java
.
awt
.
Component
.
class
;
public
PropertyDescriptor
[]
getPropertyDescriptors
()
{
try
{
...
...
src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
浏览文件 @
4f58ed9d
...
...
@@ -171,6 +171,53 @@ static jobjectArray toFilenamesArray(JNIEnv *env, GSList* list)
return
array
;
}
/**
* Convert a GSList to an array of filenames (with the parent folder)
*/
static
jobjectArray
toPathAndFilenamesArray
(
JNIEnv
*
env
,
GSList
*
list
)
{
jstring
str
;
jclass
stringCls
;
GSList
*
iterator
;
jobjectArray
array
;
int
i
;
char
*
entry
;
if
(
list
==
NULL
)
{
return
NULL
;
}
stringCls
=
(
*
env
)
->
FindClass
(
env
,
"java/lang/String"
);
if
(
stringCls
==
NULL
)
{
JNU_ThrowInternalError
(
env
,
"Could not get java.lang.String class"
);
return
NULL
;
}
array
=
(
*
env
)
->
NewObjectArray
(
env
,
fp_gtk_g_slist_length
(
list
),
stringCls
,
NULL
);
if
(
array
==
NULL
)
{
JNU_ThrowInternalError
(
env
,
"Could not instantiate array files array"
);
return
NULL
;
}
i
=
0
;
for
(
iterator
=
list
;
iterator
;
iterator
=
iterator
->
next
)
{
entry
=
(
char
*
)
iterator
->
data
;
//check for leading slash.
if
(
entry
[
0
]
==
'/'
)
{
entry
++
;
}
str
=
(
*
env
)
->
NewStringUTF
(
env
,
entry
);
(
*
env
)
->
SetObjectArrayElement
(
env
,
array
,
i
,
str
);
i
++
;
}
return
array
;
}
static
void
handle_response
(
GtkWidget
*
aDialog
,
gint
responseId
,
gpointer
obj
)
{
JNIEnv
*
env
;
...
...
@@ -183,16 +230,25 @@ static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj)
env
=
(
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
);
current_folder
=
NULL
;
filenames
=
NULL
;
gboolean
full_path_names
=
FALSE
;
if
(
responseId
==
GTK_RESPONSE_ACCEPT
)
{
current_folder
=
fp_gtk_file_chooser_get_current_folder
(
GTK_FILE_CHOOSER
(
aDialog
));
if
(
current_folder
==
NULL
)
{
full_path_names
=
TRUE
;
}
filenames
=
fp_gtk_file_chooser_get_filenames
(
GTK_FILE_CHOOSER
(
aDialog
));
}
jcurrent_folder
=
(
*
env
)
->
NewStringUTF
(
env
,
current_folder
);
jfilenames
=
toFilenamesArray
(
env
,
filenames
);
if
(
full_path_names
)
{
//This is a hack for use with "Recent Folders" in gtk where each
//file could have its own directory.
jcurrent_folder
=
(
*
env
)
->
NewStringUTF
(
env
,
"/"
);
jfilenames
=
toPathAndFilenamesArray
(
env
,
filenames
);
}
else
{
jcurrent_folder
=
(
*
env
)
->
NewStringUTF
(
env
,
current_folder
);
jfilenames
=
toFilenamesArray
(
env
,
filenames
);
}
(
*
env
)
->
CallVoidMethod
(
env
,
obj
,
setFileInternalMethodID
,
jcurrent_folder
,
jfilenames
);
fp_g_free
(
current_folder
);
...
...
test/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java
浏览文件 @
4f58ed9d
...
...
@@ -96,7 +96,10 @@ public class ChoiceMouseWheelTest extends Frame {
// Test mouse wheel over the choice
String
name
=
Toolkit
.
getDefaultToolkit
().
getClass
().
getName
();
if
(!
name
.
equals
(
"sun.awt.X11.XToolkit"
))
{
// mouse wheel doesn't work for the choice on X11, so skip it
// mouse wheel doesn't work for the choice on X11 and Mac, so skip it
if
(!
name
.
equals
(
"sun.awt.X11.XToolkit"
)
&&
!
name
.
equals
(
"sun.lwawt.macosx.LWCToolkit"
))
{
robot
.
mouseWheel
(
1
);
Util
.
waitForIdle
(
robot
);
...
...
test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java
浏览文件 @
4f58ed9d
...
...
@@ -54,9 +54,12 @@ public class PaintSetEnabledDeadlock extends Frame {
Util
.
clickOnComp
(
frame
.
button
,
robot
);
}
frame
.
panel
.
stop
();
boolean
ret
=
frame
.
panel
.
stop
();
frame
.
dispose
();
if
(!
ret
)
{
throw
new
RuntimeException
(
"Test failed!"
);
}
System
.
out
.
println
(
"Test passed."
);
}
...
...
@@ -140,17 +143,19 @@ class TestPanel extends Panel implements Runnable {
}
}
public
void
stop
()
{
public
boolean
stop
()
{
active
=
false
;
try
{
sync
hronized
(
sync
)
{
sync
.
notify
(
);
}
synchronized
(
thread
)
{
thread
.
wait
()
;
sync
();
thread
.
join
(
1000
);
if
(
thread
.
isAlive
())
{
thread
.
interrupt
();
return
false
;
}
}
catch
(
InterruptedException
ex
)
{
return
false
;
}
return
true
;
}
public
void
draw
()
{
...
...
test/javax/swing/JFileChooser/6396844/TwentyThousandTest.java
浏览文件 @
4f58ed9d
/*
* Copyright (c) 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 201
2
, 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
...
...
@@ -26,29 +26,30 @@
* @bug 6396844
* @summary Tests memory leak for 20000 files
* @author Sergey Malenkov
* @run main/othervm/timeout=1000 -mx256m TwentyThousandTest
* @library ../../regtesthelpers
* @build Util
* @run main/othervm/timeout=1000 -mx128m TwentyThousandTest
*/
import
sun.java2d.Disposer
;
import
sun.java2d.DisposerRecord
;
import
javax.swing.*
;
import
java.awt.event.
Action
Event
;
import
java.awt.event.
Action
Listener
;
import
java.awt.event.
Hierarchy
Event
;
import
java.awt.event.
Hierarchy
Listener
;
import
java.io.File
;
import
java.io.FileWriter
;
public
class
TwentyThousandTest
implements
ActionListener
,
Runnable
{
public
class
TwentyThousandTest
{
private
static
final
int
FILES
=
20000
;
private
static
final
int
ATTEMPTS
=
10
0
;
private
static
final
int
ATTEMPTS
=
2
0
;
private
static
final
int
INTERVAL
=
100
;
private
static
final
boolean
ALWAYS_NEW_INSTANCE
=
false
;
private
static
final
boolean
UPDATE_UI_EACH_INTERVAL
=
true
;
private
static
final
boolean
AUTO_CLOSE_DIALOG
=
true
;
private
static
JFileChooser
CHOOSER
;
private
static
String
tmpDir
;
private
static
volatile
boolean
disposerComplete
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
tmpDir
=
System
.
getProperty
(
"java.io.tmpdir"
);
...
...
@@ -77,15 +78,13 @@ public class TwentyThousandTest implements ActionListener, Runnable {
System
.
out
.
println
(
"Do "
+
ATTEMPTS
+
" attempts for "
+
laf
.
getClassName
());
for
(
int
i
=
0
;
i
<
ATTEMPTS
;
i
++
)
{
for
(
int
i
=
0
;
i
<
ATTEMPTS
;
i
++
)
{
System
.
out
.
print
(
i
+
" "
);
doAttempt
();
}
System
.
out
.
println
();
CHOOSER
=
null
;
}
System
.
out
.
println
(
"Removing "
+
FILES
+
" files"
);
...
...
@@ -94,7 +93,7 @@ public class TwentyThousandTest implements ActionListener, Runnable {
getTempFile
(
i
).
delete
();
}
System
.
out
.
println
(
"Test passed successfully"
);
System
.
out
.
println
(
"Test passed successfully"
);
}
private
static
File
getTempFile
(
int
i
)
{
...
...
@@ -104,48 +103,55 @@ public class TwentyThousandTest implements ActionListener, Runnable {
private
static
void
doAttempt
()
throws
Exception
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
if
(
ALWAYS_NEW_INSTANCE
||
(
CHOOSER
==
null
)
)
CHOOSER
=
new
JFileChooser
(
tmpDir
);
if
(
UPDATE_UI_EACH_INTERVAL
)
CHOOSER
.
updateUI
();
if
(
AUTO_CLOSE_DIALOG
)
{
Thread
t
=
new
Thread
(
new
TwentyThousandTest
(
CHOOSER
)
);
t
.
start
();
CHOOSER
.
showOpenDialog
(
null
);
}
else
{
CHOOSER
.
showOpenDialog
(
null
);
}
final
JFileChooser
chooser
=
new
JFileChooser
(
tmpDir
);
chooser
.
updateUI
();
// Postpone JFileChooser closing until it becomes visible
chooser
.
addHierarchyListener
(
new
HierarchyListener
()
{
@Override
public
void
hierarchyChanged
(
HierarchyEvent
e
)
{
if
((
e
.
getChangeFlags
()
&
HierarchyEvent
.
SHOWING_CHANGED
)
!=
0
)
{
if
(
chooser
.
isShowing
())
{
Thread
thread
=
new
Thread
(
new
Runnable
()
{
public
void
run
()
{
try
{
Thread
.
sleep
(
INTERVAL
);
// Close JFileChooser
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
chooser
.
cancelSelection
();
}
});
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
});
thread
.
start
();
}
}
}
});
chooser
.
showOpenDialog
(
null
);
}
});
// Allow to collect garbage by GC
Thread
.
sleep
(
1000
);
System
.
gc
();
}
DisposerRecord
disposerRecord
=
new
DisposerRecord
()
{
public
void
dispose
()
{
disposerComplete
=
true
;
}
};
private
final
JFileChooser
chooser
;
disposerComplete
=
false
;
TwentyThousandTest
(
JFileChooser
chooser
)
{
this
.
chooser
=
chooser
;
}
Disposer
.
addRecord
(
new
Object
(),
disposerRecord
);
public
void
run
()
{
while
(
!
this
.
chooser
.
isShowing
()
)
{
try
{
Thread
.
sleep
(
30
);
}
catch
(
InterruptedException
exception
)
{
exception
.
printStackTrace
();
}
while
(!
disposerComplete
)
{
Util
.
generateOOME
();
}
Timer
timer
=
new
Timer
(
INTERVAL
,
this
);
timer
.
setRepeats
(
false
);
timer
.
start
();
}
public
void
actionPerformed
(
ActionEvent
event
)
{
this
.
chooser
.
cancelSelection
();
}
}
test/javax/swing/JOptionPane/7138665/bug7138665.java
0 → 100644
浏览文件 @
4f58ed9d
/*
* Copyright (c) 2012, 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 7138665
@summary JOptionPane.getValue() unexpected change between JRE 1.6 and JRE 1.7
@author Pavel Porvatov
*/
import
sun.awt.SunToolkit
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.KeyEvent
;
public
class
bug7138665
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
@Override
public
void
run
()
{
JOptionPane
pane
=
new
JOptionPane
(
"Enter value"
,
JOptionPane
.
QUESTION_MESSAGE
,
JOptionPane
.
OK_CANCEL_OPTION
,
null
,
null
,
null
);
pane
.
setWantsInput
(
true
);
JDialog
dialog
=
pane
.
createDialog
(
null
,
"My Dialog"
);
dialog
.
setVisible
(
true
);
Object
result
=
pane
.
getValue
();
if
(
result
==
null
||
((
Integer
)
result
).
intValue
()
!=
JOptionPane
.
OK_OPTION
)
{
throw
new
RuntimeException
(
"Invalid result: "
+
result
);
}
System
.
out
.
println
(
"Test bug7138665 passed"
);
}
});
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
toolkit
.
realSync
();
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
100
);
robot
.
keyPress
(
KeyEvent
.
VK_ENTER
);
robot
.
keyRelease
(
KeyEvent
.
VK_ENTER
);
toolkit
.
realSync
();
}
}
test/javax/swing/JProgressBar/7141573/bug7141573.java
0 → 100644
浏览文件 @
4f58ed9d
/*
* Copyright (c) 2012, 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 7141573
@summary JProgressBar resize exception, if setStringPainted in Windows LAF
@author Pavel Porvatov
*/
import
javax.swing.*
;
import
java.awt.image.BufferedImage
;
public
class
bug7141573
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
try
{
UIManager
.
setLookAndFeel
(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"WindowsLookAndFeel is not supported. The test bug7141573 is skipped."
);
return
;
}
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
BufferedImage
image
=
new
BufferedImage
(
200
,
200
,
BufferedImage
.
TYPE_INT_ARGB
);
JProgressBar
bar
=
new
JProgressBar
();
bar
.
setStringPainted
(
true
);
bar
.
setSize
(
100
,
1
);
bar
.
paint
(
image
.
getGraphics
());
bar
.
setSize
(
1
,
100
);
bar
.
paint
(
image
.
getGraphics
());
System
.
out
.
println
(
"The test bug7141573 is passed."
);
}
});
}
}
test/javax/swing/JTree/4314199/bug4314199.html
0 → 100644
浏览文件 @
4f58ed9d
<html>
<body>
Select the last tree node (marked "Here") and click on the menu.
Look at the vertical line connecting nodes "Bug" and "Here". If
this line disappears when the menu drops down, test fails.
<applet
code=
"bug4314199.class"
width=
200
height=
200
></applet>
</body>
</html>
test/javax/swing/JTree/4314199/bug4314199.java
0 → 100644
浏览文件 @
4f58ed9d
/*
* Copyright (c) 2012, 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 4314199
* @summary Tests that JTree repaints correctly in a container with a JMenu
* @author Peter Zhelezniakov
* @run applet/manual=yesno bug4314199.html
*/
import
javax.swing.*
;
import
javax.swing.tree.*
;
public
class
bug4314199
extends
JApplet
{
public
void
init
()
{
try
{
UIManager
.
setLookAndFeel
(
"javax.swing.plaf.metal.MetalLookAndFeel"
);
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
createAndShowGUI
();
}
});
}
catch
(
final
Exception
e
)
{
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
createAndShowMessage
(
"Test fails because of exception: "
+
e
.
getMessage
());
}
});
}
}
private
void
createAndShowMessage
(
String
message
)
{
getContentPane
().
add
(
new
JLabel
(
message
));
}
private
void
createAndShowGUI
()
{
JMenuBar
mb
=
new
JMenuBar
();
// needed to exactly align left edge of menu and angled line of tree
mb
.
add
(
Box
.
createHorizontalStrut
(
27
));
JMenu
mn
=
new
JMenu
(
"Menu"
);
JMenuItem
mi
=
new
JMenuItem
(
"MenuItem"
);
mn
.
add
(
mi
);
mb
.
add
(
mn
);
setJMenuBar
(
mb
);
DefaultMutableTreeNode
n1
=
new
DefaultMutableTreeNode
(
"Root"
);
DefaultMutableTreeNode
n2
=
new
DefaultMutableTreeNode
(
"Duke"
);
n1
.
add
(
n2
);
DefaultMutableTreeNode
n3
=
new
DefaultMutableTreeNode
(
"Bug"
);
n2
.
add
(
n3
);
n3
.
add
(
new
DefaultMutableTreeNode
(
"Blah"
));
n3
.
add
(
new
DefaultMutableTreeNode
(
"Blah"
));
n3
.
add
(
new
DefaultMutableTreeNode
(
"Blah"
));
DefaultMutableTreeNode
n4
=
new
DefaultMutableTreeNode
(
"Here"
);
n2
.
add
(
n4
);
JTree
tree
=
new
JTree
(
new
DefaultTreeModel
(
n1
));
tree
.
putClientProperty
(
"JTree.lineStyle"
,
"Angled"
);
tree
.
expandPath
(
new
TreePath
(
new
Object
[]{
n1
,
n2
,
n3
}));
setContentPane
(
tree
);
}
}
test/javax/swing/tree/DefaultTreeCellRenderer/7142955/bug7142955.java
0 → 100644
浏览文件 @
4f58ed9d
/*
* Copyright (c) 2012, 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 7142955
@summary DefaultTreeCellRenderer doesn't honor 'Tree.rendererFillBackground' LAF property
@author Pavel Porvatov
*/
import
javax.swing.*
;
import
javax.swing.tree.DefaultTreeCellRenderer
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
public
class
bug7142955
{
private
static
final
Color
TEST_COLOR
=
Color
.
RED
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
UIManager
.
put
(
"Tree.rendererFillBackground"
,
Boolean
.
FALSE
);
UIManager
.
put
(
"Tree.textBackground"
,
TEST_COLOR
);
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
int
w
=
200
;
int
h
=
100
;
BufferedImage
image
=
new
BufferedImage
(
w
,
h
,
BufferedImage
.
TYPE_INT_ARGB
);
Graphics
g
=
image
.
getGraphics
();
g
.
setColor
(
Color
.
WHITE
);
g
.
fillRect
(
0
,
0
,
image
.
getWidth
(),
image
.
getHeight
());
DefaultTreeCellRenderer
renderer
=
new
DefaultTreeCellRenderer
();
renderer
.
setSize
(
w
,
h
);
renderer
.
paint
(
g
);
for
(
int
y
=
0
;
y
<
h
;
y
++)
{
for
(
int
x
=
0
;
x
<
w
;
x
++)
{
if
(
image
.
getRGB
(
x
,
y
)
==
TEST_COLOR
.
getRGB
())
{
throw
new
RuntimeException
(
"Test bug7142955 failed"
);
}
}
}
System
.
out
.
println
(
"Test bug7142955 passed."
);
}
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录