Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4109770
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:50:38+00:00 2026-05-20T21:50:38+00:00

We have a request on a product I am working on to get more

  • 0

We have a request on a product I am working on to get more feedback on our drag and drop behavior. Specifically, they would like us to highlight certain areas when the mouse is over them during the drag operation (to show where the drop will occur). However, we are using a TransferHandler to handle both DnD, and cut/copy/paste, and based on what we have tested it seems that Swing will not let us add another DropTarget to the component (in retrospect, for some obvious reasons!) We have attempted to go down a few paths, none of which have born any fruit.

Basically, we would like to get in the middle of the dragEnter and dragExit events while still using the TransferHandler capabilities to facilitate easy Cut/Copy/Paste and drop behavior. Does anyone have any examples to do this kind of thing? Or is this just really hard to do in the current setup of DnD in Swing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T21:50:39+00:00Added an answer on May 20, 2026 at 9:50 pm

    Most out-of-the-box Swing components have support for this built in(JTree, JList, etc). For those components you can set the drop mode and the ui will handle drawing the appropriate visual effects.

    myJList.setDropMode(DropMode.ON_OR_INSERT);
    

    For a custom component you need to handle the drawing yourself by overriding paintComponent to draw the custom effects and then adding a propertyChangeListener for the “dropLocation” property that triggers the appropriate repaints when necessary. This will get called frequently on drag so you may wish to only trigger repaints when the change in drop location actually results in a change in behavior.

    Swing Tutorial on Drop Location Rendering

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a query like this: String Category = HttpContext.Current.Request.QueryString[Product].ToString(); IQueryable<ItemFile> pressReleases =
I have a list of items with which I would like to view more
Assuming I have a page request which goes like http://localhost/accounting/products?id=234 and sometimes it goes
I have request where i need to change grid formatting on drop down action
I have an index page for listing products. From this page I would like
I have managed to get a UPS Shipping calculator working in PHP. I now
I have been playing with Amazon's Product Advertising API, and I cannot get a
I am currently working on system that generated product recommendations like those on Amazon
I have ksop request. what i knead to produce is <ns4:senddata> <connectionId xsi:type=xsd:string> asdfdsafdsfasdfdsa
I have 100 web servers and noticed that some of them have request filtering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.