jtextpane

Does JTextPane support text memory paging?

血红的双手。 提交于 2019-12-02 00:38:55
问题 I'm trying to improve an existing implementation of document displaying component. One of the concerns expressed, that when loading a large bulk of text we will get an OOM exception. From my previous experience with .net I do know that some base component implement paging, hence no all the text is visual loaded into the document hence things not only work faster but we will also, hopefully, avoid an OOM exception. So I was wondering are there any base swing components, specifically JTextPanel

Java Default Highlighter

自古美人都是妖i 提交于 2019-12-01 23:55:38
Im using the DefaultHightlighter.DefaultHightlighterPainter to highlight text within a java text pane. I want to remove all highlights (there could be more than one string highlighted) and want it to return the locations of the strings where the highlight has been removed, so obviously I cant use pseudoCodeTextPane.getHighlighter().removeHighlight(highlight); Can anyone help? Thanks How about something like Highlighter.Highlight[] highlights = pseudoCodeTextPane.getHighlighter().getHighlights(); int[] startOffsets = new int[highlights.length]; int[] endOffsets = new int[highlights.length]; for

Changing color of selected text in jTextPane

冷暖自知 提交于 2019-12-01 22:57:10
I am creating a text editor using a JTextPane that allows the user to change the color of selected text. But when the user selects the text, then chooses the option to change the color (say, to red) the text does not appear as red until the text is unselected. I tried using setSelectedTextColor to change the color of the selected text, but that doesn't work since that changes the text to red anytime text is selected afterwards. Is there a way to have selected text show up as it's actual color? Or like the way it works in Word where it's not the actual color of the text, but when text of

Java JTextpane Tab Size

随声附和 提交于 2019-12-01 22:50:11
问题 I am writing a Java program, and I use in some part of the program a JTextpane. In this JTextpane I use tabs (\t) to make columns, something like: txtpnMTrace = new JTextPane(); txtpnMTrace.setFont(new Font("Dialog", Font.PLAIN, 11)); doc = txtpnMTrace.getStyledDocument(); ... doc.insertString(doc.getLength(),value1+"\t"+value2+"\t"+value3+"\n", null); ... I can see the values in columns at tab (\t) distance. The tab distance is always the same, and I want to change this distance to improve

Java Setting Indent Size on JTextPane

做~自己de王妃 提交于 2019-12-01 22:46:55
I want to set the size of a tab character, \t, in a JTextPane to be 4 spaces wide. After Googling quite a bit I found some things that I will include here for what I have tried and maybe why they failed. How do you set the tab size in a JEditorPane? JTextPane is not a plain document. Java JTextpane Tab Size Eclipse raised some errors: Type mismatch: cannot convert from javax.swing.text.AttributeSet to javax.print.attribute.AttributeSet and The method setParagraphAttributes(javax.swing.text.AttributeSet, boolean) in the type JTextPane is not applicable for the arguments (javax.print.attribute

Java JTextpane Tab Size

风格不统一 提交于 2019-12-01 22:04:59
I am writing a Java program, and I use in some part of the program a JTextpane. In this JTextpane I use tabs (\t) to make columns, something like: txtpnMTrace = new JTextPane(); txtpnMTrace.setFont(new Font("Dialog", Font.PLAIN, 11)); doc = txtpnMTrace.getStyledDocument(); ... doc.insertString(doc.getLength(),value1+"\t"+value2+"\t"+value3+"\n", null); ... I can see the values in columns at tab (\t) distance. The tab distance is always the same, and I want to change this distance to improve the look. Do you know How Can I change the tab (\t) size in JTextPane? Thanks in advance. Deepak import

Changing the mouse pointer in JtextPane

痴心易碎 提交于 2019-12-01 21:21:16
I have a JTextPane which has the content type text/plain . I set some texts to that JTextPane and it contain some texts which display URLs . I want to change the mouse pointer when I point the mouse to that text only into the hand pointer. Is this function achievable? Note: I have the content of the JTextPane as text/plain . It cannot be changed to text/html thanx You could try this: pane.setCursor(new Cursor(Cursor.HAND_CURSOR)); Where pane is your JTextPane . camickr Did you read my answer in your posting on Adding tooltips to JTextPane ? Well the concept is the same. You use a MouseListener

JTextPane: How to set the font size

霸气de小男生 提交于 2019-12-01 18:34:38
问题 Please have a look at the following code import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; import java.util.ArrayList; import java.util.Scanner; import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.BadLocationException; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; public class Form extends JFrame {

JTextPane: How to set the font size

ぐ巨炮叔叔 提交于 2019-12-01 18:30:49
Please have a look at the following code import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; import java.util.ArrayList; import java.util.Scanner; import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.BadLocationException; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; public class Form extends JFrame { private JTextPane textPane; private JLabel results; private JPanel center,south; private FlowLayout