I have JTextField to display a file name. I would like to strikethrough the text if the file is not valid. How can do this? I tried the html but no luck.
I'm pretty sure you can't style text in a JTextField
, beyond setting the font. I think you'll either have to create your own subclass which supports styling, or create a JTextPane
and set it up to behave like a JTextField
.
There's some good documentation here: http://download.oracle.com/javase/tutorial/uiswing/components/editorpane.html