All Projects → FXMisc → Richtextfx

FXMisc / Richtextfx

Licence: bsd-2-clause
Rich-text area for JavaFX

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Richtextfx

Blobsaver
A cross-platform GUI app for saving SHSH blobs using tsschecker
Stars: ✭ 529 (-41.35%)
Mutual labels:  javafx
Jfoenix
JavaFX Material Design Library
Stars: ✭ 5,720 (+534.15%)
Mutual labels:  javafx
Uncolored
(Un)colored — Next generation desktop rich content editor that saves documents with themes. HTML & Markdown compatible. For Windows, OS X & Linux. — http://n457.github.io/Uncolored/
Stars: ✭ 733 (-18.74%)
Mutual labels:  rich-text-editor
Vue Froala Wysiwyg
Vue component for Froala WYSIWYG HTML Rich Text Editor.
Stars: ✭ 553 (-38.69%)
Mutual labels:  rich-text-editor
Ckeditor4
The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
Stars: ✭ 5,502 (+509.98%)
Mutual labels:  rich-text-editor
Prettyzoo
😉 Pretty nice Zookeeper GUI, Support Win / Mac / Linux Platform
Stars: ✭ 671 (-25.61%)
Mutual labels:  javafx
Azteceditor Android
A reusable native Android rich text editor component.
Stars: ✭ 518 (-42.57%)
Mutual labels:  rich-text-editor
P2p
Practice project to demonstrate p2p file sharing.
Stars: ✭ 16 (-98.23%)
Mutual labels:  javafx
Cljfx
Declarative, functional and extensible wrapper of JavaFX inspired by better parts of react and re-frame
Stars: ✭ 624 (-30.82%)
Mutual labels:  javafx
Testfx
Simple and clean testing for JavaFX.
Stars: ✭ 699 (-22.51%)
Mutual labels:  javafx
Scalafx
ScalaFX simplifies creation of JavaFX-based user interfaces in Scala
Stars: ✭ 555 (-38.47%)
Mutual labels:  javafx
Android Rich Text Editor
Android Rich Text Editor With customized spans - 富文本编辑器 - Don't miss this one :)
Stars: ✭ 587 (-34.92%)
Mutual labels:  rich-text-editor
Proton
Purely native and extensible rich text editor for iOS and macOS Catalyst apps
Stars: ✭ 685 (-24.06%)
Mutual labels:  rich-text-editor
Simditor
An Easy and Fast WYSIWYG Editor
Stars: ✭ 4,926 (+446.12%)
Mutual labels:  rich-text-editor
Javafx Maven Plugin
Maven plugin for JavaFX
Stars: ✭ 764 (-15.3%)
Mutual labels:  javafx
Wysiwyg.js
wysiwyg contenteditable editor (minified+compression: 6kb)
Stars: ✭ 520 (-42.35%)
Mutual labels:  rich-text-editor
Jfreechart
A 2D chart library for Java applications (JavaFX, Swing or server-side).
Stars: ✭ 665 (-26.27%)
Mutual labels:  javafx
Controlsfx
High quality UI controls to complement the core JavaFX distribution
Stars: ✭ 887 (-1.66%)
Mutual labels:  javafx
Everest
A beautiful, cross-platform REST client.
Stars: ✭ 785 (-12.97%)
Mutual labels:  javafx
Angular Froala Wysiwyg
Angular 4, 5, 6, 7, 8 and 9 plugin for Froala WYSIWYG HTML Rich Text Editor.
Stars: ✭ 696 (-22.84%)
Mutual labels:  rich-text-editor

RichTextFX

RichTextFX provides a memory-efficient text area for JavaFX that allows the developer to style ranges of text, display custom objects in-line (no more HTMLEditor), and override the default behavior only where necessary without overriding any other part of the behavior.

It does not follow the MVC paradigm as this prevented access to view-specific API (e.g., getting the bounds of the caret/selection/characters, scrolling by some amount, etc.).

It is intended as a base for rich-text editors and code editors with syntax highlighting. Since it is a base, a number of suggested features (specific syntax highlighters, search-and-replace, specific support for hyperlinks, etc.) will not be implemented directly in this project. Rather, developers can implement these on top of RichTextFX and submit their work as a PR to the richtextfx-demos package.

For a greater explanation of RichTextFX, its design principles, how it works, and how to style its areas via CSS, please see the wiki

Demos

Stand-alone Applications that demonstrate some of the features of RichTextFX have been moved to their own folder here

Table of Contents

Who uses RichTextFX?

If you use RichTextFX in an interesting project, I would like to know!

