0

I want to be able to move my tabs in my jTabbedPane left or right to change the sorting order. I looked around but I noticed most of what I found is asking how to drag and drop a tab in. I just want to make it resortable so that I can move the rightmost tab to the left of the leftmost tab or any order I want.

I know for table columns in a JTable, there is a method, something along the lines of

JTable table = new JTable();
table.setReordering(false); //disables reordering of columns

which prevents this so this functionality is already enabled with columns in tables but with tabs in JTabbedPanes, I cannot find any method similar to this but I'm thinking it would be something similar like

tab.setReordering(true) 

as well but I don't see anything.

  • 1
    Did you look at this? https://stackoverflow.com/questions/4376084/how-can-i-drag-tabs-in-jtabbedpane If this fixes your issue please let me/us know and I/we can mark your question as a duplicate – ControlAltDel Dec 14 '18 at 16:41

1 Answers1

0

A quick search, yielded that it doesn't seem to be supported by Swing directly.

Though this is fairly common with GUI frameworks, where you are often left to implement certain functionality yourself (e.g. I recently had to manually implement TreeCell to allow context menus on TreeItems). This prevents libraries from becoming monolithic unmaintainable messes.

You can find an implementation of the drag-and-drop functionality here

jamierocks
  • 685
  • 5
  • 16