jeditorpane

JEditorPane with Javascript and CSS support

空扰寡人 提交于 2019-11-27 14:47:48
I am working on Swing using JEditorPane but it's not supporting the Javascript or some advanced tag like <object> 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 being displayed in normal HTML browser? current Java6/7 supporting only (upto) Html 3.2 with reduced support for css , for Html5 and quite full css support to use JavaFx Components , there are custom Java libraries with (full???) support of Html4/5, css and js but I'd be suggest to use JavaFX instead David Kroukamp +1 to mKorbel. Use JavaFX WebView

Is it possible/how to embed and access HTML Files in a JAR?

五迷三道 提交于 2019-11-27 05:37:05
i am somewhat blocked right now: i wrote a quite complex Java Desktop App (no Applet/Web App!) which has it's own "user Manual". This manual consists of some HTML and JPG files. This manual is displayed in the "Help Menu" within my application using a JEditorPane. So far so good. This works very well as long as i launch the Programm with Eclipse. As soon as i create the deploy Version as a runable jar (which gets wrapped into an .exe with launch4j) the HTML "Viewer" is unable to display the user manual (the Images are missing). I do understand why this is happening, but i have no idea on how

JEditorPane with inline image

醉酒当歌 提交于 2019-11-27 05:25:57
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 class InlineImage { public InlineImage() { JFrame frame=new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JEditorPane edit=new JEditorPane(); frame.getContentPane().add(edit); edit.setContentType("text/html"); String html = "<html><body>Local image<br><img src=\"data:image/png;charset=utf-8;base64

Highlight a word in JEditorPane

自古美人都是妖i 提交于 2019-11-27 02:13:14
I have to highlight the all occurrences of a word in JEditorPane . For this I am using the following code: try { javax.swing.text.DefaultHighlighter.DefaultHighlightPainter highlightPainter = new javax.swing.text.DefaultHighlighter.DefaultHighlightPainter(Color.YELLOW); textPane.getHighlighter().addHighlight(startPos, endPos, highlightPainter); } catch(Exception ex) { } But how can I give the position of index of a word? I am reading the content from file but it is reading the HTML tags also and it is disturbing the index of words. Basically, you should be able to walk the document looking for

Highlighting few of the words of a text file opened in a frame

家住魔仙堡 提交于 2019-11-26 21:55:37
问题 I am opening a file in a frame and I wish to highlight few of the words.As I understand,I need to traverse the content of the file. How do I traverse through the contents and what is the related property that I may use for the purpose of highlighting? UPDATE : MY CODE GOES SOMETHING LIKE THIS private JEditorPane editorpane; JScrollPane editorScrollPane; public TextEditor() { editorpane = new JEditorPane(); editorpane.setEditable(false); if (filename != null) { try { File file = new File

JEditorPane set foreground color for different words

放肆的年华 提交于 2019-11-26 18:39:54
问题 I am currently working on a text editor, and I have this code which make the background of the specific word different from the others, but I want the foreground to edit color and not the background. Here's the code I have: import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JTextPane; import javax.swing.text

Clickable HTML link in JEditorPane using replaceSelection method

血红的双手。 提交于 2019-11-26 18:38:02
问题 I searched how to make clickable links in JEditorPane , and I found this question: Is it possible to create programs in Java that create text to link in Chrome? It was very useful, but my code uses a repetition statement to add links in a loop: JEditorPane jep = new JEditorPane(); jep.setContentType("text/html"); jep.setEditable(true);// Because replaceSelection can't work with disabled edit for ( int i = 1; i <= 3; i++ ){ jep.replaceSelection( "Welcome to <a href='https://stackoverflow.com/'

Java JScrollBar Design

你。 提交于 2019-11-26 17:24:43
问题 I want customize the JScrollBar Design. I use Mac to develop the app with eclipse. I already tried to scrollPane.getVerticalScrollBar().setBackground(Color.BLACK); but nothing happen. My code: scrollPane = new JScrollPane(scriptView); scrollPane.setBorder(BorderFactory.createEmptyBorder()); scrollPane.getVerticalScrollBar().setUnitIncrement(6); window.getContentPane().add(scrollPane); The Object scriptView is from the class JEditorPane . How it should look: Thanks for every help. 回答1: I guess

JEditorPane with Javascript and CSS support

孤人 提交于 2019-11-26 16:56:36
问题 I am working on Swing using JEditorPane but it's not supporting the Javascript or some advanced tag like <object> 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 being displayed in normal HTML browser? 回答1: current Java6/7 supporting only (upto) Html 3.2 with reduced support for css , for Html5 and quite full css support to use JavaFx Components , there are custom Java libraries with (full???) support of

Is it possible/how to embed and access HTML Files in a JAR?

非 Y 不嫁゛ 提交于 2019-11-26 11:36:10
问题 i am somewhat blocked right now: i wrote a quite complex Java Desktop App (no Applet/Web App!) which has it\'s own \"user Manual\". This manual consists of some HTML and JPG files. This manual is displayed in the \"Help Menu\" within my application using a JEditorPane. So far so good. This works very well as long as i launch the Programm with Eclipse. As soon as i create the deploy Version as a runable jar (which gets wrapped into an .exe with launch4j) the HTML \"Viewer\" is unable to