Features

  • Assign arbitrary styles to arbitrary ranges of text. A style can be an object, a CSS string, or a style class string.
  • Display line numbers or, more generally, any graphic in front of each paragraph. Can be used to show breakpoint toggles on each line of code.
  • Support for displaying other Nodes in-line
  • Positioning a popup window relative to the caret or selection. Useful e.g. to position an autocompletion box.
  • Getting the character index under the mouse when the mouse stays still over the text for a specified period of time. Useful for displaying tooltips depending on the word under the mouse.
  • Overriding the default behavior only where necessary without overriding any other part.

Flavors

The following explains the different rich text area classes. The first one is the base class from which all others extend: it needs further customization before it can be used but provides all aspects of the project's features. The later ones extend this base class in various ways to provide out-of-box functionality for specific use cases. Most will use one of these subclasses.

GenericStyledArea

GenericStyledArea allows one to inline custom objects into the area alongside of text. As such, it uses generics and functional programming to accomplish this task in a completely type-safe way.

It has three parameter types:

  • PS, the paragraph style. This can be used for text alignment or setting the background color for the entire paragraph. A paragraph is either one line when text wrap is off or a long text displayed over multiple lines in a narrow viewport when text wrap is on,
  • SEG, the segment object. This specifies what immutable object to store in the model part of the area: text, hyperlinks, images, emojis, or any combination thereof.
  • S, the segment style. This can be used for text and object styling. Usually, this will be a CSS style or CSS style class.

Functional programming via lambdas specify how to apply styles, how to create a Node for a given segment, and how to operate on a given segment (e.g., getting its length, combining it with another segment, etc.).

GenericStyledArea is used in the Rich-text demo.

See the wiki for a basic pattern that one must follow to implement custom objects correctly.

StyledTextArea

StyledTextArea<PS, S>, or one of its subclasses below, is the area you will most likely use if you don't need to display custom objects in your area.

It extends GenericStyledArea<PS, StyledText<S>, S>>. StyledText is simply a text (String) and a style object (S). A slightly-enhanced JavaFX Text node is used to display the StyledText<S>, so you can style it using its CSS properties and additional RichTextFX-specific CSS (see the wiki for more details).

It properly handles the aforementioned functional programming to properly display and operate on StyledText<S> objects.

The style object (S) can either be a CSS String (-fx-fill: red;), a CSS styleclass (.red { -fx-fill: red; }), or an object that handles this in a different way. Since most will use either the CSS String or CSS style class approach, there are two subclasses that already handle this correctly.

InlineCssTextArea

InlineCssTextArea uses the Node#setStyle(String cssStyle) method to style Text objects:

area.setStyle(from, to, "-fx-font-weight: bold;");

StyleClassedTextArea

StyleClassedTextArea uses the Node#setStyleClass(String styleClass) method to styleText` objects. You can define the style classes in your stylesheet.

example.css:

.red { -fx-fill: red; }

Example.java:

area.setStyleClass(from, to, "red");

This renders the text in the range [from, to) in red.

CodeArea

CodeArea is a variant of StyleClassedTextArea that uses a fixed width font by default, making it a convenient base for source code editors. CodeArea is used in the Java Keywords demo.

Requirements

JDK8 is required, because TextFlow, introduced in JavaFX 8.0, is used to render each line. Also, there's a heavy use of lambdas, defender methods and the stream API in the code base.

Download

Stable release

Current stable release is 0.10.6 which is a multi-release JAR that is compatible with Java 9 and UP without the need for add-exports or add-opens JVM arguments.

Maven coordinates

Group ID Artifact ID Version
org.fxmisc.richtext richtextfx 0.10.6

Gradle example

dependencies {
    compile group: 'org.fxmisc.richtext', name: 'richtextfx', version: '0.10.6'
}

Sbt example

libraryDependencies += "org.fxmisc.richtext" % "richtextfx" % "0.10.6"

Manual download

Download the JAR file or the fat JAR file (including dependencies) and place it on your classpath.

Snapshot releases

Snapshot releases are deployed to Sonatype snapshot repository.

Maven coordinates

Group ID Artifact ID Version
org.fxmisc.richtext richtextfx 1.0.0-SNAPSHOT

Gradle example

repositories {
    maven {
        url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
}

dependencies {
    compile group: 'org.fxmisc.richtext', name: 'richtextfx', version: '1.0.0-SNAPSHOT'
}

Sbt example

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

libraryDependencies += "org.fxmisc.richtext" % "richtextfx" % "1.0.0-SNAPSHOT"

License

Dual-licensed under BSD 2-Clause License and GPLv2 with the Classpath Exception.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].