Class SwingUtil


  • public class SwingUtil
    extends Object
    Various Swing utilities.
    • Constructor Detail

      • SwingUtil

        public SwingUtil()
    • Method Detail

      • setupDefaults

        public static void setupDefaults()
        Sets some sensible defaults for swing. IMPORTANT! Needs to be called before main frame creation
      • setTheme

        public static void setTheme​(@Nonnull
                                    LookAndFeel laf)
        Safely sets Swing theme
        Parameters:
        laf - the swing look and feel
      • setFont

        public static void setFont​(@Nonnull
                                   Font font)
        Sets default Swing font. IMPORTANT! Needs to be called before main frame creation
        Parameters:
        font - the new font to use
      • createSwingButton

        public static JButton createSwingButton​(@Nonnull
                                                NavigationButton navigationButton,
                                                int iconSize,
                                                @Nullable
                                                BiConsumer<NavigationButton,​JButton> specialCallback)
        Create swing button from navigation button.
        Parameters:
        navigationButton - the navigation button
        iconSize - the icon size (in case it is 0 default icon size will be used)
        specialCallback - the special callback
        Returns:
        the swing button
      • removeButtonDecorations

        public static void removeButtonDecorations​(AbstractButton button)
      • fastRemoveAll

        public static void fastRemoveAll​(Container c)
        Removes all of a component's children faster than calling removeAll() on it in many cases
      • pumpPendingEvents

        public static void pumpPendingEvents()
        Run any events currently in the event queue