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
        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
        font - the new font to use
      • createTrayIcon

        public static TrayIcon createTrayIcon​(@Nonnull
                                              Image icon,
                                              String title,
                                              Frame frame)
        Create tray icon.
        icon - the icon
        title - the title
        frame - the frame
        the tray icon
      • createSwingButton

        public static JButton createSwingButton​(@Nonnull
                                                NavigationButton navigationButton,
                                                int iconSize,
                                                BiConsumer<NavigationButton,​JButton> specialCallback)
        Create swing button from navigation button.
        navigationButton - the navigation button
        iconSize - the icon size (in case it is 0 default icon size will be used)
        specialCallback - the special callback
        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