Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Highlighting in JTable

 
Maki Jav
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I use this format to highlight words in a sentence:

<html>This is a <body bgcolor=yellow text=red><b>WORD</b> to be higlighted</body></html>

....but what is the proper format?

Thanks,

Maki Jav
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean by "proper format". If it works then it would seem to be proper enough

Swing can deal with HTML 3.2, so if you're curious what you can and can not use, have a look at the specification.
 
Maki Jav
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your answer. I think that there is proper way to write html. What I am doing is using a hack.

I write html pages so I know that you use <span> tag for highlighting but I was not successful with that

Maki Jav
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt span is supported within JLabels, also since span itself is nothing - only if you set it's style or class will it have any meaning.

You could try font though.
 
Maki Jav
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes <font> could be used but I need a yellow background of the highlighted word


Maki Jav
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Font can have a bgcolor as well
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic