2

私がPCを持っているとき、DVI出力とモニターはVGA入力です(そのため、小さなDViからVGAへのコンバーターを使用しました、私はOSのディスプレイを持っています)

Linux 表示クエリは、次のように表示されます。

$ export DISPLAY=:0.0 && xrandr
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 640 x 480, current 1280 x 1024, maximum 1280 x 1024
default connected 1280x1024+0+0 0mm x 0mm
   1280x1024       0.0* 
   1024x768        0.0  
   800x600         0.0  
   640x480         0.0  
  legend (0x10c)   74.5MHz
        h: width  1280 start 1344 end 1472 total 1664 skew    0 clock   44.8KHz
        v: height  720 start  723 end  728 total  748           clock   59.9Hz

-- 起動中に Java アプリケーションが混乱し、アプリケーションの起動に失敗し、次の例外が発生する場所dm.getWidth();:

screen = Toolkit.getDefaultToolkit().getScreenSize();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] screenDevices = ge.getScreenDevices();
for (int i = 0; i < screenDevices.length; i++) {
  System.out.println(screenDevices[i].getIDstring());
  DisplayMode dm = screenDevices[i].getDisplayMode();
  int screenWidth = dm.getWidth();    // this fails....
  int screenHeight = dm.getHeight();
  System.out.println("[myResolution]: " + screenWidth + " " + screenHeight);
  screen.width = screenWidth;
  screen.height = screenHeight;
}

--出力:

[meJavaDebug]: YES i am running

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at main.YumYumYum.createAndShowGUI(YumYumYum.java:167)
    at main.YumYumYum.access$000(YumYumYum.java:42)
    at main.YumYumYum$1.run(YumYumYum.java:118)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:647)
    at java.awt.EventQueue.access$000(EventQueue.java:96)
    at java.awt.EventQueue$1.run(EventQueue.java:608)
    at java.awt.EventQueue$1.run(EventQueue.java:606)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:617)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)

Total Garbage Collections: 0
Total Garbage Collection Time (ms): 0

何か案が?

4

1 に答える 1

3

がシステムscreenDevices[i].getDisplayMode()に戻っnullてきているようです。

これは、Java Bugs Database のこのバグに関連している可能性があります。実行可能な回避策はないようですnull

于 2012-06-09T09:15:48.107 に答える