Package sc.fiji.snt.gui
Class GuiUtils.Buttons
java.lang.Object
sc.fiji.snt.gui.GuiUtils.Buttons
- Enclosing class:
GuiUtils
Utility methods for creating and styling
JButtons, including SNT's notification and options buttons.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAJButtonthat shows an attachedJPopupMenuof options when clicked.static classA two-row panel of small glyph buttons stacked one above the other. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddToGroup(List<AbstractButton> buttons) static voidblink(AbstractButton button, int animationCycles) Briefly "blinks"button's icon a handful of times towards a color-inverted negative of itself/ColorTableButton(float scalingFactor, Consumer<String> colorTableAction, String[] choices, String selected, JMenuItem... extraItems) Builds a dropdown button whose popup lists color-table choices as a mutually exclusive group.ColorTableButton(float scalingFactor, Consumer<String> colorTableAction, String selected, JMenuItem... extraItems) Convenience variant ofColorTableButton(float, Consumer, String[], String, JMenuItem...)using theDEFAULT_LUTSchoices.static JButtonstatic JToggleButtonedit()static AbstractButtonstatic JButtonstatic JButtonSmall borderless icon button styled to sit next to a spinner.static JButtonkeyboardCheatSheetButton(Color color, float scalingFactor) static voidmakeBorderless(AbstractButton... buttons) static voidmakeRoundRect(AbstractButton button) static ButtonGroupstatic JButtonnotificationCenterButton(Color color, float scalingFactor) Creates a "notification center" bell button reflecting the (single, process-wide) pending-notices queue (seeGuiUtils.Notices.queueNotice(java.lang.String, java.lang.String, java.lang.Runnable)): badged with a small corner dot whenever a notice is queued, and, on click, listing (and letting the user dismiss/act on) whatever is currently pending.static JButtonoptions()OptionsButton(IconFactory.GLYPH glyph, float scalingFactor, JPopupMenu menu) OptionsButton(IconFactory.GLYPH glyph, Color color, float scalingFactor, JPopupMenu menu, boolean dropdownIndicator) static JButtonstatic JButtonsmallButton(String text) static JButtonsync(boolean borderless) static JButtontoolbarButton(String badgeName) static JButtontoolbarButton(Action action, String tooltipText) static JButtontoolbarButton(IconFactory.GLYPH glyph, Color color, float scalingFactor) static JToggleButtontoolbarToggleButton(Action action, String tooltipText, IconFactory.GLYPH glyph1, IconFactory.GLYPH glyph2) static JToggleButtontoolbarToggleButton(Action action, String tooltipText, IconFactory.GLYPH glyph1, IconFactory.GLYPH glyph2, Color color) static JButtonundo()static JButtonConvenience variant ofundo()for the common "reset to default" button: builds the borderless undo-styled button and assigns it the given tooltip in one call, instead of the two-lineundo()/setToolTipText(...)pair repeated across several dialogs.static JButton
-
Method Details
-
addToGroup
-
noneSelectedButtonGroup
-
ColorTableButton
public static GuiUtils.Buttons.OptionsButton ColorTableButton(float scalingFactor, Consumer<String> colorTableAction, String selected, JMenuItem... extraItems) Convenience variant ofColorTableButton(float, Consumer, String[], String, JMenuItem...)using theDEFAULT_LUTSchoices. -
ColorTableButton
public static GuiUtils.Buttons.OptionsButton ColorTableButton(float scalingFactor, Consumer<String> colorTableAction, String[] choices, String selected, JMenuItem... extraItems) Builds a dropdown button whose popup lists color-table choices as a mutually exclusive group. The supplied action is invoked with the chosen name whenever a selection is made; anyextraItemsare appended below a separator.- Parameters:
scalingFactor- icon scaling factorcolorTableAction- action applied with the selected choice (may be null)choices- the color-table names to offerselected- the name to pre-check (may be null for none)extraItems- optional app-specific items appended after a separator
-
OptionsButton
public static GuiUtils.Buttons.OptionsButton OptionsButton(IconFactory.GLYPH glyph, float scalingFactor, JPopupMenu menu) -
OptionsButton
public static GuiUtils.Buttons.OptionsButton OptionsButton(IconFactory.GLYPH glyph, Color color, float scalingFactor, JPopupMenu menu, boolean dropdownIndicator) -
help
-
notificationCenterButton
Creates a "notification center" bell button reflecting the (single, process-wide) pending-notices queue (seeGuiUtils.Notices.queueNotice(java.lang.String, java.lang.String, java.lang.Runnable)): badged with a small corner dot whenever a notice is queued, and, on click, listing (and letting the user dismiss/act on) whatever is currently pending. Add the returned button to a toolbar/panel; icon state, badge, and popup are all wired automatically- Returns:
- the fully wired button
-
keyboardCheatSheetButton
-
undo
-
undo
-
undo
Convenience variant ofundo()for the common "reset to default" button: builds the borderless undo-styled button and assigns it the given tooltip in one call, instead of the two-lineundo()/setToolTipText(...)pair repeated across several dialogs.- Parameters:
tooltip- the tooltip text (may be HTML), or null for none
-
sync
-
histogram
Small borderless icon button styled to sit next to a spinner. Used by the Curation Assistant's per-check histogram popups, but generic. -
show
-
delete
-
edit
-
options
-
makeBorderless
-
smallButton
-
makeRoundRect
-
toolbarButton
-
toolbarButton
-
toolbarToggleButton
public static JToggleButton toolbarToggleButton(Action action, String tooltipText, IconFactory.GLYPH glyph1, IconFactory.GLYPH glyph2) -
toolbarToggleButton
public static JToggleButton toolbarToggleButton(Action action, String tooltipText, IconFactory.GLYPH glyph1, IconFactory.GLYPH glyph2, Color color) -
toolbarButton
-
get
-
blink
Briefly "blinks"button's icon a handful of times towards a color-inverted negative of itself/The negative is derived from
button's own current icon (rasterized once into aBufferedImage, RGB channels inverted pixel-by-pixel, alpha left untouched). Crossfades the two directly (same technique asSplashScreen's icon transitions.Stops immediately, rather than running to completion, the moment
buttonis actually clicked, and restoresbutton's original icon either way once done.- Parameters:
button- the button to be 'blinked'animationCycles- the no. of animation cycles. Setting it to-1applies a default.
-