Java Jframe将另一个JFrame启动到另一个X Server [英] Java Jframe launch another JFrame to another X Server

查看:68
本文介绍了Java Jframe将另一个JFrame启动到另一个X Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Xvnc(在Ubuntu上)屏幕(DISPLAY:1)上运行的Java应用程序,我需要做的是,从一个应用程序启动另一个JFrame到主屏幕DISPLAY:0,即一个正在运行的应用程序.在DISPLAY中:1.

I have java application which is runs on Xvnc (on Ubuntu) screen (DISPLAY :1), what I need to do is, to launch another JFrame to main screen DISPLAY :0 from one application, that is, the one running in DISPLAY :1.

我已经考虑过使用Runtime.getRuntime().exec(),但是问题是,我需要从主应用程序控制第二个JFrame属性.

I have think about using Runtime.getRuntime().exec(), but the problem is, i need to control the second JFrame properties from the main application.

请帮助我如何实现.谢谢你.我不需要跨平台的解决方案,仅用于ubuntu.

Please help on how can I achieve that. Thank you. I don't need cross platform solution, just for ubuntu.

更新:

我使用了代码

try{
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gd = ge.getScreenDevices();
    for(int i = 0; i < gd.length; i++){
        System.out.println(gd[i]);
    }
} catch (Exception e){
    e.printStackTrace();
}

我只得到一个显示器X11GraphicsDevice[screen=0],这意味着GraphicsDevice[] gd = ge.getScreenDevices();只有1台设备.未检测到我的XVNC X11服务器(DISPLAY:1).

And i only get one display X11GraphicsDevice[screen=0], meaning that GraphicsDevice[] gd = ge.getScreenDevices(); only have 1 device. My XVNC X11 server (DISPLAY :1) does not detected.

推荐答案

不幸的是,BetaProgrammer解决方案是在同一显示器的2个屏幕上而不是2个不同的显示器上显示JFrame.我最近几天一直在寻找相同的东西,但没有找到任何简单的方法来做到这一点.到目前为止,我将在其自己的显示器上分别拥有2个应用程序,并使用JGroups进行交谈(我直接在这2个应用程序之间发送动作事件).

Unfortunatly TheBetaProgrammer solution is to display JFrames on 2 screens of the same display and not on 2 differents displays. I'm looking for the same thing for the last few days and have not found any easy way to do that. So far I'm going to have 2 applications each on it's its own display, talking together using JGroups (I send directly action events between the 2 apps).

这篇关于Java Jframe将另一个JFrame启动到另一个X Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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