Questions tagged [jtextpane]

A Java Swing text component that can be marked up with attributes that are represented graphically.

A Java Swing text component that can be marked up with attributes that are represented graphically. You can find how-to information and examples of using text panes in Using Text Components, a section in The Java Tutorial.

1037 questions
-1
votes
1 answer

Colouring text based on color codes in a JTextPane dynamicly

I'm trying to make a textpane using a StyledDocument where when doc.insertString(doc.getLength(), text + "\n", keyWord); it replaces all instances of "§" then a number (so like "§1") with the colour and should remove the code its self after and…
woder
  • 15
  • 6
-1
votes
1 answer

Content Assistant in JAVA

I am trying to create a xml editor which must have a content assistant. I am new in java so my code isn't working properly. I am trying to change a text color while typing (words between '<' and '>' including '<' and '>' must be blue), my non…
Student22b
  • 79
  • 3
  • 13
-1
votes
1 answer

StyleConstants Text Background, Alignment Not Working Together

Consider the code, Question #1 StyledDocument doc=textPane.getStyledDocument(); SimpleAttributeSet attrib=new SimpleAttributeSet(); attrib.addAttribute(StyleConstants.CharacterConstants.Alignment,StyleConstants.ALIGN_RIGHT); doc.insertString(0,"This…
JavaTechnical
  • 8,846
  • 8
  • 61
  • 97
-1
votes
3 answers

Save location in flow layout

I have created a frame and two panels. Jpanel pane11=new JPanel(); Jpanel pane12=new JPanel(); Added the panel2 to the panel1 panel1.add(panel2); getContentPane().add(panel1); Now I set the panel2 background white and it is working correctly I…
-1
votes
1 answer

How to drag more than one JTextPane

I have created a frame with null layout, and I have 6 small JTextPanes in it. My intention is when I clicked a particular textpane, it has to get dragged by mouse wherever I want in the frame.
Ananth
  • 51
  • 1
  • 9
-1
votes
3 answers

Java - How can I add make a JTextPane split in 3 colums?

I'm working on a chat client and I have this problem: What I want to do is divide the JTextPane in 3 colums so that in the first one it puts out the name of the user, in the second the message and the date in the third. I tried to do this by…
martin
  • 1,007
  • 2
  • 16
  • 32
-1
votes
1 answer

JTextPane and HTML

I am making a text editor roughly like a microsoft word and I am using a textpane with HTML. After doing some research I found a way to apply html to a highlighted section on using StyleConstants and then a method that goes…
rortega92
  • 19
  • 1
-1
votes
1 answer

How to create a JTable like header, and use it as JTexPane header?

I need a JTextPane which has a header on top just like the one in a JTable. Basically I need a one row/column multiline JTable without having to go through all trouble crating renderes and editors. I tried adding a JLabel and JTextpane in a JPanel,…
Igor
  • 1,532
  • 4
  • 23
  • 44
-1
votes
3 answers

how to make JTextPane the size of a piece of paper?

OK, So i finally figured out how to print a JTextPane, and really have a fully functioning document editor. Anyway, Can I make the JTextPane the size of a piece of paper (with page breaks) So you can easily predict the appearance of the document…
Primm
  • 1,347
  • 4
  • 19
  • 32
-2
votes
1 answer

How can I remove the line between the JTextPane and the JPanel?

I'm creating a text editor as my exam work and I have a main JPanel which all the Swing components are on. At the top I have a JMenuBar and in the center a JTextPane and at both sides I have panels that display images. The problem I have is that…
-2
votes
1 answer

why is pt font smaller than px font in JTextPane when using the same number?

