public class BAMutil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
BAMutil.ActionToggle
This wraps a regular action and makes it into a "toggle action",
and associates it with an AbstractButton.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACCEL
Action Property specifies menu accelerator
|
static java.lang.String |
MNEMONIC
Action Property specifies menu mneumonic
|
static java.lang.String |
ROLLOVER_ICON
Action Property specifies Rollover icon name
|
static java.lang.String |
STATE
the state of "toggle" actions = Boolean
|
static java.lang.String |
TOGGLE
Action Property specifies is its a toggle
|
Constructor and Description |
---|
BAMutil() |
Modifier and Type | Method and Description |
---|---|
static javax.swing.AbstractButton |
addActionToContainer(java.awt.Container c,
javax.swing.Action act)
Same as addActionToContainerPos, but add to end of Container
|
static javax.swing.AbstractButton |
addActionToContainerPos(java.awt.Container c,
javax.swing.Action act,
int pos)
creates an AbstractButton using the given Action and adds it to the given Container at the position..
|
static javax.swing.JMenuItem |
addActionToMenu(javax.swing.JMenu menu,
javax.swing.Action act)
_more_
|
static javax.swing.JMenuItem |
addActionToMenu(javax.swing.JMenu menu,
javax.swing.Action act,
int menuPos)
creates a MenuItem using the given Action and adds it to the given Menu.
|
static javax.swing.ImageIcon |
getIcon(java.lang.String name,
boolean errMsg)
Get the named Icon from the default resource (jar file).
|
static java.awt.Image |
getImage(java.lang.String name)
Get the named Image from the default resource (jar file).
|
static javax.swing.AbstractButton |
makeButtcon(javax.swing.Icon icon,
javax.swing.Icon rollover,
java.lang.String tooltip,
boolean is_toggle)
Make a "buttcon" = button with an Icon
|
static java.awt.Cursor |
makeCursor(java.lang.String name)
Make a cursor from the named Image in the default resource (jar file)
|
static void |
setActionProperties(javax.swing.AbstractAction act,
java.lang.String icon_name,
java.lang.String action_name,
boolean is_toggle,
int mnemonic,
int accel)
Standard way to set Properties for Actions.
|
public static final java.lang.String ROLLOVER_ICON
public static final java.lang.String TOGGLE
public static final java.lang.String MNEMONIC
public static final java.lang.String ACCEL
public static final java.lang.String STATE
public static javax.swing.ImageIcon getIcon(java.lang.String name, boolean errMsg)
name
- name of the Icon ( will look for errMsg
- true= print error message if not foundpublic static java.awt.Image getImage(java.lang.String name)
name
- name of the Image ( will look for public static java.awt.Cursor makeCursor(java.lang.String name)
name
- name of the Image ( will look for public static javax.swing.AbstractButton makeButtcon(javax.swing.Icon icon, javax.swing.Icon rollover, java.lang.String tooltip, boolean is_toggle)
icon
- the normal Iconrollover
- the rollover Icontooltip
- the tooltipis_toggle
- if true, make JToggleButton, else JButtonpublic static javax.swing.JMenuItem addActionToMenu(javax.swing.JMenu menu, javax.swing.Action act, int menuPos)
Action.SHORT_DESCRIPTION String MenuItem text (required) Action.SMALL_ICON Icon the Icon to Use BAMutil.ROLLOVER_ICON Icon the rollover Icon BAMutil.TOGGLE Boolean true if its a toggle BAMutil.MNEMONIC Integer menu item shortcut BAMutil.ACCEL Integer menu item global keyboard accelerator
menu
- add to this menuact
- the Action to make it out ofmenuPos
- public static javax.swing.JMenuItem addActionToMenu(javax.swing.JMenu menu, javax.swing.Action act)
menu
- act
- public static javax.swing.AbstractButton addActionToContainerPos(java.awt.Container c, javax.swing.Action act, int pos)
Action.SMALL_ICON Icon the Icon to Use (required) BAMutil.ROLLOVER_ICON Icon the rollover Icon Action.SHORT_DESCRIPTION String tooltip BAMutil.TOGGLE Boolean true if its a toggle
c
- add to this Containeract
- the Action to make it out ofpos
- add to the container at this position (if pos < 0, add at the end)public static javax.swing.AbstractButton addActionToContainer(java.awt.Container c, javax.swing.Action act)
c
- act
- public static void setActionProperties(javax.swing.AbstractAction act, java.lang.String icon_name, java.lang.String action_name, boolean is_toggle, int mnemonic, int accel)
act
- add properties to this actionicon_name
- name of icon (or null).action_name
- menu name / tooltipis_toggle
- true if its a togglemnemonic
- menu item shortcutaccel
- menu item global keyboard accelerator