How to underline a specific character in a Jtextfield

Asked

Viewed 173 times

1

How to change, say, the font of one or more characters of a JTextField allowing them to be underlined, bold or italic? But, the rest of the text would be normal. But in this case I need to specifically underline some characters of a JTextField.

  • Can you illustrate what you want to do with some print? And add what you have already tried to do also so that the question is not closed as "too wide" or "is not clear"

  • 1

    Ah, Jtextfield can’t do what you want, or alter his entire text or change none. You will have to use Jtextpane or Jeditorpane. In this my answer have an example, see if it suits you.

  • You can use html to highlight only some characters of a text of some Swing components (https://docs.oracle.com/javase/tutorial/uiswing/components/html.html).

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.