| | |
jtextpane help please..
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2007
Posts: 14
Reputation:
Solved Threads: 0
i have a jtextpane now, i want that some text on it become bold, and not all
how can i possibly do this,
for exmple, i want to bold all the word "cool" found in my textpane..
i know that i should use a DocumentListener(Do I need??)
but i really want to know how to bold certain word found in my textpane, in this case
the word
"cool"
thanks for helping..
this is my code so far, and i dont know what to do
how can i possibly do this,
for exmple, i want to bold all the word "cool" found in my textpane..
i know that i should use a DocumentListener(Do I need??)
but i really want to know how to bold certain word found in my textpane, in this case
the word
"cool"
thanks for helping..
this is my code so far, and i dont know what to do
Java Syntax (Toggle Plain Text)
JTextPane JTP; StyledDocument dsd=new DefaultStyledDocument(); SimpleAttributeSet a=new SimpleAttributeSet(); a.addAttribute(StyleConstants.CharacterConstants.Bold,Boolean.TRUE); try { dsd.insertString(dsd.getLength(),"cool",a); } catch(Exception e) { } JTP=new JTextPane(dsd); getContentPane().add(new JScrollPane(JTP));
Would be nice that you share it with others then...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- JTextPane (Java)
- Printing JPanel containing JLable, JTable, JButton, JTextPane, JTextArea (Java)
- JTextPane (Java)
- adding Jscrollbar or Jscrollpane to Jtextpane (Java)
- JTextPane (Java)
- help with regex...and marking up text in JTextpane with html (Java)
- JTextPane Printing (Java)
Other Threads in the Java Forum
- Previous Thread: Convert String to an expression.
- Next Thread: J2ME build settings in NetBeans
Views: 1139 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for Java
android api apple applet application arguments array arrays automation bidirectional binary birt bluetooth calculator chat class classes client code columns component database designadrawingapplicationusingjavajslider draw eclipse editor error errors event exception expand file fractal game givemetehcodez graphics gui guidancer helpwithhomework html ide image inetaddress input integer intellij j2me java javamicroeditionuseofmotionsensor javaprojects jme jmf jni jpanel julia link linux list loop map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie number object oracle plazmic print problem program programming project recursion scanner screen server set signing size smart sms smsspam socket sort sql string subclass support swing test threads time transfer tree webservices windows






