Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ec9212ec
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看板
提交
ec9212ec
编写于
6月 26, 2008
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6718965: Swing color chooser tests should be open source
Reviewed-by: peterz
上级
1c3d2eab
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
643 addition
and
0 deletion
+643
-0
test/javax/swing/JColorChooser/Test4165217.java
test/javax/swing/JColorChooser/Test4165217.java
+78
-0
test/javax/swing/JColorChooser/Test4177735.java
test/javax/swing/JColorChooser/Test4177735.java
+95
-0
test/javax/swing/JColorChooser/Test4193384.java
test/javax/swing/JColorChooser/Test4193384.java
+70
-0
test/javax/swing/JColorChooser/Test4234761.java
test/javax/swing/JColorChooser/Test4234761.java
+60
-0
test/javax/swing/JColorChooser/Test4380468.html
test/javax/swing/JColorChooser/Test4380468.html
+17
-0
test/javax/swing/JColorChooser/Test4380468.java
test/javax/swing/JColorChooser/Test4380468.java
+40
-0
test/javax/swing/JColorChooser/Test4461329.java
test/javax/swing/JColorChooser/Test4461329.java
+46
-0
test/javax/swing/JColorChooser/Test4711996.java
test/javax/swing/JColorChooser/Test4711996.java
+41
-0
test/javax/swing/JColorChooser/Test4759306.html
test/javax/swing/JColorChooser/Test4759306.html
+8
-0
test/javax/swing/JColorChooser/Test4759306.java
test/javax/swing/JColorChooser/Test4759306.java
+42
-0
test/javax/swing/JColorChooser/Test4759934.html
test/javax/swing/JColorChooser/Test4759934.html
+14
-0
test/javax/swing/JColorChooser/Test4759934.java
test/javax/swing/JColorChooser/Test4759934.java
+80
-0
test/javax/swing/JColorChooser/Test4887836.html
test/javax/swing/JColorChooser/Test4887836.html
+9
-0
test/javax/swing/JColorChooser/Test4887836.java
test/javax/swing/JColorChooser/Test4887836.java
+43
-0
未找到文件。
test/javax/swing/JColorChooser/Test4165217.java
0 → 100644
浏览文件 @
ec9212ec
/*
* Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4165217
* @summary Tests JColorChooser serialization
* @author Ilya Boyandin
*/
import
java.awt.Color
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.ObjectInputStream
;
import
java.io.ObjectOutputStream
;
import
java.util.Random
;
import
javax.swing.JColorChooser
;
public
class
Test4165217
{
public
static
void
main
(
String
[]
args
)
{
JColorChooser
chooser
=
new
JColorChooser
();
chooser
.
setColor
(
new
Color
(
new
Random
().
nextInt
()));
Color
before
=
chooser
.
getColor
();
Color
after
=
copy
(
chooser
).
getColor
();
if
(!
after
.
equals
(
before
))
{
throw
new
Error
(
"color is changed after serialization"
);
}
}
private
static
JColorChooser
copy
(
JColorChooser
chooser
)
{
try
{
return
(
JColorChooser
)
deserialize
(
serialize
(
chooser
));
}
catch
(
ClassNotFoundException
exception
)
{
throw
new
Error
(
"unexpected exception during class creation"
,
exception
);
}
catch
(
IOException
exception
)
{
throw
new
Error
(
"unexpected exception during serialization"
,
exception
);
}
}
private
static
byte
[]
serialize
(
Object
object
)
throws
IOException
{
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
baos
);
oos
.
writeObject
(
object
);
oos
.
flush
();
return
baos
.
toByteArray
();
}
private
static
Object
deserialize
(
byte
[]
array
)
throws
IOException
,
ClassNotFoundException
{
ByteArrayInputStream
bais
=
new
ByteArrayInputStream
(
array
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
bais
);
return
ois
.
readObject
();
}
}
test/javax/swing/JColorChooser/Test4177735.java
0 → 100644
浏览文件 @
ec9212ec
/*
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4177735
* @summary Tests that JColorChooser leaves no threads when disposed
* @author Shannon Hickey
*/
import
java.awt.Point
;
import
javax.swing.JColorChooser
;
import
javax.swing.JDialog
;
import
javax.swing.SwingUtilities
;
import
javax.swing.colorchooser.AbstractColorChooserPanel
;
public
class
Test4177735
implements
Runnable
{
private
static
final
long
DELAY
=
1000L
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
JColorChooser
chooser
=
new
JColorChooser
();
AbstractColorChooserPanel
[]
panels
=
chooser
.
getChooserPanels
();
chooser
.
setChooserPanels
(
new
AbstractColorChooserPanel
[]
{
panels
[
1
]
});
JDialog
dialog
=
show
(
chooser
);
pause
(
DELAY
);
dialog
.
dispose
();
pause
(
DELAY
);
Test4177735
test
=
new
Test4177735
();
SwingUtilities
.
invokeAndWait
(
test
);
if
(
test
.
count
!=
0
)
{
throw
new
Error
(
"JColorChooser leaves "
+
test
.
count
+
" threads running"
);
}
}
static
JDialog
show
(
JColorChooser
chooser
)
{
JDialog
dialog
=
JColorChooser
.
createDialog
(
null
,
null
,
false
,
chooser
,
null
,
null
);
dialog
.
setVisible
(
true
);
// block till displayed
Point
point
=
null
;
while
(
point
==
null
)
{
try
{
point
=
dialog
.
getLocationOnScreen
();
}
catch
(
IllegalStateException
exception
)
{
pause
(
DELAY
);
}
}
return
dialog
;
}
private
static
void
pause
(
long
delay
)
{
try
{
Thread
.
sleep
(
delay
);
}
catch
(
InterruptedException
exception
)
{
}
}
private
int
count
;
public
void
run
()
{
ThreadGroup
group
=
Thread
.
currentThread
().
getThreadGroup
();
Thread
[]
threads
=
new
Thread
[
group
.
activeCount
()];
int
count
=
group
.
enumerate
(
threads
,
false
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
String
name
=
threads
[
i
].
getName
();
if
(
"SyntheticImageGenerator"
.
equals
(
name
))
{
// NON-NLS: thread name
this
.
count
++;
}
}
}
}
test/javax/swing/JColorChooser/Test4193384.java
0 → 100644
浏览文件 @
ec9212ec
/*
* Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4193384 4200976
* @summary Tests the color conversions and the preview panel foreground color
* @author Mark Davidson
*/
import
java.awt.Color
;
import
javax.swing.JColorChooser
;
import
javax.swing.JLabel
;
public
class
Test4193384
{
public
static
void
main
(
String
[]
args
)
{
test
(
new
Color
[]
{
new
Color
(
11
,
12
,
13
),
new
Color
(
204
,
0
,
204
),
new
Color
(
0
,
51
,
51
)
});
}
private
static
void
test
(
Color
[]
colors
)
{
JLabel
label
=
new
JLabel
(
"Preview Panel"
);
// NON-NLS: simple label
JColorChooser
chooser
=
new
JColorChooser
();
chooser
.
setPreviewPanel
(
label
);
float
[]
hsb
=
new
float
[
3
];
for
(
int
i
=
0
;
i
<
colors
.
length
;
i
++)
{
Color
color
=
colors
[
i
];
// Make sure sure that there wasn't a regression
// in java.awt.Color and the conversion methods
Color
.
RGBtoHSB
(
color
.
getRed
(),
color
.
getGreen
(),
color
.
getBlue
(),
hsb
);
if
(!
color
.
equals
(
Color
.
getHSBColor
(
hsb
[
0
],
hsb
[
1
],
hsb
[
2
])))
{
throw
new
Error
(
"color conversion is failed"
);
}
// 4193384 regression test
if
(!
color
.
equals
(
new
JColorChooser
(
color
).
getColor
()))
{
throw
new
Error
(
"constructor sets incorrect initial color"
);
}
// 4200976 regression test
chooser
.
setColor
(
color
);
if
(!
color
.
equals
(
label
.
getForeground
()))
{
throw
new
Error
(
"a custom preview panel doesn't handle colors"
);
}
}
}
}
test/javax/swing/JColorChooser/Test4234761.java
0 → 100644
浏览文件 @
ec9212ec
/*
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4234761
* @summary RGB values sholdn't be changed in transition to HSB tab
* @author Oleg Mokhovikov
*/
import
java.awt.Color
;
import
java.beans.PropertyChangeEvent
;
import
java.beans.PropertyChangeListener
;
import
javax.swing.JColorChooser
;
import
javax.swing.JDialog
;
import
javax.swing.JTabbedPane
;
public
class
Test4234761
implements
PropertyChangeListener
{
private
static
final
Color
COLOR
=
new
Color
(
51
,
51
,
51
);
public
static
void
main
(
String
[]
args
)
{
JColorChooser
chooser
=
new
JColorChooser
(
COLOR
);
JDialog
dialog
=
Test4177735
.
show
(
chooser
);
PropertyChangeListener
listener
=
new
Test4234761
();
chooser
.
addPropertyChangeListener
(
"color"
,
listener
);
// NON-NLS: property name
JTabbedPane
tabbedPane
=
(
JTabbedPane
)
chooser
.
getComponent
(
0
);
tabbedPane
.
setSelectedIndex
(
1
);
// HSB tab index
if
(!
chooser
.
getColor
().
equals
(
COLOR
))
{
listener
.
propertyChange
(
null
);
}
dialog
.
dispose
();
}
public
void
propertyChange
(
PropertyChangeEvent
event
)
{
throw
new
Error
(
"RGB value is changed after transition to HSB tab"
);
}
}
test/javax/swing/JColorChooser/Test4380468.html
0 → 100644
浏览文件 @
ec9212ec
<html>
<body>
1. Click the HSB tab at the ColorChooser.
2. Click in the lower left corner of the gradient palette
in order to select a color such that all three RGB values
are single digit colors (such as 0, 0, 0 or 5, 3, 1).
3. Click another tab, then click back to the HSB tab.
4. Now click the lighter colors that should have
2 and 3 digit RGB values (in the upper right corner).
If all digits of each RGB value are shown then test passes.
If only the last digit of their values are shown then test fails.
<applet
width=
"500"
height=
"400"
code=
"Test4380468.class"
>
</applet>
</body>
</html>
test/javax/swing/JColorChooser/Test4380468.java
0 → 100644
浏览文件 @
ec9212ec
/*
* Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4380468
* @summary JColorChooser's HSB panel should display all RGB digits
* @author Andrey Pikalev
* @run applet/manual=yesno Test4380468.html
*/
import
java.awt.Color
;
import
javax.swing.JApplet
;
import
javax.swing.JColorChooser
;
public
class
Test4380468
extends
JApplet
{
public
void
init
()
{
add
(
new
JColorChooser
(
Color
.
GREEN
));
}
}
test/javax/swing/JColorChooser/Test4461329.java
0 → 100644
浏览文件 @
ec9212ec
/*
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4461329
* @summary Tests getPreviewPanel() and setPreviewPanel() methods
* @author Leif Samuelsson
*/
import
javax.swing.JButton
;
import
javax.swing.JColorChooser
;
public
class
Test4461329
{
public
static
void
main
(
String
[]
args
)
{
JColorChooser
chooser
=
new
JColorChooser
();
if
(
null
==
chooser
.
getPreviewPanel
())
{
throw
new
Error
(
"Failed: getPreviewPanel() returned null"
);
}
JButton
button
=
new
JButton
(
"Color"
);
// NON-NLS: simple label
chooser
.
setPreviewPanel
(
button
);
if
(
button
!=
chooser
.
getPreviewPanel
())
{
throw
new
Error
(
"Failed in setPreviewPanel()"
);
}
}
}
test/javax/swing/JColorChooser/Test4711996.java
0 → 100644
浏览文件 @
ec9212ec
/*
* Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4711996
* @summary Checks if IllegalArgumentException is thrown when updating JColorChooserUI
* @author Konstantin Eremin
*/
import
javax.swing.JColorChooser
;
import
javax.swing.colorchooser.AbstractColorChooserPanel
;
public
class
Test4711996
{
public
static
void
main
(
String
[]
args
)
{
JColorChooser
chooser
=
new
JColorChooser
();
AbstractColorChooserPanel
[]
panels
=
chooser
.
getChooserPanels
();
chooser
.
removeChooserPanel
(
panels
[
0
]);
chooser
.
updateUI
();
}
}
test/javax/swing/JColorChooser/Test4759306.html
0 → 100644
浏览文件 @
ec9212ec
<html>
<body>
If you see the preview panel, then test failed, otherwise it passed.
<applet
width=
"500"
height=
"400"
code=
"Test4759306.class"
>
</applet>
</body>
</html>
test/javax/swing/JColorChooser/Test4759306.java
0 → 100644
浏览文件 @
ec9212ec
/*
* Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4759306
* @summary Checks if JColorChooser.setPreviewPanel removes the old one
* @author Konstantin Eremin
@run applet/manual=yesno Test4759306.html
*/
import
javax.swing.JApplet
;
import
javax.swing.JColorChooser
;
import
javax.swing.JPanel
;
public
class
Test4759306
extends
JApplet
{
public
void
init
()
{
JColorChooser
chooser
=
new
JColorChooser
();
chooser
.
setPreviewPanel
(
new
JPanel
());
getContentPane
().
add
(
chooser
);
}
}
test/javax/swing/JColorChooser/Test4759934.html
0 → 100644
浏览文件 @
ec9212ec
<html>
<body>
1. Press button "Show Dialog" at the frame "Test" and
the dialog with button "Show ColorChooser" should appears.
2. Press button "Show ColorChooser" at the dialog "Dialog" and
the colorchooser should appears.
3. Press the button "Cancel" of colorchooser.
If the focus will come to the frame "Test" then test fails.
If the focus will come to the dialog "Dialog" then test passes.
<applet
width=
"500"
height=
"400"
code=
"Test4759934.class"
>
</applet>
</body>
</html>
test/javax/swing/JColorChooser/Test4759934.java
0 → 100644
浏览文件 @
ec9212ec
/*
* Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4759934
* @summary Tests windows activation problem
* @author Andrey Pikalev
* @run applet/manual=yesno Test4759934.html
*/
import
java.awt.Color
;
import
java.awt.Component
;
import
java.awt.Window
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
javax.swing.JApplet
;
import
javax.swing.JButton
;
import
javax.swing.JColorChooser
;
import
javax.swing.JDialog
;
import
javax.swing.JFrame
;
public
class
Test4759934
extends
JApplet
implements
ActionListener
{
private
static
final
String
CMD_DIALOG
=
"Show Dialog"
;
// NON-NLS: first button
private
static
final
String
CMD_CHOOSER
=
"Show ColorChooser"
;
// NON-NLS: second button
private
final
JFrame
frame
=
new
JFrame
(
"Test"
);
// NON-NLS: frame title
public
void
init
()
{
show
(
this
.
frame
,
CMD_DIALOG
);
}
public
void
actionPerformed
(
ActionEvent
event
)
{
String
command
=
event
.
getActionCommand
();
if
(
CMD_DIALOG
.
equals
(
command
))
{
JDialog
dialog
=
new
JDialog
(
this
.
frame
,
"Dialog"
);
// NON-NLS: dialog title
dialog
.
setLocation
(
200
,
0
);
show
(
dialog
,
CMD_CHOOSER
);
}
else
if
(
CMD_CHOOSER
.
equals
(
command
))
{
Object
source
=
event
.
getSource
();
Component
component
=
(
source
instanceof
Component
)
?
(
Component
)
source
:
null
;
JColorChooser
.
showDialog
(
component
,
"ColorChooser"
,
Color
.
BLUE
);
// NON-NLS: title
}
}
private
void
show
(
Window
window
,
String
command
)
{
JButton
button
=
new
JButton
(
command
);
button
.
setActionCommand
(
command
);
button
.
addActionListener
(
this
);
button
.
setFont
(
button
.
getFont
().
deriveFont
(
64.0f
));
window
.
add
(
button
);
window
.
pack
();
window
.
setVisible
(
true
);
}
}
test/javax/swing/JColorChooser/Test4887836.html
0 → 100644
浏览文件 @
ec9212ec
<html>
<body>
If you do not see white area under swatches,
then test passed, otherwise it failed.
<applet
width=
"500"
height=
"400"
code=
"Test4887836.class"
>
</applet>
</body>
</html>
test/javax/swing/JColorChooser/Test4887836.java
0 → 100644
浏览文件 @
ec9212ec
/*
* Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4887836
* @summary Checks if no tooltip modification when no KeyStroke modifier
* @author Konstantin Eremin
* @run applet/manual=yesno Test4887836.html
*/
import
java.awt.Color
;
import
java.awt.Font
;
import
javax.swing.JApplet
;
import
javax.swing.JColorChooser
;
import
javax.swing.UIManager
;
public
class
Test4887836
extends
JApplet
{
public
void
init
()
{
UIManager
.
put
(
"Label.font"
,
new
Font
(
"Perpetua"
,
0
,
36
));
// NON-NLS: property and font names
add
(
new
JColorChooser
(
Color
.
LIGHT_GRAY
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录