Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: A very peculiar error I just cant fix

  1. #1
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default A very peculiar error I just cant fix

    Hi.

    I have a JList with a custom ListModel and a custom TransferHandler for Drag&Drop support.
    Everything works fine, until I try to drop an item at the very last position in the list. If I do this I get an exception which notably does not use any of my own classes but only the default classes:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    	at javax.swing.plaf.basic.BasicListUI.getDropLineRect(Unknown Source)
    	at javax.swing.plaf.basic.BasicListUI.access$1300(Unknown Source)
    	at javax.swing.plaf.basic.BasicListUI$Handler.repaintDropLocation(Unknown Source)
    	at javax.swing.plaf.basic.BasicListUI$Handler.propertyChange(Unknown Source)
    	at java.beans.PropertyChangeSupport.fire(Unknown Source)
    	at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
    	at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
    	at java.awt.Component.firePropertyChange(Unknown Source)
    	at javax.swing.JList.setDropLocation(Unknown Source)
    	at javax.swing.TransferHandler$DropHandler.setComponentDropLocation(Unknown Source)
    	at javax.swing.TransferHandler$DropHandler.cleanup(Unknown Source)
    	at javax.swing.TransferHandler$DropHandler.drop(Unknown Source)
    	at java.awt.dnd.DropTarget.drop(Unknown Source)
    	at javax.swing.TransferHandler$SwingDropTarget.drop(Unknown Source)
    	at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(Unknown Source)
    	at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(Unknown Source)
    	at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(Unknown Source)
    	at sun.awt.dnd.SunDropTargetEvent.dispatch(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processDropTargetEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$400(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)

    Non of the methods of my TransferHandler are ever called (I added debug messages). This happens before canImport or ImportData.
    It looks like it has something to do with the painting of the Drag&Drop cursor rect, but I have no idea how I have any input on that.

    Thanks in advance, if anybody has any idea what I should do, I would really appreciate the help.


    Edit: I am just an idiot. Please close this.
    I was looking at the wrong classes all the time during debugging. It was a simple obvious error with the indices.
    Last edited by Cornix; August 28th, 2014 at 01:54 PM.


Similar Threads

  1. [SOLVED] Im new to Java and have an error i cannot fix please help
    By blockmaster2001 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 6th, 2014, 06:39 PM
  2. can anyone help me to fix the error in the program???
    By divi in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 24th, 2013, 02:49 PM
  3. Cant fix this error... Help!
    By Hypermegazord in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 1st, 2012, 01:06 PM
  4. Need Help, Not sure how to fix basic error!
    By ChicoTheMan94 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 15th, 2012, 01:41 PM
  5. Simply error; can't quite fix it.
    By JRabbit in forum Android Development
    Replies: 1
    Last Post: March 19th, 2012, 06:46 PM