是否确定使用AWT使用JavaFX? [英] Is it OK to use AWT with JavaFx?

查看:257
本文介绍了是否确定使用AWT使用JavaFX?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些功能,我不能在目前的JavaFX找到。像机器人或托盘图标。

I need some functionality that I cannot find currently in JavaFX. Like the Robot or the Tray Icon.

我知道这些工具使用JavaFX应用程序。
但它是确定使用它们?有没有我应该关心的?任何考虑,

I know these tools do work with JavaFx applications. But is it ok to use them? Are there any considerations that I should care of?

推荐答案

一般来说它不建议。

N.B:


  • 使用任何AWT程序,通过JavaFX将启动整个AWT栈可以增加内存的/ proc消耗。

  • 有可能是玻璃(FX UI堆栈)和AWT之间的冲突线程,尤其是在Mac上。因此,它也许值得使用的Swing互操作性的方法为您的应用程序的 JFXPanel 知道如何处理冲突。

  • 您可以使用,而不是AWT一杯机器人(虽然它不是公开的API,并可能在将来被改变):

  • using any AWT from JavaFX will start whole AWT stack which can increase memory/proc consumption.
  • there could be threading conflicts between Glass (FX UI stack) and AWT, especially on Mac. So it maybe worth using Swing Interoperability approach for your app as JFXPanel is aware how to handle that conflicts.
  • you can use Glass robot instead of AWT one (although it's not public API and may be changed in future):

Robot robot = com.sun.glass.ui.Application.GetApplication().createRobot();
robot.mouseMove(10, 30);
robot.mousePress(1);


这篇关于是否确定使用AWT使用JavaFX?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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