Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (407)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Invisible cursor and X 11  (Read 1155 times)
0 Members and 1 Guest are viewing this topic.
Offline altair

Senior Newbie





« Posted 2004-10-10 01:00:58 »

Trying to hide the cursor with JDK1.5.0 on linux, I get

Exception in thread "main" java.lang.ExceptionInInitializerError
       at apollo.Surface.<init>(Surface.java:59)
       at test.TestLevel.run(TestLevel.java:69)
       at test.TestLevel.main(TestLevel.java:54)
Caused by: java.lang.IndexOutOfBoundsException: invalid hotSpot
       at sun.awt.CustomCursor.<init>(CustomCursor.java:61)
       at sun.awt.X11CustomCursor.<init>(X11CustomCursor.java:26)
       at sun.awt.X11.XCustomCursor.<init>(XCustomCursor.java:27)
       at sun.awt.X11.XToolkit.createCustomCursor(XToolkit.java:742)
       at apollo.CursorManager.createInvisibleCursor(CursorManager.java:68)
       at apollo.CursorManager.<clinit>(CursorManager.java:37)
       ... 3 more


The code looks like this:
private static Cursor createInvisibleCursor()
 {
   // Create the invisible cursor
   MemoryImageSource memIm = new MemoryImageSource(1, 1, new int[] { 0 }, 0, 1);
   Component c = new Component() { };
   Image im = c.createImage(memIm);
   Point spot = new Point(1, 1);
   return c.getToolkit().createCustomCursor(im, spot, INVISIBLE_CURSOR_NAME);
 }

Has anybody experienced the same problem ? Any solution ?
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #1 - Posted 2004-10-10 07:44:01 »

It looks like you're creating a 1x1 image, and trying to use 1,1 point as a hotspot. (1,1) is out of bounds for a 1x1 image.
You should use 0,0 instead.
Offline altair

Senior Newbie





« Reply #2 - Posted 2004-10-11 01:05:59 »

Thanks,

Actually what surprised me is that the same code worked with JDK 1.4.2 (Windows). I guess something has changed in the JDK 1.5 that now exposes my misuse of the hotspot.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #3 - Posted 2004-10-11 04:40:10 »

I'm guessing that the awt team has fixed some bug, so now the exception is thrown if the hotspot is invalid..
Offline princec
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


Eh? Who? What? ... Me?


« Reply #4 - Posted 2004-10-11 17:59:41 »

But... it shouldn't be invalid!!! A hotspot can be anywhere relative to the actual image really... even outside of it.

Cas Smiley

Offline Abuse

JGO Coder


Medals: 2


falling into the abyss of reality


« Reply #5 - Posted 2004-10-11 18:52:51 »

you have a Point there. <ho ho>

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here!
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #6 - Posted 2004-10-14 05:23:23 »

That's why I shouldn't be allowed to answer non-java2d related questions, at least, w/o reading the javadoc first =)

Looks like it could be a new bug,  likely to be caused by XAWT, assuming the Dimension returned by getBestCursorSize is more than 0x0- see the javadoc for createCustomCursor.

Try running your app with -Dawt.toolkit=sun.awt.motif.MToolkit
to see if it works with motif toolkit.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (94 views)
2013-05-17 21:29:12

alaslipknot (102 views)
2013-05-16 21:24:48

gouessej (132 views)
2013-05-16 00:53:38

gouessej (127 views)
2013-05-16 00:17:58

theagentd (138 views)
2013-05-15 15:01:13

theagentd (126 views)
2013-05-15 15:00:54

StreetDoggy (167 views)
2013-05-14 15:56:26

kutucuk (189 views)
2013-05-12 17:10:36

kutucuk (192 views)
2013-05-12 15:36:09

UnluckyDevil (199 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.13 seconds with 20 queries.