Drag/dropping entities into a JTextPane


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Drag/dropping entities into a JTextPane

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Posts
    150

    Drag/dropping entities into a JTextPane

    Hello Devx.

    At the moment I need to be able to have a text pane represent a report. The report will need to store entities, so I will need to use icons, labels, or something to represent them in the report. My goal in doing this is representing "entities" inside a report, and not allowing the user to fudge with them.

    I.e., here is what I don't want to happen. Let's say my entities look like [Lewis, Jerry 234324234]. I will need to parse those out later, and I don't want the user to be able to "simulate" them by typing in brackets, a name, and a number for example; and thereby break my parsing scheme.

    My current solution is to drag and drop JLabels into the text pane and use them to represent entities. The solution still seems somewhat crude to me. They do have the advantage of not being fabricated by a user, and if you back space over them the entire thing disappears which is necessary when dealing with entities.

    But there has got to be a better way. I haven't used JEditorPanes much. My only other idea is inserting some kind of atomic HTML tag that is not reproducible by the user.

    I need a way to represent entities atomically in a JTextPane, so they can be parsed out later.

    Any ideas?

  2. #2
    Join Date
    Sep 2004
    Posts
    150
    I think I've figured it out.

    I'm going to use a JEditorPane that renders HTML, and insert tags that hold metadata. That should work, and be easy to parse later on.

Similar Threads

  1. A Simple jTextPane Problem
    By mmmisa83 in forum Java
    Replies: 0
    Last Post: 09-26-2006, 05:12 AM
  2. Changing the way JTextPane renders HTML
    By Gengar003 in forum Java
    Replies: 1
    Last Post: 05-14-2006, 12:14 AM
  3. JTextPane Visualization Problem!
    By sabbir in forum Java
    Replies: 1
    Last Post: 10-20-2005, 11:33 AM
  4. JTextPane refresh problem under jdk 1.1.8 swing 1.1.1
    By François Bélair in forum Java
    Replies: 0
    Last Post: 08-26-2000, 03:19 PM
  5. Print styled text from a JTextPane
    By Christian Calloway in forum Java
    Replies: 0
    Last Post: 06-19-2000, 12:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center