| | |
jtextpane help please..
![]() |
•
•
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
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle physics plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows






