2

2 つの別個のモニターに 2 つの JFrame を表示する Java アプリケーションがあります。Ubuntu と Windows では、アプリケーションは問題なく表示されます。指定した画面 ID でモニターに表示するように JFrame を構成できます。ただし、openSUSE では、設定に関係なく、同じモニターに表示され続けます。openSUSE との違いは何ですか?

JFrame を表示する必要があるモニターを決定するために使用するコードの一部を次に示します。


    GraphicsDevice[] screens = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
    for (int s = 0; s < screens.length; s++) {
        GraphicsConfiguration configuration = null;
        for (int c = 0; c < screens[s].getConfigurations().length; c++) {
            if (AWTUtilities.isTranslucencyCapable(screens[s].getConfigurations()[c])) {
                configuration = screens[s].getConfigurations()[c];
                break;
            }
        }
        if (configuration == null) {
            configuration = screens[s].getDefaultConfiguration();
        }
        if (screens[s].getIDstring().equals[frame1_id]) {
            frame1 = new JFrame("Frame 1", configuration);
            frame1.setResizable(false);
            frame1.setUndecorated(true);
            frame1.setBounds(configuration.getBounds());
            frame1.setVisible(true);
        }
        if (screens[s].getIDstring().equals[frame2_id]) {
            frame2 = new JFrame("Frame 2", configuration);
            frame2.setResizable(false);
            frame2.setUndecorated(true);
            frame2.setBounds(configuration.getBounds());
            frame2.setVisible(true);
        }
    }
4

1 に答える 1

1

の OpenSuse 実装はGraphicsEnvironment、特定のウィンドウ マネージャの選択に依存する場合があります。最適なものを見つけるために実験する必要があります。

補遺: @bouncer は次のようにコメントしています。openSUSE 12.3 のインストール後に行うべき 10 のことも参照してください。

于 2013-05-20T08:39:27.750 に答える