Package net.runelite.client.util
Class SwingUtil
- java.lang.Object
-
- net.runelite.client.util.SwingUtil
-
public class SwingUtil extends Object
Various Swing utilities.
-
-
Constructor Summary
Constructors Constructor Description SwingUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addModalTooltip(AbstractButton button, String on, String off)
static JButton
createSwingButton(NavigationButton navigationButton, int iconSize, BiConsumer<NavigationButton,JButton> specialCallback)
Create swing button from navigation button.static TrayIcon
createTrayIcon(Image icon, String title, Frame frame)
Create tray icon.static void
fastRemoveAll(Container c)
Removes all of a component's children faster than calling removeAll() on it in many casesstatic void
pumpPendingEvents()
Run any events currently in the event queuestatic void
removeButtonDecorations(AbstractButton button)
static void
setFont(Font font)
Sets default Swing font.static void
setTheme(LookAndFeel laf)
Safely sets Swing themestatic void
setupDefaults()
Sets some sensible defaults for swing.
-
-
-
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
-
createTrayIcon
@Nullable public static TrayIcon createTrayIcon(@Nonnull Image icon, @Nonnull String title, @Nonnull Frame frame)
Create tray icon.- Parameters:
icon
- the icontitle
- the titleframe
- the frame- Returns:
- the tray icon
-
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 buttoniconSize
- 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)
-
addModalTooltip
public static void addModalTooltip(AbstractButton button, String on, String off)
-
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
-
-