• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JComboBox Drag Problem

 
L Goundalkar
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have JPanel and many Jcomponent objects in it. One of them is JcomboBox. All I need is to allow Drag and place the components in the Panel.
But When I click on JComboBox it drops the poppup. I can't drag the same. I am using simple logic for the same, i.e capturing the xy co ordinates and assiging the same to the component and repainting the Panel.
I am not using DnD packages.
So How can I drag and place the JComboBox in the JPanel ???
Thanks for the time.
Cheers.
 
raj madhuram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you consider disabling the combo box when dragging (using setEnabled(false))? That will make it not to handle the mouse click over the combo box item.
 
L Goundalkar
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If you do that it will disable the combo completely. No events will be fired. :roll:
Cheers.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not so! If you read the API for setEnabled() (in the Component class) you will notice this line:

Note: Disabling a lightweight component does not prevent it from receiving MouseEvents.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic