[Logo]
Forums Register Login
Is there a way to invoke caretUpdate()?
I was building a simple text editor.
The code below is to initialize text component which extends JTextPane:


Now, I have JTabbedPane and every tab contains above component. I use CaretEvent to refresh label on status bar that displays current line/column number.
I also added ChangeListener to tabbedPane and implemented stateChanged() method. Is there any way to invoke caretUpdate() every time I select different tab, so above mentioned label is automatically refreshed?
I would have a separate method that is called both from caretUpdate and stateChanged.
You're right, I don't know how I missed that!
Anyway, now the code should look something like this:



Now these methods can be invoked from stateChanged(), too, which is what I needed!

Thanks!
Your mind is under my control .... your will is now mine .... read this tiny ad
ScroogeXHTML 7.1 - RTF to HTML5 / XHTML converter
https://coderanch.com/t/690611/ScroogeXHTML-RTF-HTML-XHTML-converter


This thread has been viewed 1503 times.

All times above are in ranch (not your local) time.
The current ranch time is
Feb 21, 2018 01:58:05.