Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML Tags in JTextPanel/JFrame

Status
Not open for further replies.

pclip123

Programmer
Mar 23, 2007
1
US
I have the following method declared..

Code:
public void display() {
          Set finalStringSet = mapFinal.keySet();
          JTextPane textPane = new JTextPane(); // creates an empty text pane
          textPane.setContentType("text/html"); // lets Java know it will be HTML                  
          textPane.setText(<span style="font-size: 20pt">Big</span>); // sets its text
          JFrame frame = new JFrame(); // makes a window to put it in
          frame.getContentPane().add(textPane); // adds the text pane to the window
          frame.pack(); // adjusts the window to the right size
          frame.setVisible(true); // makes it show up
   }

I am having trouble with the line that reads:
Code:
textPane.setText(<span style="font-size: 20pt">Big</span>);

I just want to print out the string "big" with that increased font size, yet everytime i try to compile i get the error "> expected".. Can someone PLEASE help me?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top