How can I use JTextPane to style a section of text as "CODE," like you often see on forums, or you see here on stack overflow?
public static main(String[] args) {
/**
* Look at this Code Block, ain't it grand?
* I wish I had something like this in my program.
*/
}
Or how I have seen done on wikipedia, where the text is like this: http://img39.imageshack.us/img39/4516/example.JPG
Thank you!
FINAL UPDATE Vishal K's answer was exactly what I needed. Not a duplicate, as was suggested.
UPDATE
Thank for you the responses. The difference between what I am looking for and what was suggested as a possible answer above is that I am interested in not only changing the font, but also adding a background (a border around said background would be a plus, but not required. I do not need to do syntax highlighting.
I think HTML tags may be the way to go, and if so, that is really the question: How can I use html to format the code in such a way? I will play with the example provided in the answers and let you know.
P.s. I already read the links to the oracle tutorials before asking this question.