public static void main(String[] args) { JFrame frame = new JFrame("Test"); JTextPane pane = new JTextPane(); pane.setContentType("text/html"); pane.setText("" + "" + " New Document…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/html" class="post-tag grid--cell" title="show questions tagged 'html'" rel="tag">html</a> <a href="../../questions/tagged/font-size" class="post-tag grid--cell" title="show questions tagged 'font-size'" rel="tag">font-size</a> <a href="../../questions/tagged/jtextpane" class="post-tag grid--cell" title="show questions tagged 'jtextpane'" rel="tag">jtextpane</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Dec 07 '16 at 03:39">asked Dec 07 '16 at 03:39</time> <a href="../../users/7260153/h-shenxian" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/7260153.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="H.Shenxian" /> </a> <div class="s-user-card--info"> <a href="../../users/7260153/h-shenxian" class="s-user-card--link">H.Shenxian</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">1</li> <li class="s-award-bling s-award-bling__bronze" title="1 bronze badges">1</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-37419426"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>-2</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/37419426/creating-a-simple-text-editor-in-java" class="question-hyperlink">Creating a simple text editor in Java</a></h3> <div class="excerpt">How to create a text editor like Notepad ? with functions like "New file", "Open file", "Save file", "formatting text" using Java's GUI elements. </div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/java" class="post-tag grid--cell" title="show questions tagged 'java'" rel="tag">java</a> <a href="../../questions/tagged/eclipse" class="post-tag grid--cell" title="show questions tagged 'eclipse'" rel="tag">eclipse</a> <a href="../../questions/tagged/jframe" class="post-tag grid--cell" title="show questions tagged 'jframe'" rel="tag">jframe</a> <a href="../../questions/tagged/jtextpane" class="post-tag grid--cell" title="show questions tagged 'jtextpane'" rel="tag">jtextpane</a> <a href="../../questions/tagged/jmenubar" class="post-tag grid--cell" title="show questions tagged 'jmenubar'" rel="tag">jmenubar</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked May 24 '16 at 16:42">asked May 24 '16 at 16:42</time> <a href="../../users/5727539/andy-the-android" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/5727539.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Andy the android" /> </a> <div class="s-user-card--info"> <a href="../../users/5727539/andy-the-android" class="s-user-card--link">Andy the android</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">169</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="2 silver badge">2</li> <li class="s-award-bling s-award-bling__bronze" title="16 bronze badge">16</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-34572608"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>-2</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/34572608/how-to-create-a-console-with-jtextpane" class="question-hyperlink">How To Create A Console With JTextPane</a></h3> <div class="excerpt">I tried making a console in a JTextArea that took a string called 'text' and everytime the user did something that I wanted logged in the console, 'text' would be assigned different text (that had to include all the text from before). Then I would…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/java" class="post-tag grid--cell" title="show questions tagged 'java'" rel="tag">java</a> <a href="../../questions/tagged/swing" class="post-tag grid--cell" title="show questions tagged 'swing'" rel="tag">swing</a> <a href="../../questions/tagged/console" class="post-tag grid--cell" title="show questions tagged 'console'" rel="tag">console</a> <a href="../../questions/tagged/jtextarea" class="post-tag grid--cell" title="show questions tagged 'jtextarea'" rel="tag">jtextarea</a> <a href="../../questions/tagged/jtextpane" class="post-tag grid--cell" title="show questions tagged 'jtextpane'" rel="tag">jtextpane</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jan 03 '16 at 01:54">asked Jan 03 '16 at 01:54</time> <a href="../../users/5731363/connor-bailey" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/5731363.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Connor Bailey" /> </a> <div class="s-user-card--info"> <a href="../../users/5731363/connor-bailey" class="s-user-card--link">Connor Bailey</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">69</li> <li class="s-award-bling s-award-bling__silver" title="1 silver badges">1</li> <li class="s-award-bling s-award-bling__bronze" title="13 bronze badges">13</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-38017453"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>-3</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/38017453/highlight-a-row-that-aiming-cursor-in-jtextpane" class="question-hyperlink">Highlight a row that aiming cursor in JTextPane</a></h3> <div class="excerpt">How to highlight a row text in current cursor position without clicking when I am aiming my cursor in my text in JTextPane? Here my example : So, if my cursor aiming (no click) in line 10, then it will highlight all word in line 10. here my problem…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/java" class="post-tag grid--cell" title="show questions tagged 'java'" rel="tag">java</a> <a href="../../questions/tagged/swing" class="post-tag grid--cell" title="show questions tagged 'swing'" rel="tag">swing</a> <a href="../../questions/tagged/cursor" class="post-tag grid--cell" title="show questions tagged 'cursor'" rel="tag">cursor</a> <a href="../../questions/tagged/highlight" class="post-tag grid--cell" title="show questions tagged 'highlight'" rel="tag">highlight</a> <a href="../../questions/tagged/jtextpane" class="post-tag grid--cell" title="show questions tagged 'jtextpane'" rel="tag">jtextpane</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jun 24 '16 at 15:54">asked Jun 24 '16 at 15:54</time> <a href="../../users/4539582/newbie" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/4539582.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="newbie" /> </a> <div class="s-user-card--info"> <a href="../../users/4539582/newbie" class="s-user-card--link">newbie</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">929</li> <li class="s-award-bling s-award-bling__silver" title="17 silver badges">17</li> <li class="s-award-bling s-award-bling__bronze" title="35 bronze badges">35</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-23763200"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>-4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/23763200/i-want-to-add-values-to-jtextpane-in-java" class="question-hyperlink">i want to add values to jtextpane in java</a></h3> <div class="excerpt">I have : String value=(jComboBox1.getSelectedItem().toString()); jTextPane1.setText("\n"+value); I want to add value to jTextPane without overwriting last value , for exemple I want in jTextPane : ( selected item 1 selected…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/java" class="post-tag grid--cell" title="show questions tagged 'java'" rel="tag">java</a> <a href="../../questions/tagged/string" class="post-tag grid--cell" title="show questions tagged 'string'" rel="tag">string</a> <a href="../../questions/tagged/addition" class="post-tag grid--cell" title="show questions tagged 'addition'" rel="tag">addition</a> <a href="../../questions/tagged/jtextpane" class="post-tag grid--cell" title="show questions tagged 'jtextpane'" rel="tag">jtextpane</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked May 20 '14 at 14:52">asked May 20 '14 at 14:52</time> <a href="../../users/3630405/user3630405" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/3630405.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="user3630405" /> </a> <div class="s-user-card--info"> <a href="../../users/3630405/user3630405" class="s-user-card--link">user3630405</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">73</li> <li class="s-award-bling s-award-bling__bronze" title="9 bronze badges">9</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <a class="s-pagination--item" href="../../questions/tagged/jtextpane_page=68" rel="prev" title="Go to page 68">Prev </a> <a class="s-pagination--item" href="../../questions/tagged/jtextpane_page=1" rel="" title="Go to page 1">1</a> <a class="s-pagination--item" href="../../questions/tagged/jtextpane_page=2" rel="" title="Go to page 2">2</a> <a class="s-pagination--item" href="../../questions/tagged/jtextpane_page=3" rel="" title="Go to page 3">3</a> <div class="s-pagination--item s-pagination--item__clear">…</div> <div class="s-pagination--item is-selected">69</div> <a class="s-pagination--item" href="../../questions/tagged/jtextpane_page=70" rel="" title="Go to page 70">70</a> <a class="s-pagination--item" href="../../questions/tagged/jtextpane_page=70" rel="next" title="Go to page 70"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>