Class SwingUtils

java.lang.Object
VASSAL.tools.swing.SwingUtils

public class SwingUtils
extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • isMacLegacy

      public static boolean isMacLegacy()
      Supports swapping most Control and Command button functions on Mac so as not to punish long-time users for our "old non-standard implementations"
    • setMacLegacy

      public static void setMacLegacy​(boolean b)
      Supports swapping most Control and Command button functions on Mac so as not to punish long-time users for our "old non-standard implementations"
    • descaleTransform

      public static AffineTransform descaleTransform​(AffineTransform t)
    • isLeftMouseButton

      @Deprecated public static boolean isLeftMouseButton​(MouseEvent e)
      Deprecated.
      Returns:
      whether the event is effectively for the left button.
    • isRightMouseButton

      @Deprecated public static boolean isRightMouseButton​(MouseEvent e)
      Deprecated.
      Returns:
      whether the event is effectively for the right button.
    • isControlDown

      @Deprecated public static boolean isControlDown​(MouseEvent e)
      Deprecated.
      Returns:
      whether the event effectively has Control down.
    • isContextMouseButtonDown

      public static boolean isContextMouseButtonDown​(MouseEvent e)
      Returns:
      whether the event has the key/mouse combo for Context Menu active, whether it would raise one "right now" or not. (normally plain right mouse button, but some funky mac bonuses)
    • isMainMouseButtonDown

      public static boolean isMainMouseButtonDown​(MouseEvent e)
      Returns:
      whether the event has the key/mouse combo for selecting things down (normally just plain left mouse button, but on Mac only if not pretending to be right button)
    • isSelectionToggle

      public static boolean isSelectionToggle​(MouseEvent e)
      Returns:
      whether the event has the key/mouse combo toggling targets in and out of selection (normally Ctrl+Click on most platforms, normally Command+Click on Mac)
    • systemToGeneric

      public static KeyStroke systemToGeneric​(KeyStroke k)
    • genericToSystem

      public static KeyStroke genericToSystem​(KeyStroke k)
    • getKeyStrokeForEvent

      public static KeyStroke getKeyStrokeForEvent​(KeyEvent e)
    • isDragTrigger

      public static boolean isDragTrigger​(DragGestureEvent e)
      Returns:
      whether the drag is non-mouse or effectively from the left button