diff options
author | Sven Gothel <[email protected]> | 2014-02-26 15:53:41 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-02-26 15:53:41 +0100 |
commit | 9fb1e46e43900ec9b2f9c9af1fc8984e101c8811 (patch) | |
tree | 5eb0a8995568f39e02e0bc37ecf1ac02e1c50a2d /src/nativewindow/classes/jogamp | |
parent | c2e6233c57f47c067dbb24f4a6a127fbaedf7a08 (diff) |
AWTMisc.static: Allow static creation of 'null' AWT cursor to fail (i.e. AWT headless)
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java index 069cffeb8..3099f293d 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java +++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java @@ -50,6 +50,8 @@ import javax.media.nativewindow.util.PixelFormat; import javax.media.nativewindow.util.PixelFormatUtil; import javax.swing.MenuSelectionManager; +import jogamp.nativewindow.jawt.JAWTUtil; + public class AWTMisc { public static JFrame getJFrame(Component c) { @@ -174,9 +176,18 @@ public class AWTMisc { static final HashMap<Integer, Cursor> cursorMap = new HashMap<Integer, Cursor>(); static final Cursor nulCursor; static { - final Toolkit toolkit = Toolkit.getDefaultToolkit(); - final BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR); - nulCursor = toolkit.createCustomCursor(img, new Point(0,0), "nullCursor"); + Cursor _nulCursor = null; + try { + final Toolkit toolkit = Toolkit.getDefaultToolkit(); + final BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR); + _nulCursor = toolkit.createCustomCursor(img, new Point(0,0), "nullCursor"); + } catch (Exception he) { + if( JAWTUtil.DEBUG ) { + System.err.println("Catched exception: "+he.getMessage()); + he.printStackTrace(); + } + } + nulCursor = _nulCursor; } public static synchronized Cursor getNullCursor() { return nulCursor; } |