I have a jtable where i'd like the followiung to occur:
single click: do one thing
double click: do an other
Problem is if i double click it executing both the single then double. Since both have tasks that read same file im getting major issues. Why would this be happening anyfixes?
i tried using double click on one and mouse pressed on another same problem......very strange
steve labar
Ranch Hand
Joined: Sep 10, 2008
Posts: 55
posted
0
oh that mouse click == 5 was ==1 i just was playing around w/ options forgot to change it back!
Problem is if i double click it executing both the single then double. Why would this be happening?
Yes, because thats the way applications are normally designed.
a) a single click selects the item
b) a double click performs some action on the item
And that is why you can also use the keyboard:
a) the arrow keys are used to select an item
b) the Enter key would then typically before an action on the item (although for a JTable the default is to just move to the next row you can always write a custom Action).
Since both have tasks that read same file
Sounds to me like a bad design. Remember what I suggested above. Whatever you can do with the mouse you should be able to do with the keyboard. So it does not make sense to read a file every time you use an arrow key.
But, strangely enough you are not the first person to ask for something like this and I happen to have some old code lying around:
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: jtable would like to handle both single click and double click