Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
68ed55d6
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看板
提交
68ed55d6
编写于
11月 19, 2014
作者:
P
pchelko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8058193: [macosx] Potential incomplete fix for JDK-8031485
Reviewed-by: alexsch, serb
上级
0071d180
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
13 deletion
+24
-13
src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
+6
-1
test/javax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java
...avax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java
+18
-12
未找到文件。
src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
浏览文件 @
68ed55d6
...
...
@@ -486,10 +486,15 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
// This is somewhat messy. The difference here from BasicComboBoxUI.EnterAction is that
// arrow up or down does not automatically select the
private
static
final
Action
triggerSelectionAction
=
new
AbstractAction
()
{
private
final
Action
triggerSelectionAction
=
new
AbstractAction
()
{
public
void
actionPerformed
(
final
ActionEvent
e
)
{
triggerSelectionEvent
((
JComboBox
)
e
.
getSource
(),
e
);
}
@Override
public
boolean
isEnabled
()
{
return
comboBox
.
isPopupVisible
()
&&
super
.
isEnabled
();
}
};
private
static
final
Action
toggleSelectionAction
=
new
AbstractAction
()
{
...
...
test/javax/swing/JComboBox/Consumed
EscTest/ConsumedEsc
Test.java
→
test/javax/swing/JComboBox/Consumed
KeyTest/ConsumedKey
Test.java
浏览文件 @
68ed55d6
...
...
@@ -24,22 +24,28 @@
import
javax.swing.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.KeyEvent
;
import
java.awt.Robot
;
import
java.awt.Toolkit
;
import
java.awt.Robot
;
import
sun.awt.SunToolkit
;
/*
@test
@bug 8031485
@bug 8031485
8058193
@summary Combo box consuming escape and enter key events
@author Petr Pchelko
@run main Consumed
Esc
Test
@run main Consumed
Key
Test
*/
public
class
Consumed
Esc
Test
{
public
class
Consumed
Key
Test
{
private
static
volatile
JFrame
frame
;
private
static
volatile
boolean
passed
=
false
;
private
static
volatile
boolean
passed
;
public
static
void
main
(
String
...
args
)
throws
Exception
{
test
(
KeyEvent
.
VK_ESCAPE
);
test
(
KeyEvent
.
VK_ENTER
);
}
private
static
void
test
(
final
int
key
)
throws
Exception
{
passed
=
false
;
try
{
SwingUtilities
.
invokeAndWait
(()
->
{
frame
=
new
JFrame
();
...
...
@@ -48,7 +54,7 @@ public class ConsumedEscTest {
panel
.
add
(
combo
);
combo
.
requestFocusInWindow
();
frame
.
setBounds
(
100
,
150
,
300
,
100
);
addAction
(
panel
);
addAction
(
panel
,
key
);
frame
.
add
(
panel
);
frame
.
setVisible
(
true
);
});
...
...
@@ -56,24 +62,25 @@ public class ConsumedEscTest {
Robot
robot
=
new
Robot
();
robot
.
waitForIdle
();
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
robot
.
keyPress
(
KeyEvent
.
VK_ESCAPE
);
robot
.
keyPress
(
key
);
robot
.
waitForIdle
();
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
robot
.
keyRelease
(
KeyEvent
.
VK_ESCAPE
);
robot
.
keyRelease
(
key
);
robot
.
waitForIdle
();
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
if
(!
passed
)
{
throw
new
RuntimeException
(
"FAILED:
ESC
was consumed by combo box"
);
throw
new
RuntimeException
(
"FAILED:
"
+
KeyEvent
.
getKeyText
(
key
)
+
"
was consumed by combo box"
);
}
}
finally
{
if
(
frame
!=
null
)
{
frame
.
dispose
();
}
}
}
private
static
void
addAction
(
JComponent
comp
)
{
KeyStroke
k
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_ESCAPE
,
0
);
private
static
void
addAction
(
JComponent
comp
,
final
int
key
)
{
KeyStroke
k
=
KeyStroke
.
getKeyStroke
(
key
,
0
);
Object
actionKey
=
"cancel"
;
comp
.
getInputMap
(
JComponent
.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
).
put
(
k
,
actionKey
);
Action
cancelAction
=
new
AbstractAction
()
{
...
...
@@ -84,5 +91,4 @@ public class ConsumedEscTest {
};
comp
.
getActionMap
().
put
(
actionKey
,
cancelAction
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录