jeditorpane

broken img tag with JEditorPane / ListCellRenderer

I have this code in a ListCellRenderer which extends JEditorPane. The editor pane doesn't show the image, but instead shows a 'broken icon'. What's wrong with it? public class TweetCellRenderer extends JEditorPane implements ListCellRenderer { public Component getListCellRendererComponent( javax.swing.JList list, Ob...

Problem with JEditor Pane while resizing the frame

Hi , i am new to java GUI programming. i am adding a JEditor pane (with HTML text ) inside a JScrollPane and added the scroll pane to a JFrame.The problem is when i re size the frame the JEditor pane vanishes. Any one help me ? Hi All , Following is the code : here another problem is i set weightx and weighty for the pane .But still ...

JEditorPane can't take Google search queries, why?

Hi, I am creating a very basic web browser using JEditorPane just to teach myself Swing and GUIs in Java but am having trouble implementing a Firefox-like Google Search bar. I'm not if it's due to a limitation of JEditorPane or my lack of understanding but if I try and take the string typed into the "Google Search" bar and use the setP...

Java Swing JEditorPane: manipulating styled documents

I have model that is a queue of Strings associated with enum types. I'm trying to display that model in a JEditorPane, with each element in the queue as a separate HTML paragraph that has attributes based based on the associated enum type. However, my updating methods are not doing what I want. I tried writing the HTML strings directl...

The line-height css property does not work in a JEditorPane. Can anyone help?

When I place the following html in a JEditorPane, the line-height attr is not obeyed (the font and color ones are though). Does anyone know what I am doing wrong? I checked the html in firefox and it's fine. <html> <head> <style type="text/css"> p { color:#222222; line-height: 200%; font-family:Tah...

Controlling the preferred size of a JEditorPane with long text

I have a JEditorPane which is displayed inside a popup, triggered through a button. The pane contains long text, therefore it's nested inside a JScrollPane, and the popup is constrained to a maximal size of 300 x 100: public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override publi...

How to use Netbeans platform syntax highlight with JEditorPane?

There are many tutorials online giving very complex or non-working examples on this. It seems that people recommend others to use the syntax highlighters offered by netbeans but I am totally puzzled on how to do so! I have checked many many sites on this and the best I can find is : http://www.antonioshome.net/kitchen/netbeans/nbms-sta...

Styling HTML in a JEditorPane or JTextPane

I want to display HTML in a JEditorPane or JTextPane, but I want the style (font size) to come from the Look and Feel. Is there a way to do this, or do you have to use embedded HTML styling? Here is an example: epText = new JEditorPane("text/html", content); StyleSheet ss = ((HTMLEditorKit)epText.getEditorKit()).getStyleSheet(); ss.a...

JEditorPane scrolling to the current caret position

I have a JEditorPane which I use to display an HTML document. the document has hyperlinks embedded in it. When a user clicks on a bookmark a position the caret to the associated place in the JeditorPane. The JeditorPane is then suppose to scroll to this position. This works mostly. But, I noticed that if the document has a lot ...

Setting the a caret in an JEditor Pane causes an exception.

I have a JeditorPane which has some text in HTML format. When I execute the following command int len = editorPane.getText().length(); The value for len is 7473. But then I try to do the following: editorPane.setCaretPosition(4995); And I get the following exception: java.lang.IllegalArgumentException: bad position: 4995 My un...

Regular Expression, JEditorPane, Self-closing tags

I'm am using JEditorPane to render basic HTML. But it renders self-closing tags incorrectly, specifically br tags, e.g. <br /> is bad but <br> is good. I would like to use String.replaceAll(regex, "<br>") to fix the HTML, where regex is a regular expression matching any self-closing br tag with case-insensitivity and zero to infinity n...

Java JEditorPane

ChatGUI im using 2 JEditorPane to transfer text from one to another. once i have transfered the data i do the following: JEditorPane.setText(null); JEditorPane.setCaretPosition(0); but as you can see from the attached image the return action makes the prompt appear a row down. how can i fix this? EDIT: does the following seem corr...

Java JEditorPane Format

im trying to implement a Chat feature in my application. i have used 2 JEditorPane. one for holding chat history and the other for sending chat to the previous JEditorPane. the JEditorPane is text/html type. the problem i am having is when i put more than one space between characters it is automatically removed by the parser because it...

Selecting specified text in an HTML formatted JEditorPane

I am displaying text in a Java JEditorPane using HTML to fomrat the text. I am also designing a search function that finds text in the JEditorPane selects the text and then scrolls to it. My problem is creating an algorithim that will actually specify the beginning and ending position for the selection. If I simply retrieve the t...

JEditorPane is discarding empty elements

The following test fails with JRE 1.6.0_20 public void testSetGetTextWithList() throws Exception { final JEditorPane editorPane = new JEditorPane(); editorPane.setContentType("text/html"); editorPane.setText("<ul><li></li></ul>"); assertTrue(editorPane.getText().contains("<ul")); } Of course, there is a visual differen...

Inconsistent working scrollbar

I have a JEditorPane contained in a JScrollPane. The vertical scrollbar policy is set to Always. But, the scrollbar doesn't always function. The lane or the channel of the scrollbar is present but there is not elevator sometimes. Here is the weird thing. It, depends on what was previously in the editor pane. If the previous te...

Can a user-chosen image be inserted directly into a JEditorPane?

What I am trying to do is open up a JFilechooser that filters jpeg,gif and png images, then gets the user's selection and inserts it into the JEditorPane. Can this be done? or am i attempting something impossible? Here is a sample of my program.(insert is a JMenuItem and mainText is a JEditorPane) insert.addActionListener(new ActionList...

Move the position in JEditorPane

Hi, I've a JEditorPane inside a JDialog. I'm loading a web page when this JDialog is loading. This web page is larger then the JEditorPane size. So I want to display a certain position in the web page by default. For example, I've a 175x200 size jdialog and JEditorPane. I want to display the web page content around 150 pixels down. Is...

[Java] Creating a left-hand margin for a JEditorPane text box

Edit - in short, what I'm looking for is a reliable way to add a left margin to a JEditorPane (read on for the issues I'm having if you'd like). I am trying to style some text in a JEditorPane, and have been fairly successful. The only problem I'm facing is that it seems impossible to create a margin. Basically, I've extended PlainVi...

jeditorpane caret location and string location not in sync

I'm trying to fix a bug in this code that was made for windows but dosent work in linux( I didn't write the code), the location of the caret and the typing location is not in sync. the dot and Mark location are the same and the setMagicCaretPosition dosent work the way I think, any help?(what properties should I monitor) this program ha...