Create GraphicsDevice for custom driver

*爱你&永不变心* 提交于 2019-12-02 07:25:06

I took a very short look at the abstract class GraphicsEnvironment, and guess, one may derive ones own class, and use the "java.awt.graphicsenv" key of line 64 to register it.

Fortunately there is an abstract class, and the code is little.


Thereafter

The following code from GraphicsEnvironment shows:

  1. System properties (you may set) that are used for headless or not.
  2. The environment setting DISPLAY.

Maybe you can use this info.

                        String osName = System.getProperty("os.name");
                        if (osName.contains("OS X") && "sun.awt.HToolkit".equals(
                                System.getProperty("awt.toolkit")))
                        {
                            headless = defaultHeadless = Boolean.TRUE;
                        } else {
                            headless = defaultHeadless =
                                Boolean.valueOf(("Linux".equals(osName) ||
                                                 "SunOS".equals(osName) ||
                                                 "FreeBSD".equals(osName) ||
                                                 "NetBSD".equals(osName) ||
                                                 "OpenBSD".equals(osName)) &&
                                                 (System.getenv("DISPLAY") == null));
                        }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!