java 1.6.0 29,Java小程序在JRE 1.6.0_29不敛聚焦和最多(OS X)

A Java applet has the following in its start() method :

this.setFocusable(true);

this.requestFocus();

When launched, the applet grabs the focus only in certain OS/JRE/browser configurations. It's compiled using JDK 1.6.0_18, and on my PC running Java 1.7 it grabs focus in all browsers (Ie, chrome, Firefox) without problems; even if the applet is compiled using JDK 1.7.

On Mac OS X 10.6.8 which comes with Java 1.6.0_29 it doesn't grab focus in Safari, Chrome or Firefox, but the applet loads fine. When I upgrade the the Mac OSX JDK to the preview 1.7 - it doesnt' load the applet at all. If I compile the applet using JDK 1.7 and run using JRE 1.7 - it just crashes the browsers on the Mac.

Has anyone come across similar problems? thanks.

解决方案

Because the focus behavior of this method is platform-dependent, developers are strongly encouraged to use requestFocusInWindow when possible.

Is it possible to use the latter in this case?

Has anyone come across similar problems?

Focus problems go hand-in-hand with embedded applets. If you want more reliable focus behavior, launch the applet free-floating using Java Web Start.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值