Package madkit.gui
Class SwingUtil
java.lang.Object
madkit.gui.SwingUtil
This class provides some utilities for building swing components.
- Since:
- MaDKit 5.0.0.16
- Version:
- 0.9
- Author:
- Fabien Michel
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AbstractButton
addBooleanActionTo
(Container menuOrToolBar, BooleanAction action) Creates aJCheckBoxMenuItem
for a menu orJToggleButton
for a tool barstatic void
addMaDKitActionsTo
(Container menuOrToolBar, AbstractAgent agent) Adds to a menu or toolbar the following actions:KernelAction.EXIT
KernelAction.COPY
KernelAction.RESTART
KernelAction.LAUNCH_NETWORK
KernelAction.STOP_NETWORK
GUIManagerAction.CONNECT_TO_IP
GlobalAction.JCONSOLE
KernelAction.CONSOLE
GlobalAction.DEBUG
GlobalAction.LOAD_LOCAL_DEMOS
GlobalAction.LOAD_JAR_FILE
GUIManagerAction.ICONIFY_ALL
GUIManagerAction.DEICONIFY_ALL
GUIManagerAction.KILL_AGENTS
static JSlider
createJSlider
(BoundedRangeModel model) Creates a JSlider built using aDefaultBoundedRangeModel
and containing aMouseWheelListener
and some usual default settingsstatic JPanel
createSliderPanel
(BoundedRangeModel model, String label) Creates a labeled panel containing a slider built using an existingDefaultBoundedRangeModel
static JPanel
createSliderPanel
(JSlider slider, String label) Creates a labeled panel containing a slider with default size.static JPanel
createSliderPanel
(JSlider slider, String label, int width) Creates a labeled panel containing a slider and considering a particular widthstatic void
scaleAllAbstractButtonIconsOf
(Container container, int size) Resizes the icons of all the abstract buttons which are contained in a container.
-
Field Details
-
MADKIT_LOGO
The MaDKit's logo -
MADKIT_LOGO_SMALL
The MaDKit's logo with a size of 14x14 pixels
-
-
Method Details
-
createSliderPanel
Creates a labeled panel containing a slider with default size.- Parameters:
slider
-label
-- Returns:
- a panel for the slider
-
createSliderPanel
Creates a labeled panel containing a slider and considering a particular width- Parameters:
slider
-label
-- Returns:
- a panel for the slider
-
createSliderPanel
Creates a labeled panel containing a slider built using an existingDefaultBoundedRangeModel
- Parameters:
model
-label
-- Returns:
- a panel for this model
-
createJSlider
Creates a JSlider built using aDefaultBoundedRangeModel
and containing aMouseWheelListener
and some usual default settings- Parameters:
model
-- Returns:
- the corresponding
JSlider
-
addMaDKitActionsTo
Adds to a menu or toolbar the following actions:KernelAction.EXIT
KernelAction.COPY
KernelAction.RESTART
KernelAction.LAUNCH_NETWORK
KernelAction.STOP_NETWORK
GUIManagerAction.CONNECT_TO_IP
GlobalAction.JCONSOLE
KernelAction.CONSOLE
GlobalAction.DEBUG
GlobalAction.LOAD_LOCAL_DEMOS
GlobalAction.LOAD_JAR_FILE
GUIManagerAction.ICONIFY_ALL
GUIManagerAction.DEICONIFY_ALL
GUIManagerAction.KILL_AGENTS
- Parameters:
agent
- the agent for which this menu will be built.
-
addBooleanActionTo
Creates aJCheckBoxMenuItem
for a menu orJToggleButton
for a tool bar- Parameters:
menuOrToolBar
-action
-- Returns:
- the newly created button: Either a
JToggleButton
or aJCheckBoxMenuItem
- Throws:
NoSuchMethodException
IllegalAccessException
InvocationTargetException
-
scaleAllAbstractButtonIconsOf
Resizes the icons of all the abstract buttons which are contained in a container.- Parameters:
container
- a container containing abstract buttonssize
- the size which should be used for the icons
-