Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f90d6618
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看板
提交
f90d6618
编写于
11月 15, 2010
作者:
V
vikram
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6939261: Since 1.6.0_18 JMenus at JMenuBar are not selectable by their Mnemonic key anymore
Reviewed-by: peterz
上级
ac631d5d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
48 addition
and
1 deletion
+48
-1
src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java
src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java
+48
-1
未找到文件。
src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java
浏览文件 @
f90d6618
...
...
@@ -196,6 +196,10 @@ public class BasicMenuUI extends BasicMenuItemUI
return
getHandler
();
}
protected
MenuKeyListener
createMenuKeyListener
(
JComponent
c
)
{
return
(
MenuKeyListener
)
getHandler
();
}
public
Dimension
getMaximumSize
(
JComponent
c
)
{
if
(((
JMenu
)
menuItem
).
isTopLevelMenu
()
==
true
)
{
Dimension
d
=
c
.
getPreferredSize
();
...
...
@@ -397,7 +401,7 @@ public class BasicMenuUI extends BasicMenuItemUI
public
void
stateChanged
(
ChangeEvent
e
)
{
}
}
private
class
Handler
extends
BasicMenuItemUI
.
Handler
{
private
class
Handler
extends
BasicMenuItemUI
.
Handler
implements
MenuKeyListener
{
//
// PropertyChangeListener
//
...
...
@@ -580,5 +584,48 @@ public class BasicMenuUI extends BasicMenuItemUI
}
public
void
menuDragMouseExited
(
MenuDragMouseEvent
e
)
{}
public
void
menuDragMouseReleased
(
MenuDragMouseEvent
e
)
{}
//
// MenuKeyListener
//
/**
* Open the Menu
*/
public
void
menuKeyTyped
(
MenuKeyEvent
e
)
{
if
(!
crossMenuMnemonic
&&
BasicPopupMenuUI
.
getLastPopup
()
!=
null
)
{
// when crossMenuMnemonic is not set, we don't open a toplevel
// menu if another toplevel menu is already open
return
;
}
if
(
BasicPopupMenuUI
.
getPopups
().
size
()
!=
0
)
{
//Fix 6939261: to return in case not on the main menu
//and has a pop-up.
//after return code will be handled in BasicPopupMenuUI.java
return
;
}
char
key
=
Character
.
toLowerCase
((
char
)
menuItem
.
getMnemonic
());
MenuElement
path
[]
=
e
.
getPath
();
if
(
key
==
Character
.
toLowerCase
(
e
.
getKeyChar
()))
{
JPopupMenu
popupMenu
=
((
JMenu
)
menuItem
).
getPopupMenu
();
ArrayList
newList
=
new
ArrayList
(
Arrays
.
asList
(
path
));
newList
.
add
(
popupMenu
);
MenuElement
subs
[]
=
popupMenu
.
getSubElements
();
MenuElement
sub
=
BasicPopupMenuUI
.
findEnabledChild
(
subs
,
-
1
,
true
);
if
(
sub
!=
null
)
{
newList
.
add
(
sub
);
}
MenuSelectionManager
manager
=
e
.
getMenuSelectionManager
();
MenuElement
newPath
[]
=
new
MenuElement
[
0
];;
newPath
=
(
MenuElement
[])
newList
.
toArray
(
newPath
);
manager
.
setSelectedPath
(
newPath
);
e
.
consume
();
}
}
public
void
menuKeyPressed
(
MenuKeyEvent
e
)
{}
public
void
menuKeyReleased
(
MenuKeyEvent
e
)
{}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录