JAL-3416 set flatlaf default drag mode to LIVE_DRAG_MODE
authorBen Soares <b.soares@dundee.ac.uk>
Tue, 1 Nov 2022 18:29:09 +0000 (18:29 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Tue, 1 Nov 2022 18:29:09 +0000 (18:29 +0000)
src/jalview/bin/Jalview.java
src/jalview/gui/Desktop.java

index 1428906..9f37540 100755 (executable)
@@ -1123,6 +1123,8 @@ public class Jalview
       UIManager.put("TabbedPane.tabWidthMode", "compact");
       UIManager.put("TabbedPane.selectedBackground", Color.white);
     }
+
+    Desktop.setLiveDragMode(Cache.getDefault("FLAT_LIVE_DRAG_MODE", true));
     return set;
   }
 
index 16603df..20532be 100644 (file)
@@ -187,6 +187,14 @@ public class Desktop extends jalview.jbgui.GDesktop
 
   public static HashMap<String, FileWriter> savingFiles = new HashMap<String, FileWriter>();
 
+  private static int DRAG_MODE = JDesktopPane.OUTLINE_DRAG_MODE;
+
+  public static void setLiveDragMode(boolean b)
+  {
+    DRAG_MODE = b ? JDesktopPane.LIVE_DRAG_MODE
+            : JDesktopPane.OUTLINE_DRAG_MODE;
+  }
+
   private JalviewChangeSupport changeSupport = new JalviewChangeSupport();
 
   public static boolean nosplash = false;
@@ -482,7 +490,7 @@ public class Desktop extends jalview.jbgui.GDesktop
     }
 
     getContentPane().add(desktop, BorderLayout.CENTER);
-    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
+    desktop.setDragMode(DRAG_MODE);
 
     // This line prevents Windows Look&Feel resizing all new windows to maximum
     // if previous window was maximised