Re: ListSelectionModel problem



Andrew Thompson wrote:
Deniz Dogan wrote:
...
I have a problem when I'm programming a special subtitle (SubRip/srt)

What does SubRip/srt mean to you? It means nothing to me.

Explaining it would not at all tell you more about the problem. Anyways, SubRip (often identified by the .srt file extension) is a subtitle text format. The format is as follows:

532 //line number
00:23:56,800 --> 00:23:59,700 //duration
-How's it going? //the text to be shown on 1 or more rows
-Quite well, actually
\n
etc.

And as I said before, this has nothing to do with the problem, whatsoever.

editor in Java.
I use a JTable (referred to as "table" in the code below) and when the
user presses Shift+Enter the table should select row n+1, where n is the
currently selected row. Ctrl+Enter does the opposite, selects row n-1.

Note that the normal navigation behaviour of a table is to
use 'enter' for moving down rows, and 'shift enter' to move
up. Your navigation scheme hardly represents the
'path of least surprise'.

Another very popular subtitle editor program for Windows is called Subtitle Workshop (not open-source) and it uses the same key bindings for moving up and down in the table. Most translators of amateur subtitles are familiar with those keys from the program and that's why I want the same behavior in my program. If I get a lot of requests to change the key bindings, I might implement a configuration file reader, so that users can define their own key bindings.

The problem is that the code for Shift+Enter doesn't work

Perhaps you need to 'consume' the event so that it does not
propagate back to the table and 'fight against' the behaviour
you expect.

I'll see if I can do that, thanks!

OTOH - perhaps you should revise the table navigation entirely.

I'll consider it, but do you have an suggestions that would improve it?
.