Linux RHEL7.3 X11 Java GUI转发问题

时间:2017-10-17 12:48:32

标签: java linux awt x11 rhel7

当我使用从 Linux RHEL 7.3 到Windows 8.1 / 10的X11转发时,会出现GUI问题。不显示AWT标签,按钮,菜单。当 Linux RHEL 6.8 或/和SWING使用时,没有问题。 Linux RHEL 7.3 可能有什么问题?

AWTDemo.java:

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class AWTDemo extends Frame
{
    AWTDemo()
    {
        setTitle("AWT Demo");
        setBounds(200,200, 200, 100);
        Button b=new Button("BUTTON");
        b.setBounds(50,100,50,50);
        add(b, BorderLayout.SOUTH);
        addWindowListener(new WindowAdapter()
        {public void windowClosing(WindowEvent we) {dispose();}});
        setVisible(true);
    }

    public static void main(String args[])
    {
        AWTDemo wnd = new AWTDemo();
    }
}

SWINGDemo.java:

import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JFrame;

public class SWINGDemo extends JFrame
{

    SWINGDemo()
    {
        super("SWING Demo");
        setBounds(200,200, 200, 100);
        JButton b = new JButton("BUTTON");
        add(b, BorderLayout.SOUTH);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    public static void main(String[] args)
    {
        SWINGDemo wnd = new SWINGDemo();
    }
}

0 个答案:

没有答案