File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JComboBox Drag Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JComboBox Drag Problem" Watch "JComboBox Drag Problem" New topic
Author

JComboBox Drag Problem

L Goundalkar
Ranch Hand

Joined: Jul 05, 2001
Posts: 395
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.


SCJP, SCWCD
raj madhuram
Ranch Hand

Joined: Oct 10, 2001
Posts: 71
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

Joined: Jul 05, 2001
Posts: 395
Hi,
If you do that it will disable the combo completely. No events will be fired. :roll:
Cheers.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JComboBox Drag Problem
 
Similar Threads
Setting the size of JComboBox
unable to see dynamically added component in swing
Dragging and Dropping swing JPanels
JComboBox doubt
Help sorting out what combination of layouts will provide the result I need