Can't change cursor using Java 1.4

Hi all,
I wrote a program that worked while I had my Java Platform set to be 1.5. However, when I set my platform to be 1.4.2 (Java Hotspot) I encounter an error. What would be the best way to make the program work as I would like it to?
The code is:
  Toolkit tk = Toolkit.getDefaultToolkit();
  Cursor invisCursor = tk.createCustomCursor(tk.createImage(""),new Point(),null);
  this.setCursor(invisCursor);that is, I'm trying to hide the mouse cursor in my full-screen application.
When running the program in 1.4, the program works, but the mouse does not disappear and I get the following error:
  2006-12-05 14:52:21.935 java[744] *** NSThread: ignoring exception '*** -[NSCFArray objectAtIndex:]: index (2) beyond
   bounds (2)' that raised during delayed perform of target 0xa9a8bc20 and selector '_setNativeCursor:'What would be the best way to make my cursor invisible using Java 1.4?
Thanks!

Ok, here's my SSCCE that replicates my problem on my computer.
I am using a Mac (didn't get to try it on my PC, but regardless, I need this to work on a Mac), and the problem only occurs when I am using set my libraries to be Java 1.4.2.
The first option in hideMouse() simply fails to hide my mouse.
The second option fails to hide my mouse, and gives me the following error message:
  2006-12-06 10:02:27.785 java[394] *** NSThread: ignoring exception '*** -[NSCFArray objectAtIndex:]: index (2) beyond bounds (2)'
    that raised during delayed perform of target 0xa9a8bc20 and selector '_setNativeCursor:'It gives me this message only if I move my mouse, and repeats this message for as long as I move my mouse.
My goal is to hide my mouse.
Any help will be more than appreciated.
SSCCE:
import java.awt.*;
import javax.swing.*;
public class MouseExample extends JFrame {
    public MouseExample() {
        makeFullScreen();
        hideMouse();
    private void makeFullScreen(){
        this.setUndecorated(true);
        this.setResizable(false);
        GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice device = env.getScreenDevices()[0];  
        DisplayMode oldMode = device.getDisplayMode();
        this.setSize(new Dimension(oldMode.getWidth(), oldMode.getHeight()));       
        device.setFullScreenWindow(this);
        addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                System.exit(0);
    private void hideMouse(){
        // ***** Neither this:
        ImageIcon emptyIcon = new ImageIcon(new byte[0]);
        Cursor invisibleCursor = getToolkit().createCustomCursor(
                emptyIcon.getImage(), new Point(0,0), "Invisible");
        this.setCursor(invisibleCursor);
        // ***** nor this:
        Toolkit tk = Toolkit.getDefaultToolkit();
        Cursor invisCursor = tk.createCustomCursor(tk.createImage(""),new Point(),null);
        this.setCursor(invisCursor);
        // ***** works
    public static void main(String[] args) {
        MouseExample m = new MouseExample();
}

Similar Messages

  • How can I change the Jframe Java help Icon

    How can I change then Jframe Java help Icon?.
    I am using then HelpSet class and HelpBroker.
    I want to change the java help icon
    Any Idea? thanks. ...

    It can be done, but it's ugly...
    Add in a listener to your topmost JFrame to sense when the focus is lost, since this happens when a help window comes up. When the focus leaves the main window, check all the windows that are up to see if one is a help window. If so, this will give you a reference to the help window and you can drill down to change what you want.
    Here's an example that changes the icon and removes the borders from the javahelp buttons.
    WindowListener wndCloser = new WindowAdapter() {
              //A necessarily roundabout method to affect
              //look and feel aspects of the javahelp viewer.
              //(there is no way to get at these components directly.)
              //When the main frame loses focus, it may be because
              //the help viewer was brought up. Look through all
              //the current frames to see if one is a help viewer.
              //If it is, change the look of the help viewer
              //to what we want.
              Frame m_helpFrame = null;
              public void windowDeactivated(WindowEvent e) {
              if (m_helpFrame != null)
                   return;
              Frame[] frames = getFrames();
              for (int k = 0; k < frames.length; k++) {
                   if (!(frames[k] instanceof JFrame))
                   continue;
                   JFrame jf = (JFrame)frames[k];
                   if (jf.getContentPane().getComponentCount()==0)
                   continue;
                   Component c = jf.getContentPane().
                   getComponent(0);
                   if (c == null || !(c instanceof JHelp))
                   continue;
                   m_helpFrame = jf;
                   //now that we know the Frame, we can change the title icon
                   final Image image2 = <your icon here>
                   m_helpFrame.setIconImage(image2);
                   JHelp jh = (JHelp)c;
                   for (int s=0; s<jh.getComponentCount(); s++) {
                   c = jh.getComponent(s);
                   if (c == null || !(c instanceof JToolBar))
                        continue;
                   JToolBar jtb = (JToolBar)c;
                   //now that we've accessed the toolbar, we can
                   //modify the look of the buttons.
                   for(int i=0; i<jtb.getComponentCount(); i++) {
                        Component comp = jtb.getComponentAtIndex(i);
                        if(comp instanceof JButton) {
                        JButton button = (JButton)comp;
                        button.setBorder(null);

  • I have iMac osx  version 10.8.5 and i forgot my account login password. i can't change it using my apple ID nor i remember my password.also my fire vault is not on and my keychain won't help. PS i can't also use the terminal idea it always not found.help

    have iMac osx  version 10.8.5 and i forgot my account login password. i can't change it using my apple ID nor i remember my password.also my fire vault is not on and my keychain won't help. PS i can't also use the terminal idea it always not found please help !!

    You need to restart the iMac and hold down the Command and R keys immediately.
    You will then have the utilities drop down and you choose Terminal
    When Terminal opens, type exactly:
    resetpassword
    and press Return.
    When the Reset Password window opens, select the user for which you want to change the password.
    Enter the new password twice, and then click Save.
    Accept the next dialog window,
    And then Apply
    When finished click the apple at the left side of the menu bar, and the Restart.

  • How can I change passwd using CLI

    How can I change userpassword using iPlanet Delegated Administrator v1.1 Command Line Utilities?
    (imadmin user modify ... -A userpassword:MyNewPasswd

    In SIMS 4.0
    1) You know uncrypted password / setup a new one:
    imadmin modify user ... -W user_passwd
    2) You know crypted string:
    imadmin modify user ... -A userpassword:{crypt}a1vDyDPBLgTU2
    For both, you need administrative privileges.
    R.

  • Can I change cursor motion using tab key?

    Hi everyone,
    I'm Tae from Japan.
    Now, I'm developing UI with WD4J and I'd like to change cursor motion.
    for example:
    - left to right
    - up and down
    Environment:
    SAP NW CE 7.1
    SAP NWDS CE 7.1 SP05
    Thanks and BestRegards,
    Tae

    Hi Tae,
    Cursor motion through Tab is default given in WD Java, Cursor goes to next defined element in view. By designing the view layout properly you can manage the cursor movement as per requirement.
    some points :
    1) Tab moves the cursor to next item (if Label property "Labelfor" is  not defined for any ui element, it considers label as one element. Hence define labelfor property)
    2)you can use any of layouts grid, matrix, flow or row to define the ui elements.
    3)Tab will go to the next element in the same container. After completing all elements in one cotainer cursor goes to next container as defined in view.
    3)Shift+Tab will move the cursor backward.
    Regards
    Deepak

  • Can I change Encoding used in InputStreamReader

    Hi Java Gurus:
    Wanted to know if I can somehow change the encoding used by InputStreamReader, the value of which I get by InputStreamReader.getEncoding().
    I did change file.encoding to UTF8, but that does not change the encoding used by InputStreamReader.
    I am getting garbage data when reading a chinese character from a Swing GUI. If I convert the string into a byte array using utf8 encoding, the bytes look OK, but when I print the string, it is all garbage and gets stored in the database (thru JDBC) as garbage (?)
    Any pointer(s) would be a great help guys!
    Thanks,
    Micky G

    Hi Mickey,
    Wanted to know if I can somehow change the encoding used by InputStreamReader,
    the value of which I get by InputStreamReader.getEncoding().Easiest way is to specify the Charset or Charset name String in the constructor,e.g.:
    InputStreamReader isr = new InputStreamReader(iStream,  "UTF-16")
    I am getting garbage data....I don't quite follow what you're describing in this paragraph. Can you elaborate?
    Regards,
    Joe

  • How can I change cursor while it does something?

    hi, all
    following code dosen't change current cursor.
    I want to change cursor to wait_cursor while it opens file,
    but, it doesn't change cursor at all.
    What's problem?
    class aClass extends JFrame{
    btOpen.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){                
    int returnVal = jfcFileDialog.showOpenDialog(SourceEditor.this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    openedFile = jfcFileDialog.getSelectedFile();
    setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));      
    //read openedFile and return text
    String fileContent=readSourceFile();
    setCursor( Cursor.getPredefinedCursorCursor.DEFAULT_CURSOR));
    thank you.

    I finally figured it out. You have to set the cursor on the JFrame's GlassPane. The solution was alluded to in the Evaluation section of a couple of bug reports:
    http://developer.java.sun.com/developer/bugParade/bugs/4357573.html
    http://developer.java.sun.com/developer/bugParade/bugs/4320939.html
    There is also some discussion about this in various Forum threads. (Search for topics using "+getGlassPane +setCursor".)
    My corrected code follows. With this method, you don't even need to start up a secondary thread to get the cursor to change. I do, however, because I have other UI elements that I want to be updated (such as a sort indicator on my column headings.) I also reduce the priority of the sort thread a bit so my UI gets priority.
    Note that I removed the code that tries to remember the original cursor, since, with all the asynchronous execution going on, the wait cursor could actually be the frame's current cursor when this gets executed. If you're not doing a sub-thread as I am, you don't have to worry about this. Also, I have extended JFrame to JFrameBase to handle threading issues and consolidate redundant code (among other things not pictured here). The JFrameBase class definition follows the example code.
    Component lTopLevelComponent = JTableSortable.this.getTopLevelAncestor();
    final JFrameBase lFrame;
    if ( lTopLevelComponent instanceof JFrameBase )
        lFrame = (JFrameBase)lTopLevelComponent;
        lFrame.setFrameCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
    else
        lFrame = null;
    Thread lSortThread = new Thread( "JTableSortable" ) {
        public void run()
            ((SortableTableModel)lModel).sortByColumn( lSortCol, lAscending );
            if ( lFrame != null )
                lFrame.setFrameCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) );
    lSortThread.setPriority( Math.max( Thread.MIN_PRIORITY, Thread.currentThread().getPriority() - 1 ) );
    lSortThread.start();
    public class JFrameBase extends JFrame {
    public void setFrameCursor( final Cursor aCursor )
        SwingUtilities.invokeLater( new Runnable() {
            public void run()
                getGlassPane().setCursor( aCursor );
                getGlassPane().setVisible( true );

  • Can we create cursor using the table created dynamically

    Dear all,
    Can we create the cursor using the table which is created dynamically using "Execute immediate" within the same procedure,
    or is there any way to call the table created dynamically ..
    please Do Help me in this
    thanks alot
    Edited by: khaja on Jan 18, 2009 10:57 AM

    Well, I don't think this approach is bad in any possible circumstances. It depends on the requirements we don't know. Yes, usually applications should not be designed in this way. But 'usually' does not mean 'never'. One possible case is described in Oracle's example Referencing Database Objects that Do Not Exist at Compilation. It's possible to assume that tables inv_01_2003, inv_04_2003, etc from the referenced topic What Is Dynamic SQL? are generated automatically by some job using dynamic create table stmt. If the OP has similar requirements tnen this approach is not bad. It may not be the best one but it at least is not so bad as you said.
    I believe that OPs know their requirements much better than me. This is why I always try to answer the exact question. If the approach is really ugly then I don't answer such questions at all.
    Regards,
    Dima
    Message was edited by:
    DimaCit

  • How can I change the use for iCal

    I currently use iCal so that my iPad, iPhone and iMac are all synch'g.  So far it has worked seemlessly until now at least!
    My iTunes account is setup under my wife's name so iCal is actually listed through her.  This has never been a problem but I just realized that when I accept and invitation to a event on my calender it lists it as my wife's name not mine.   Can I change that without affecting all of my calenders?

    So far I have been able to change the name that was listed under iCloud under ical's user settings.  It didn't change the name that was listed on my event that i already responded to.  ANyone know if this would make the difference?

  • Can I send email using Java from my localhost(Tomcat) with Internet connect

    Hi friends,
    Please tell me can I send email from my localhost (Tomcat) using Java when my computer is connected to Internet?
    I don't have any SMTP username or password or the like, as I found in some codes available in net.
    Please suggest and any simple code if possible.
    Please don't send me the link of JavaMail API to read.
    ---Sujoy

    Thank you for the link. Though I have not tested the provided code, I will test it.
    --Sujoy                                                                                                                                                                                       

  • Can i generate certificates using java api

    can i generate certificates signed by my private key using java API.
    I found cetificatFactory must generate a certificate from a file,
    but how can i generate this file?
    Thanks

    visit :
    http://java.sun.com/j2se/1.3/docs/tooldocs/win32/jarsigner.html
    http://java.sun.com/j2se/1.3/docs/tooldocs/win32/keytool.html
    u can create ur own certificate
    Edward

  • How can I change from useing an english keyboard to a French one

    how can I change from english to french

    Take your stylus and tap and hold on the analog clock and you will get a drop down list with two choices analog or digital. Choose digital.
    Post relates to: Centro (Sprint)

  • How can I change language used by Apple to send account reset to me?

    HHow can I change language on password reset post by apple

    The Google translation app should be able to handle it. I'm going to ask the hosts to move your post to the iPad Forum in case other people have ideas.
    https://itunes.apple.com/us/app/google-translate/id414706506?mt=8

  • How can i change font used by the java plugin?

    im running j2se 1.4.0 on win2k, and the java plugin is using a font that is not readable because sized way too small (also, the font is not a 'standard' font).
    the font is also applied do class loading or exception messages in java applets (in IE5.5, but i don't think that this is browser-related).
    is there a possibility to change to font (or the font size)?

    thanks for the tip, but this problem seems not to be tightened to the font.properties file:
    the wrong font is only used with the j2sdk1.4.0 plugin, not with that from j2re1.4.0 (actually, i had installed jre first, and afterwards j2sdk without removing j2re before). changing the plugin used back to j2re made the java console display the correct font (though the font.properties files were identically in both cases).

  • How can I change cursor format in xy graph (LabVIEW 6.1)

    I created a XY Graph where the format on the X-axis can be either the number of the data record or the Date/Time at which it was collected (selectable by the user).
    Now I can set the format of the X-scale (0 or 7 respectively) but the cursor format will not change, i.e. it will show a large decimal number and no Date/Time if X-scale is switched to Date/Time format via 7.
    Any ideas how to achieve it?
    I also tried using 2 cursors but apparently both have to have the same format, i.e. one cannot be decimal while the other is Date/Time.
    Thanks in advance,
    Juergen

    Ah, you have to go in that way. I was looking for something under the Cursors property for the control. Though, I can see why it's not there. Thise are all parameters that you can individually set for each cursor.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Maybe you are looking for

  • Reader icons for PDF saved on Desktop are not displayed

    Hello, I have Windows 7 Ultimate 64 bit installed on my computer. Whereas Adobe Reader typical icons are correctly displayed in every PDF documents saved on my hard disk, they are not displayed on those saved on Desktop. A blank icon is displayed ins

  • Transvalue in XL Reporter

    Hi all, I am designing a XL Reporter template in which have some data of transaction value of inventory in the date range. I got a trouble to split OINM.transvalue into Receipt Transaction Value and Issue Transaction Value. Item     Openning (Value) 

  • How to retrieve information from entity beans?

    Hi all! I have a problem while trying to get information from entity beans. Here it goes: There are two entity beans with 1:N relationship between them. A FacadeSB is used to find a single record in one entity bean, using the findbyPrimaryKey method.

  • How can I close a document without saving changes?

    I'm using Pages 4.3 with OS10.9.1. Before I upgraded to OS10.9.1, when I closed a document (Command W) it asked me first if I want to save the changes I'd made to the document. I had the option of saving or not saving. Sometimes I want to close a doc

  • Adobe Reader CPU Usage

    Hello All, The problem i'm having is that "acroread" process after being open for some time (many hours or even days) starts to use all the CPU without anyone touch the application. This causes lots of trouble because i'm using all the time simulatio