Rich Text Display Component for Java - java

Is there any library which provide a text panel with basic formatting features.
Such as line numbering, Keyword coloring and others.
I want to display a code inside my application window. I already try to use JTextPane. But it is easy if there exist are any UI Components that meets my requirements.
note : I want to display the code same as when it is open using notepad++ or any code editor.

I've used jsyntaxpane with some success.

Related

JavaFX Multiple colors in textarea (JavaFX 8)

I cannot find so much documentation in JavaFX.
And I will be happy to know how I can do this :
When I type a word in a textarea, fx "google" or "facebook". Can I so do like it can change color of google to fx green, and changes the font and stuff like that.
I will be happy to know how i can do this :).
No. JavaFX 8 does not support multiple colors for text in TextArea.
You could try Tomas Mikula's RichTextFX control and see if that works for you.
RichTextFX provides a text area for JavaFX with API to style ranges of text. It is intended as a base for rich-text editors and code editors with syntax highlighting.
The other options are:
To use a HTMLEditor OR
Embed one of the many HTML based text editors (e.g. CKEditor).
Adopt a markdown style editor, where the user just edits plain markup text in a standard TextArea and the styled text is shown in another pane (similar to how StackOverflow works).
Addressing additional coments
I found a place, there tell me that I can use TextFlow. So i will try this
TextFlow is a readonly control, not editable like a TextArea is. Creating an feature rich styleable text editor from scratch using only core JavaFX 8 components is a large and complicated task, which I would not advise most people to undertake. Instead, using or contributing to existing JavaFX editor solutions such as RichTextFX or other similar projects which may arise would likely yield better results and a more productive outcome.

Use all word functionalities in jsp

I want to create my jsp page which contains word like functionality where user can add text, save them, do track change function. change fonts and color. Is there any plugin or java script plugin available to implement this kind of functionality in project.?
you can use CKEditor for the same.
CKEditor will give you all the functionality like word file.
CKEditor.com
use tinyMCE (http://www.tinymce.com/)
to display word-like editor.
sample: http://www.tinymce.com/tryit/basic.php
Use tinymce which is a javascript plugin that does text wysiwyg editing

Writing simple RTF files in Java

I am using Java 6, Windows XP, Eclipce Java EE IDE Juno, Swing.
Im looking for the simplest solution without adding any new librarys.
To describe my question i will first start with describing my goal.
My idea is to print out in the following format:
Heading
subHeading
stuffs stuffs stuffs
stuffs stuffs stuffs
I would like to get to this goal by using RTF file format.
What i have concluded is that i should probably use JEditorPane and some how add line by line formated text into the editor.
After im done i would like to write the JEditorPane to file and save it.
So, that said. There are some questionmarks here i do not seem to figure out.
What "standard" class can i use to create RTF formated string lines?
Is JEditorPane the best container for a RTF document?
Thanks for your time!
The documentation has everything you need. (http://goo.gl/EJSpx)
Create javax.swing.text.rtf.RTFEditorKit by calling createEditorKitForContentType
Add newly created editorkit to JEditorPane by calling registerEditorKitForContentType (notice that support for RTF is limited)
Hope this put you on the right path.
See this thread as well Can anyone recommend a Java rich text editor?

Adding Swing Component to PDF File

Is there any method to add JTextbox, JButton, JLable in Pdf file through java coding using iText?
How can I add such component in pdf file? So that by using setLayout and setBounds method I can place them any where in my PDF file through java coding.
No you can't do this. Swing Components are Java Classes and can't be used inside PDF Files.
You can add a "copy" / screenshot image of the Swing component, but not the component itself.
You cannot use swing components in pdfs. However pdf allows to create fields in pdf with Acrobat Reader/Pro. If you want to do it programatically with java, so there is a tutorial with iText here.
You can do other way round.Open a pdf file using Swing components and add desired effects.Here is a link you can follow.

editing html/webpages in java

I want to create a java application that allows users to import a web page and be able to edit it within the program.
Importing a web page will render it and the components of the page (images, text, etc) will be editable or draggable, allowing the user to re-layout the components.
For example, the user can load a web page that has an image header, but decides to have it at the bottom of the page. They can simply click and drag the image down and the html will be reformatted appropriately. It is basically a WYSIWYG html editor...
Will this be a difficult task? I am stuck at how to parse the web page into draggable components and being able to export the html after all the edits.
From what I can see, I'd need wrapper classes for html components and a way to keep track of all the changing positions and objects, but I could be wrong. Are there any helpful tools for this task?
I think creating something from sctratch will be difficult. But you can use Eclipse Web Tools Platform (either just by installing it or by developing your own plugin/distribution based on that). It has a fairly good HTML Editor/Web Page Editor which has WYSIWYG features.
EDIT: Also this question has some tips: Java WYSIWYG HTML editor

Categories