Questions tagged [jeditorpane]

A Java Swing text component to edit various kinds of content.

A Java Swing text component to edit various kinds of content. By default, the following types of content are known:

  • text/plain: plain text, which is the default the type given isn't recognized. The kit used in this case is an extension of DefaultEditorKit that produces a wrapped plain text view
  • text/plain: Styled text, the kit used in this case is the class javax.swing.text.StyledEditorKit which provides text with formatting basement to be used in the next EditorKits.
  • text/html: HTML text, the kit used in this case is the class javax.swing.text.html.HTMLEditorKit which provides HTML 3.2 support. HTML content is not editable.
  • text/rtf: RTF text, the kit used in this case is the class javax.swing.text.rtf.RTFEditorKit which provides a limited support of the Rich Text Format.
515 questions
15
votes
5 answers

Setting default font in JEditorPane

editorPane.setContentType("text/html"); editorPane.setFont(new Font("Segoe UI", 0, 14)); editorPane.setText("Hello World"); This does not change the font of the text. I need to know how to set the default font for the JEditorPane with HTML…
Sanjeev
  • 367
  • 1
  • 8
  • 20
14
votes
3 answers

Making a JEditorPane with html put correctly formatted text in clipboard

I have this code to demonstrate the problem: public static void main(String[] args) { JFrame frame = new JFrame(); frame.getContentPane().add(new JEditorPane("text/html", "Hello cruel world
\nGoodbye cruel…
Steve McLeod
  • 49,211
  • 44
  • 120
  • 177
12
votes
2 answers

JEditorPane with Javascript and CSS support

I am working on Swing using JEditorPane but it's not supporting the Javascript or some advanced tag like etc. and not supporting the color, font style size etc. Is there any solution so that editor pane can display the HTML file as it is…
Adesh singh
  • 1,933
  • 9
  • 21
  • 35
11
votes
1 answer

Display and interact with an HTML form in a Swing application

an application generates some HTML pages that should be displayed in the application itself. These HTML pages contain some forms that would be used by the user to enter some values. So far I've used a JTextPane which renders the HTML perfectly, but…
Pragmateek
  • 12,648
  • 9
  • 66
  • 105
11
votes
2 answers

JEditorpane vs. JTextPane

i have to create a project in java swing for my college. An editor of java files with proper text highlighting i.e different colors and fonts for java keywords, java comments and for normal text. Help me to select one of two styled text component…
Sachin Kumar
  • 731
  • 1
  • 9
  • 24
10
votes
1 answer

JEditorPane with inline image

I'm attempting to display an inline image in a Java JEditorPane. The code below uses HTML content that properly displays the image in Firefox, but not in the JEditorPane. Any ideas why? Thanks. import javax.swing.*; import java.awt.*; public…
Mike
  • 103
  • 1
  • 4
10
votes
3 answers

How do you set the tab size in a JEditorPane?

A JTextArea's tab size can easily be set using setTabSize(int). Is there a similar way to do it with a JEditorPane? Right now, text with tabs in my pane looks like: if (stuff){ more stuff; } And, I'd prefer a much smaller tab stop: if…
jjnguy
  • 128,890
  • 51
  • 289
  • 321
10
votes
4 answers

Browser using JEditorPane forcing blue background

This is the code I'm using to display google in a JEditorPane String url="http://google.com"; editorPane.setEditable(false); try { editorPane.setPage(url); } catch (IOException e) {} But for some reason the background will…
Laurens
  • 2,474
  • 3
  • 26
  • 40
9
votes
1 answer

JEditorPane.getPreferredSize not always working in Java 9?

This question is about different behaviour of JEditorPane in Java 8 and Java 9. I’d like to know if others have experienced the same, whether it could be a bug in Java 9, and if possible have your input to how to handle it in Java 9. Context: In our…
Ole V.V.
  • 65,573
  • 11
  • 96
  • 117
9
votes
4 answers

jEditorPane as a web browser

I am creating a web browser in Java. In this browser I am using JEditorPane for Browser Window. I am using "setPage(String url)" method to display the page. The browser can display the page but there are some problems which are as…
Khoyendra Pande
  • 1,617
  • 3
  • 25
  • 41
9
votes
1 answer

JTextPane/JEditorPane and weird text issue

I am creating a simple chat program that I want to eventually show html links. My problem right now is that I can't get the text to appear next to the users name as I want it to. I want the user's name to be bold, and the text to appear right next…
mainstringargs
  • 11,482
  • 33
  • 101
  • 163
7
votes
5 answers

showing images on jeditorpane (java swing)

I have a JEditorPane created by this way: JEditorPane pane = new JEditorPane("text/html", "" + my_text_to_show + "" + ""); I put this pane on a JFrame. Text is shown correctly, but I can't see the…
Giancarlo
  • 4,122
  • 15
  • 49
  • 82
7
votes
1 answer

Insert HTML into the Body of an HTMLDocument

This seems like such a simple question, but I'm having such difficulty with it. Problem: I have some text to insert into an HTMLDocument. This text sometimes specifies some html as well. E.G.: Some
Random HTML I'm using…
Robbie
  • 802
  • 2
  • 7
  • 18
6
votes
1 answer

How to implement in JEditorPane on text changed

How to implement in JEditorPane on text changed method ( get text on every character added or deleted ) ?
Damir
  • 48,513
  • 89
  • 234
  • 352
6
votes
3 answers

Disabling scrolling to end of text in JEditorPane

Hi I used a JEditorPane with HTMLEditorKit to showing HTML text with ability to wrap text. The problem is when I set it's content using .setText method it automatically scrolls to the end of that text. How can I disable this? Thanks.
RYN
  • 13,462
  • 29
  • 105
  • 163
1
2 3
34 35