• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

ClassNotFoundException in TransferHandler

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, excuse my bad english

I asked a question yesterday about how to cut/copy/paste styled text in a JTextPane and nobody answered . I did some research myself and i found i need to write my own TransferHandler for a class to store the transfered data.

I made this class, which contains a simple String and a list of attributes for each of the elements which will be contained in the text.


I created a TransferHandler which uses this mime type, and tries to create a DataFlavor based on it. If the class cannot be found, a ClassNotFoundException is thrown.



As you can see, the classes are in the same package, I can't imagine why the class cannot be loaded.

java.lang.ClassNotFoundException: StyledString
at java.awt.datatransfer.DataFlavor.tryToLoadClass(Unknown Source)
at java.awt.datatransfer.DataFlavor.initialize(Unknown Source)
at java.awt.datatransfer.DataFlavor.<init>(Unknown Source)
at com.twip.editor.controller.StyleTransferHandler.<init>(StyleTransferHandler.java:36)
at com.twip.editor.controller.TextController.initUI(TextController.java:565)
at com.twip.editor.controller.TextController.<init>(TextController.java:73)
at com.twip.editor.controller.TextController$2.run(TextController.java:511)
at java.awt.event.InvocationEvent.dispatch(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)


 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The class name is not StyledString but com.twip.editor.controller.StyledString - including the full package name.
 
Steli Niculescu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It works! Thank you
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic