File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JTabbedPane - Tab Reordering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTabbedPane - Tab Reordering" Watch "JTabbedPane - Tab Reordering" New topic

JTabbedPane - Tab Reordering

Krysty Sullivan
Ranch Hand

Joined: Jun 06, 2002
Posts: 48
Can a Tab in JTabbedPane be dragged and dropped to reorder/rearrange Tabs?
Rachel Swailes
Ranch Hand

Joined: May 18, 2004
Posts: 434
Hi there

I looked into this a while ago. Unfortunatly JTabbedPane doesn't support this and we couldn't find any good ready made components to suit our needs.

In the end we wrote a custom component that listens for mouse clicks on the tab and then waits for the mouse released action to reorder the tabs.

Krysty Sullivan
Ranch Hand

Joined: Jun 06, 2002
Posts: 48
Hi Rachel!

Thanks for replying. I also wrote a custom component to listen to mouse press/drag and release but I couldn't seem to copy/move the content of the tab I'm trying to drag and drop (I made use of TransferHandler). May I know what you used to drag and drop the tab content itself? Thanks in advance.
I agree. Here's the link:
subject: JTabbedPane - Tab Reordering
jQuery in Action, 3rd edition