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.

1014 questions
-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,267
  • 4
  • 19
  • 31
-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" onerror="onImageLoadingError(this);" /> </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-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" onerror="onImageLoadingError(this);" /> </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">59</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="12 bronze badges">12</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" onerror="onImageLoadingError(this);" /> </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">778</li> <li class="s-award-bling s-award-bling__silver" title="12 silver badges">12</li> <li class="s-award-bling s-award-bling__bronze" title="31 bronze badges">31</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>-3</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" onerror="onImageLoadingError(this);" /> </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">161</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="15 bronze badge">15</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/add" class="post-tag grid--cell" title="show questions tagged 'add'" rel="tag">add</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" onerror="onImageLoadingError(this);" /> </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="mln24"> <div class="question-summary" id="question-summary-15107496"> <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 answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/15107496/want-a-java-swing-tableview-example" class="question-hyperlink">want a java swing tableview example</a></h3> <div class="excerpt">We are developing a java Swing application .I want to add a table in a JTextPane, the table can be resized and shoude be support multi-span (row and column).It seems java Swing table view support this, but I cant find any example of this. Can…</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/tableview" class="post-tag grid--cell" title="show questions tagged 'tableview'" rel="tag">tableview</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 Feb 27 '13 at 08:39">asked Feb 27 '13 at 08:39</time> <a href="../../users/1360783/husanhong" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/1360783.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="husanhong" onerror="onImageLoadingError(this);" /> </a> <div class="s-user-card--info"> <a href="../../users/1360783/husanhong" class="s-user-card--link">husanhong</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">15</li> <li class="s-award-bling s-award-bling__bronze" title="6 bronze badges">6</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-19889696"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>-5</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/19889696/why-could-jtextpane-settext-throw-an-array-out-of-bounds-exception" class="question-hyperlink">Why could JTextPane::setText throw an Array Out of Bounds Exception?</a></h3> <div class="excerpt">Why could be a possible reason for: JTextPane p = new JTextPane(); p.setText("hello"); The exact code is rather long. So I'm not sure what parts I must show here. It's something like: Tab t = new Tab(jp1); t.editortxt.setText("hello"); Tab extends…</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/jtextpane" class="post-tag grid--cell" title="show questions tagged 'jtextpane'" rel="tag">jtextpane</a> <a href="../../questions/tagged/jeditorpane" class="post-tag grid--cell" title="show questions tagged 'jeditorpane'" rel="tag">jeditorpane</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Nov 10 '13 at 12:30">asked Nov 10 '13 at 12:30</time> <a href="../../users/1418853/batman" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/1418853.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="batman" onerror="onImageLoadingError(this);" /> </a> <div class="s-user-card--info"> <a href="../../users/1418853/batman" class="s-user-card--link">batman</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">4,216</li> <li class="s-award-bling s-award-bling__gold" title="9 gold badges">9</li> <li class="s-award-bling s-award-bling__silver" title="44 silver badges">44</li> <li class="s-award-bling s-award-bling__bronze" title="77 bronze badges">77</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=67" rel="prev" title="Go to page 67">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> <a class="s-pagination--item" href="../../questions/tagged/jtextpane_page=67" rel="" title="Go to page 67">67</a> <div class="s-pagination--item is-selected">68</div> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script> /* replace <time class="fromnow" /> with human delta between `datetime` attr and now */ document.addEventListener('DOMContentLoaded', function(){ var time_elements = document.querySelectorAll("time.fromnow"); for (var i=0; i<time_elements.length; i++) { time_elements[i].innerHTML = moment(time_elements[i].getAttribute("datetime")).fromNow(); } }); </script> </body> </html>