Re: JTable drag-and-drop
From: SPC (google.1.SteveCrook_at_spamgourmet.com)
Date: 06/29/04
- Next message: Bora Eryilmaz: "How to disable tree node selection"
- Previous message: hitesh: "Repainting windows"
- In reply to: dar7yl: "Re: JTable drag-and-drop"
- Next in thread: dar7yl: "Re: JTable drag-and-drop"
- Reply: dar7yl: "Re: JTable drag-and-drop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Jun 2004 06:51:29 -0700
Ever heard the one about not looking a gift horse in the mouth? :-)
I'll see what I can do. I have to extract the code from some other
stuff I also put into the UI to make it work better with a specific
use of JTreeTable that my employer required. One side effect of my
changes is that dragging to select rows and columns no-longer works.
I'm sure you'll be able to unpick what you need from the code. But
it'll have to wait until I've got a bit more time. (days rather than
weeks or months!).
What's depressing it that they apparently have no plans to change the
thing so that it behaves the same as many other windows tables on
windows. It wouldn't be beyond the wit of man to put in some sort of
property that governed drag operations and let the person using the
table decide how it should behave. Ho hum.
Steve
"dar7yl" <no_reply@accepted.org> wrote in message news:<DpZDc.37443$HS3.22979@edtnps84>...
> "SPC" <google.1.SteveCrook@spamgourmet.com> wrote in message
> news:339e375c.0406280806.d14ae55@posting.google.com...
> > In short, you can't. Not by setting an option anyway. There's a
> > longstanding bug on Suns database. Included in the comments on the bug
> > there are a couple of suggestions for changing the behaviour of JTable
> > to get this to work.
> >
> > See: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4521075
>
> Thanks for the link. It sure is entertaining reading. I agree that Sun is
> most negligent in their approach to outstanding defects. You'd think that
> with the attention this bug report has generated, it would be high on the
> priority list. At least they could publish a work-around until the "real"
> fix comes through the pipeline.
>
> >
> > Essentially, you have derive from the current table UI, uninstall
> > their drag gesture listener (a mouse listener which refuses to start a
> > drag on an unselected row) and install one of your own which *will*
> > start a drag under those circumstances. Just take a copy of the UI
> > code for the JTable drag recognizer, modify it and install it instead.
>
> What?? You mean I have to find some OPP (other people's problem) code,
> decipher it, learn about some archaic computer-science-class concepts, fix
> the problem, integrate it into my real-world application, document it, trace
> it, and later remove it when Sun finally gets around to fixing it?
>
> > If you do this, then selection won't move because the recognizer
> > consumes the mouse event, and it never gets to the selection code. See
> > the comment by 'scmorr', in his? case, he? wanted the dragged row to
> > be selected, so reordering the listeners was enough. In my case I
> > *didn't* want to select the dragged row, so I had to do more work.
> >
> > Unfortunately, the code's not mine (though I wrote it) so I can't post
> > it...
>
> Thanks, but can you be a bit more specific? You could, of course retype it
> from memory without violating your employer's NDA. -- or better still, ask
> them politely (via letter) for permisssion to publish that portion of code.
> (yea, I know, lots of work, can of worms...)
>
> thanx,
> Dar7yl (the 7 is silent)
- Next message: Bora Eryilmaz: "How to disable tree node selection"
- Previous message: hitesh: "Repainting windows"
- In reply to: dar7yl: "Re: JTable drag-and-drop"
- Next in thread: dar7yl: "Re: JTable drag-and-drop"
- Reply: dar7yl: "Re: JTable drag-and-drop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|