Skip to main content

JTextPane that behaves like a JTextField

2 replies [Last post]
arturux
Offline
Joined: 2009-01-08
Points: 0

Hi,
does anyone know what is to be set in the JTextPane component to force it behave exactly like a JTextField ? Actually I need a component that behaves like a JTextField but displayes styled text. Or is it possible to display styled text in a JTextField ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
zpm
Offline
Joined: 2003-06-16
Points: 0

I think the way to go is to take StyledEditorKit (or develop a custom editor kit based off it), then use it with a JTextField. This is not straightforward (you also have to override a UI class), but you will have correct Views for styled text created for you.

arturux
Offline
Joined: 2009-01-08
Points: 0

Thanks