views:

440

answers:

1

I am using a JEditorPane as an editor to write comments in my application. The content type is set "text/plain". When I am writing text in it and the text fills the available space and I go on typing, the text is not moving upward to show the cursor. So I dont know where I am typing and what I am typing since it would be visible.

Could you tell me how to always show the caret by moving the above text upwards?

Instead, it could be better if I can auto-resize the editor as I am typing. The JEditorPane is inside a JPanel, so I have to resize that too. any Ideas?

+3  A: 

You need to put the editor inside a JScrollPane. The ScrollPane will automatically add scrollbars and remove the need to resize the editor.

Vincent Ramdhanie
no i cant use scollpane. at least i cant show scroll bars... :(
Shree