Is there a delay in select() of JTextComponent?

J

Jan Burse

Dear All,

I have a very simple application. There is a menu item
with a F2 accelerator. The action of the menu item will
advance the selected text region of the underlying text
component.

When I press and hold down F2, I will get multiple actions
at the same rate as for example when pressing and holding
down the arrow down key. But somehow the for my F2, the
GUI is not able to keep up. But the arrow down key
can do so.

How can I prevent that my F2 actions get stacked up because
the GUI is not responding fast enough? It seems that the
GUI is fast enough, since everything else works fine, such
as arrow down or scroll bar. But somehow the select() seems
to be slow.

Bye

(*)
http://docs.oracle.com/javase/1.4.2/docs/api/javax/swing/text/JTextComponent.html#select(int, int)
 
J

Jan Burse

Jan said:
How can I prevent that my F2 actions get stacked up because
the GUI is not responding fast enough? It seems that the
GUI is fast enough, since everything else works fine, such
as arrow down or scroll bar. But somehow the select() seems
to be slow.

It happens already with this simple action:

int offset = getSelectionEnd();
select(offset + 150, offset + 155);

I am using a TextArea with around 51'000 text lines.

Bye
 
J

Jan Burse

Interesting, its platform specific. Happens on Windows 7,
but not on Mac OS 10.8, both with JDK 1.7.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top