DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004

    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
    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, 04:12 AM
  2. Changing the way JTextPane renders HTML
    By Gengar003 in forum Java
    Replies: 1
    Last Post: 05-13-2006, 11:14 PM
  3. JTextPane Visualization Problem!
    By sabbir in forum Java
    Replies: 1
    Last Post: 10-20-2005, 10: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, 02:19 PM
  5. Print styled text from a JTextPane
    By Christian Calloway in forum Java
    Replies: 0
    Last Post: 06-19-2000, 11:27 AM

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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

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

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.