慢速Java Swing菜单的解决方法 [英] Workaround for Slow Java Swing Menus

查看:133
本文介绍了慢速Java Swing菜单的解决方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java 7和8中,Swing菜单中存在一个错误,导致在其他X11应用程序正在运行时通过X11远程运行应用程序时,它会变慢.此问题在Java 7中引入,但从未得到修复.有没有人有任何解决方法的建议.使用nxclient解决了这个Swing菜单问题,但是引入了自己不受欢迎的问题.

In Java 7 and 8 there is a bug in Swing menus that causes it to be slow when running an application remotely over X11 while other X11 applications are running. This issue was introduced in Java 7 and has never been fixed. Does anyone have any suggestions on a workaround. Using nxclient addresses this Swing menu issue, but introduces its own unwelcome issues.

重现Swing菜单问题的步骤是: -通过一些活动在本地运行任何X11应用程序 -使用ssh登录到远程服务器-Y someserver -执行任何运行Java 7或8的Java GUI应用程序(例如jvisualvm) -选择菜单并观察几秒钟的响应时间

The steps to reproduce the Swing menu issue are: - run any X11 application locally with some activity - log into a remote server using ssh -Y someserver - execute any Java GUI application (e.g. jvisualvm) running Java 7 or 8 - select a menu and observe a several second delay in response

推荐答案

只花了整整一天的时间来解决同一问题.那里几乎没有任何信息.

Just spent an entire day trying to solve the same issue. There's barely any info out there.

本地计算机:

  1. Linux FedoraCore 20,KDE桌面,NVIDIA GeForce 7300 LE
  2. Linux FedoraCore 20,KDE桌面,NVIDIA GeForce GT 720

通过ssh运行远程Java GUI,对于PC2,摆动弹出窗口非常慢.桌面冻结,直到出现弹出窗口.另一方面,PC1运行非常快速/流畅,完全没有问题.

Running remote Java GUI over ssh, swing popups are extremely slow for PC2. Desktop freezes until popup appears. On the other hand, PC1 runs very fast/smooth, with no problems at all.

在我的情况下,问题是PC2具有2个监视器.我可以找到的最接近的错误报告是: JDK-8004103:sun.awt.X11.XToolkit.getScreenInsets()可能很慢,而且似乎仍处于打开状态.

Turns out, in my case, the problem is that PC2 has 2 monitors. The closest bug report I could find is: JDK-8004103 : sun.awt.X11.XToolkit.getScreenInsets() may be very slow and it appears to be still open.

临时解决方法:

  1. 在KDE中,禁用第二个监视器,启动应用程序,启用第二个监视器
  2. 在Gnome桌面中工作(我的Gnome环境不受此问题影响)
  3. 使用Java 6启动远程Java应用程序(Java6中不存在此问题)

这些都不是理想的解决方法,但是考虑到每次单击菜单项时,我的桌面都会冻结3-4秒,因此暂时可以解决.

None of these are ideal workarounds, but considering that my Desktop freezes for 3-4 seconds every time I click on a menu item, they'll do for the time being.

这篇关于慢速Java Swing菜单的解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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