setting font of selected text

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

setting font of selected text

 
0
  #1
Jan 1st, 2005
I know how to se the font of a regular JTextArea, but how would I get an reference to the selected text and only select that?

Here is what I have so far:
  1. setFont(new Font(font, style = Font.BOLD, size));
this works but changes whole area

  1. textArea2.getSelectedText().setFont(new Font("sansserif",Font.BOLD, 12));

this doesn't work, and this is what I need..

How can i do this/
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: setting font of selected text

 
0
  #2
Jan 1st, 2005
I just read that you can't do this in a JTextArea. Im gonna have to convert to JTextPane.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC