Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37571
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2017-10-13 13:02 -0700 |
| References | <255e35fe-5f4f-4916-89c5-f5d07b74ca3c@googlegroups.com> <orr2pd$219$1@dont-email.me> |
| Message-ID | <08b10dcc-e61e-4f55-a0cb-878d64493104@googlegroups.com> (permalink) |
| Subject | Re: How do you update a component when you leave on a drag? |
| From | Eric Douglas <e.d.programmer@gmail.com> |
On Friday, October 13, 2017 at 3:05:49 PM UTC-4, Knute Johnson wrote:
> On 10/13/2017 12:42, Eric Douglas wrote:
> > I wrote a custom TransferHandler, which is changing the appearance of a custom JTable through it's custom UI.
> > I put the method call to change the appearance in the canImport method, but this method is only getting called as I drag over the control. What method should I be updating to tell it I was dragging over that control and have left the bounds of that control so I can restore it's appearance?
> >
>
> Do you want to update it while you are still dragging? I'm not sure but
> have you tried calling validate() based on the mouse position? You may
> still have problems in that the EDT is blocked by your drag operation.
>
> Can you make an SSCCE?
>
> --
>
> Knute Johnson
I am updating the control while I'm dragging, which works fine while I'm dragging over the JTable.
I set this in my JTable constructor.
setTransferHandler(new MyCustomTransferHandler(this));
Within the transfer handler, I'm using this method to tell the JTable to repaint:
public boolean canImport(final TransferHandler.TransferSupport info) {
This passes through to my custom class, which extends BasicTableUI, which draws a red line between rows showing the drop point.
I'm not seeing any events while the mouse is not over the JTable, and I'm not sure if or where it calls a method I can process that says the mouse exited the JTable. Any mouse listener on the JTable checking mouseExited doesn't process until the mouse is released.
Now I want to be able to drag from the JTable to a different control, and remove the red line whenever the mouse is not over the JTable.
I'm not sure how easy that is, but I'll try writing an SSCCE if that's the only way to figure this out.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How do you update a component when you leave on a drag? Eric Douglas <e.d.programmer@gmail.com> - 2017-10-13 10:42 -0700
Re: How do you update a component when you leave on a drag? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-10-13 14:04 -0500
Re: How do you update a component when you leave on a drag? Eric Douglas <e.d.programmer@gmail.com> - 2017-10-13 13:02 -0700
Re: How do you update a component when you leave on a drag? Eric Douglas <e.d.programmer@gmail.com> - 2017-10-16 06:07 -0700
csiph-web