Java小程序在JRE 1.6.0_29不敛聚焦和最多(OS X) [英] java applet not grabbing focus in JRE 1.6.0_29 and up (OS X)

查看:438
本文介绍了Java小程序在JRE 1.6.0_29不敛聚焦和最多(OS X)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个Java小程序在其启动)以下的(方法:

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

this.setFocusable(true);
this.requestFocus();

在启动后,小程序抓住重点只在某些OS / JRE /浏览器配置。它使用JDK 1.6.0_18编译和运行Java 1.7我的电脑就可以在所有浏览器(IE,Chrome浏览器,火狐)没有抓住问题的重点;即使小程序使用JDK 1.7编译。

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.

在附带的Java 1.6.0_29它​​不会在Safari,Chrome或Firefox抓住重点的Mac OS X 10.6.8,但小程序加载罚款。当我升级了Mac OSX上JDK的preVIEW 1.7 - 它不'装入小应用程序在所有。如果我编译使用JDK 1.7小程序,然后使用JRE 1.7上运行 - 它只是崩溃在Mac上浏览器

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.

推荐答案

该文档。对于 Component.requestFocus() 状态:

The docs. for Component.requestFocus() state:

由于这种方法的焦点行为是与平台相关的,开发者强烈建议使用的 requestFocusInWindow 在可能的情况。

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?

焦点问题去手牵手与嵌入式小程序。如果你想更可靠的焦点行为,启动小应用程序自由浮动使用 Java Web Start的

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.

这篇关于Java小程序在JRE 1.6.0_29不敛聚焦和最多(OS X)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