Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 143387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:05:14+00:00 2026-05-11T08:05:14+00:00

I have a swing client that renders HTML through the use of the JEditorPane

  • 0

I have a swing client that renders HTML through the use of the JEditorPane and HTMLDocument classes.

The problem I have is that I want to be able to define an area of the document as a container for some text that will be retrieved at a later date, and then use document.setInnerHTML(element, data); to swap out the place-holder content with the ‘real’ content.

So, I decided that I would define a tag similar to this:

<html> <body> some text <mytag id='1>placeholder</mytag> some more text </body> </html> 

The problem occurs when I use document.getElement(String id) – it finds mytag as an element, but it thinks it’s a leaf element that has no content and so I cannot call .setInner() on it. Looking at it’s parents list of elements, it thinks there are 3 – my tag has just been interpreted as individual components:

mytag (start)
content
mytag (end)

So, I’m guessing that I need to tell the document (or it’s parser) about my tag, but that’s where I’m falling flat as I’m fairly new to this area.

So, has anyone had any experience with this at all? I could cheat and use a span tag, but that doesn’t feel right as (excluded for brevity) I also need to store an additional attribute against the tag.

Thanks in advance for your time…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:05:15+00:00Added an answer on May 11, 2026 at 8:05 am

    It looks like you need to override the HTMLDocument to return a reader that recognises the custom tags. See HTMLDocument#getReader for more information. You’ll need to return a subclass of HTMLReader which understands the custom tag (via the registerTag method).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java Swing application client that I want to use to consume
We have a client side application (Java/Swing) that we need an HTML rendering control
I want to develop a Swing client application that will use a Java EE
I am creating a client side swing app that will have data provided by/from
We have a Java/Swing client that's been around for quite a few years. When
I have this swing client-server app. I want to simulate the ' Ctrl+Shift+f1 '
I have developed a java swing client-server application. The server has many services like
Background: I have written a java swing based client server application. The server is
We have a desktop client application developed in Swing. This application interacts with backend
I have a Swing application that connect directly to MySql Database for user authentication.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.