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 8126745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:15:40+00:00 2026-06-06T07:15:40+00:00

I started using NetBeans today, and it was all going swimmingly, until I came

  • 0

I started using NetBeans today, and it was all going swimmingly, until I came upon this block.

I’m trying to make my jTextPane format any HTML i have in it. I’ve tried changing the Content type in the code with jTextPane1.setContentType("text/html"); but to no avail.
I’ve also tried changing the properties in the Design Window to relevant values, but no luck there either.

After some googling, I saw that Netbeans had a bug before that wouldn’t let text/html content be enabled properly, but it has been resolved a couple versions back.

Have any ideas how i can enable html in the panes? or even just another way to get hyperlinks working.

  • 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. Editorial Team
    Editorial Team
    2026-06-06T07:15:41+00:00Added an answer on June 6, 2026 at 7:15 am

    i use a JEditorPane for exact the same pupose.
    Just set the ContentType to “text/html” as you allready do and you are good to go.

    To include some predefined stylesheets i use this code:

    editorPane.setContentType("text/html");
    HTMLEditorKit kit = new HTMLEditorKit();
    editorPane.setEditorKit(kit);
    File cssfile = new File("src/Assets/code.css");
    
    StyleSheet styleSheet = kit.getStyleSheet();
    styleSheet.importStyleSheet(cssfile.toURI().toURL());
    
    editorPane.setText("<html><head></head><body><pre></pre></body></html>");
    

    You can use setEditable(false) so the HTML cant be changed.

    Just tryed it with Netbeans 7.2 beta and it works the same way with an JTextPane.

    Here is some more Docu about it:
    http://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html#recap

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

Sidebar

Related Questions

greetings, today i have started to learn java using netbeans ide. i would like
I have recently started using Netbeans with following stack Liferay, icefaces with jBoss. Is
I just started using Netbeans to debug PHP apps, but when I inspect any
I have just started with Gui Programming in netbeans (Using the template Java Desktop
I've recently started using NetBeans, coming from Eclipse. I have a simple implementation of
I just started using nbandroid plugin with Netbeans 7.0.1 (and 7.1). I could compile
I'm a fairly experienced Java user, but I've just started trying to use NetBeans
Since I've started using NetBeans, I've learned of some powerful ways to abstract away
Please bear with me as I've just started using NetBeans for the first time!
I'm a Rails newbie, and I was initially using NetBeans + JRuby to make

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.