Content « JTextPane « Java Swing Q&A





1. How to output JTextPane styled contents to HTML, including custom style?    stackoverflow.com

I currently use a JTextPane to allow users to add/edit text. It allows bold/italic/underline (and I plan to allow links in the future). It also allows users to drop buttons in, ...

2. Create images of a JTextPane's content    coderanch.com

import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import java.io.*; import javax.swing.*; public class TextPic extends JPanel { JTextArea textArea = new JTextArea(); private void save() { Rectangle r = getSelectionRect(); int w = r.width; int h = r.height; int type = BufferedImage.TYPE_INT_RGB; BufferedImage image = new BufferedImage(w, h, type); Graphics2D g2 = image.createGraphics(); // Translate g2 to clipping rectangle of textArea. g2.translate(-r.x, ...

3. LineNumber JTextPane html Content    java-forums.org

Hallo, I want to print the line numbers out. My Problem is: When I set the ContentType to ("text/html") of my JTextPane the prog shows the line numbers no more, but the number of the character in the JTextPane. How can I print the linenumber out in a JTextPane with the contenttype ("text/html") ?? Thanks for your help -> my code ...