WYSIWYG text editor in Java [closed]

你说的曾经没有我的故事 提交于 2019-11-27 06:16:19

RSyntaxTextArea

I've used this component and it works well. It is LGPL and it is based on javax.swing.text package (javax.swing.text.EditorKit). Since it is a Swing component it can be integrated in your application in a few lines of code :

RSyntaxTextArea textArea = new RSyntaxTextArea();
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
RTextScrollPane sp = new RTextScrollPane(textArea);
Horcrux7

JWebEngine

I recommend JWebEngine. It is the only one that I know that passes the ACID1 browser test and the mail-acid test. Most other Java HTML editors are based on the javax.swing.text.html.HTMLDocument and have all the same bugs. The support of CSS is very poor with HTMLDocument. JWebEngine has very good support for viewing HTML with CSS.

  • Link to the website. There are also online samples.
  • Commercial license
  • It is very simple to extend. The vendor is using it for many different things like editor, HTML printing engine, showing custom placeholders, etc. There is no problem with the visibility of classes like with the Sun HTMDocument.
  • It based on javax.swing.text.JEditorPane or javax.swing.text.JTextPane and you can use it together with third party tools like the spell checker JOrtho.
  • It is pure Java and runs on all platform with Java SE 5 or higher. It also run in non-signed applets.
Aaron Digulla

OpenOffice's Writer

Can be embedded in Java using the OOoBean. The original code runs under Swing but you can make it work under SWT, too, using the AWT/SWT Bridge (example code).

The project is open source (LGPL). The code is OS dependent but there are versions available for all major OSs (Windows, Linux, MacOS and Solaris are supported on the project's site but you can download the source and compile it for others, as well).

Since the underlying product is a full blown office application, it offers all the features you might want (fancy styles, online spell checking in different languages, embedding pictures, flow text around pictures, you name it).

The drawback is that you must have OpenOffice installed; in fact, the editor is not part of Java but it's a remote process which just renders in your Java app's window. This means that start up time is quite noticeable and performance can be sluggish. Also handling is sometimes "odd". It takes some configuration to get rid of additional borders and unwanted document pagination.

Because of this, the editor is not really extendable from Java. You will either have to write code in C++ or using OOo's own built-in language. What you can do is you can register listeners in the document and you have full access to the underlying model for the document. This way, you can hook into the important parts and modify the behavior but this often feels like performing keyhole surgery.

My conclusion: If OO has the features you need, this might be the most simple way to get what you need. If you need a lot of customization, you'll fight an upstream battle against the framework's defaults.

tiberiug

I needed the same thing for our application, did a research and found two more products EKit and Metaphase Editor, based on Charles Bell's HTMLDocumentEditor, both under LGPL license and looking good.

But I did not test them. These days we shall see what we choose.

jb.

Simply HTML

  • its GPLed
  • have no idea how easy it is to extend it
  • doesn't support spell checking, but has tables, lists.
  • Based on Swing, needs Java 1.4 and optionally Java Help
  • I didn't used it as a programmer - just as an end user, it has some quirks - like no multilevel list's or tables that are less than great but is OK.
  • Plus is it gives you HTML, so its is easy to embed results of processing into other components.
  • Now on SourceForge

docx4all

docx4all is a cross platform WYSIWYG editor for docx files, using Java Swing and JavaFX Script. Runs as an applet or application. See http://dev.plutext.org/trac/docx4all/wiki/FeatureSet

open source or commercial? See http://dev.plutext.org/forums/viewtopic.php?f=7&t=209

Requires Java 6.

  • Here's the link: JRichTextEditor
  • It's open source (LGPL).
  • You can do whatever you want with it. Just clone it from github. It is extensible.
  • It comes with quite some features, but enhancements are welcome. It's a swing component, depends on iText 2.1.7 (which is still LGPL) and other libraries (e.g. xerces). One notable feature is the possibility to add mark-points/ranges of any class. Which can be used for hyperlinks or whatever. In the library there's also a Help application.

Using an HTML WYSIWYG editor and the SWT browser component (see the snippets for examples). Options:

Pro:

  • Lots of options due to HTML
  • Supports HTML as the native format (so no unusual problems when you need to save the documents somewhere or modify them, unlike, say, the native Word format).
  • Working with fonts, colors, images is simple since you don't have to manage the resources yourself. The browser component will do it for you

Contra:

  • The solution is platform dependent. Tests with richhtml4eclipse showed a different behavior on Windows XP (IE) and Mac OSX (Safari)
  • If there is a problem, users will have to switch to the HTML code view and fix it themselves.
  • Good luck with content assist, code completion, spell checking, folding or annotations.
  • Adding special features will either force you to do keyhole surgery through the pretty simply API
  • With many of these editors, performance isn't that great, especially with large documents.
  • Depends on SWT.

Source: Lösungen für einen SWT Rich Text Editor

Have a look at JWord

  • It's commercial
  • Lots of features (tables, paging, H/F, columns layout, wmf, svg, copy-paste, RTF, ODT, HTML export)
  • royalty-free
  • pure Java-Swing (1.6)
  • extensible (based on Swing Text API)
Aaron Digulla

Rich Text Viewer

Pro:

  • Offers spell checking, code completion, undo/redo, auto indent, and most other features you'll expect (see here)

Contra:

  • Depends on SWT
  • No support for tables

The Eclipse project has resurrected Vex (Visual Editor for XML)

From the wiki page:

  • Vex leverages many of the mature plug-ins that make up the Eclipse Java IDE such as the CVS interface, document searching and bookmarking facilities, and searchable help system.
  • The Eclipse platform implements a sophisticated plug-in architecture, allowing Vex to be extended with third-party or custom, in-house plug-ins.
  • Vex is available with native look-and-feel for many platforms, including Windows, Linux/GTK, and Macintosh OS-X/Carbon.
  • Java developers using the Eclipse IDE can instal Vex into their IDE as a plug-in, making it easy to maintain software documentation or other XML files with Vex.
  • Vex is reusable: The Vex editor widget is available as a pure Java, cross-platform component with bindings SWT. Developers can re-use this widget, for example as an RCP application.

Version 1.0 has been released in 2012, an 1.1 is planned for 2013.

User guide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!