Is there a delay in select() of JTextComponent?

Discussion in 'Java' started by Jan Burse, Dec 2, 2012.

  1. Jan Burse

    Jan Burse Guest

    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)
    Jan Burse, Dec 2, 2012
    #1
    1. Advertising

  2. Jan Burse

    Jan Burse Guest

    Jan Burse schrieb:
    > 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
    Jan Burse, Dec 2, 2012
    #2
    1. Advertising

  3. Jan Burse

    Jan Burse Guest

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

    Jan Burse schrieb:
    > 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)
    >
    Jan Burse, Dec 2, 2012
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shuqing Wu

    delay on select

    Shuqing Wu, Dec 29, 2003, in forum: C Programming
    Replies:
    1
    Views:
    337
    Christopher Benson-Manica
    Dec 29, 2003
  2. Jonathan Mark
    Replies:
    0
    Views:
    443
    Jonathan Mark
    Dec 21, 2006
  3. David Holroyd
    Replies:
    3
    Views:
    510
    David Holroyd
    May 25, 2005
  4. palmiere
    Replies:
    1
    Views:
    384
    Erwin Moller
    Feb 9, 2004
  5. Replies:
    13
    Views:
    233
Loading...

Share This Page