Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8102073

Allow user to drag-and-drop Tab header areas in order reorder the tabs in TabPanes



    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: fx2.1
    • Fix Version/s: None
    • Component/s: javafx
    • Environment:

      Windows, OSX, Linux


      In JavaFX, tab functionality is handled by two classes javafx.scene.control.TabPane, com.sun.javafx.scene.control.skin.TabPaneSkin (the former handling the selection logic and events, the latter responsible for painting).

      "Current practice" in modern, multi-tabbed interfaces is for the user to be able to reorder the tabs in the tab pane via drag-and-drop operations. Usually, this works as follows: the user single clicks (and keeps the mouse button depressed) on the tab header area (clicking elsewhere is ignored for the purposes of a reorder gesture), and drags the mouse left or right. Since the user has pressed a mouse button on a tab (call it T), it is now selected (this is not currently what happens, see RT-20476), and the UI reflects this by shading the tab lighter (customizable). As the user then drags, the coordinates in the mouse drag events are projected onto the x-axis in order to compute the new (x-axis) position of the T (the y-axis obviously remaining the same). Once the midpoint of the current tab, that is half the sum of its left and right x-axis values, is greater than the left position value of the next tab (if the user is dragging right) or less than the right position value of the previous tab - in both cases, let's call this tab X --, then T & X are exchanged. This relocation of occurs immediately once the preceding condition is true for X. For T, however, the position remains that projected by the current mouse position until the mouse button is released. At this point, the tab is relocated to its correct location.




            Unassigned Unassigned
            duke J. Duke (Inactive)
            0 Vote for this issue
            0 Start watching this issue