This represents a common menu-entry, that is cross platform in nature
| 35 | * This represents a common menu-entry, that is cross platform in nature |
| 36 | */ |
| 37 | @SuppressWarnings({"unused", "SameParameterValue", "WeakerAccess"}) |
| 38 | public |
| 39 | class MenuItem extends Entry { |
| 40 | static boolean alreadyEmittedTooltipWarning = false; |
| 41 | |
| 42 | private volatile String text; |
| 43 | private volatile Object unknownImage = null; |
| 44 | private volatile File imageFile; |
| 45 | private volatile ActionListener callback; |
| 46 | |
| 47 | // default enabled is always true |
| 48 | private volatile boolean enabled = true; |
| 49 | |
| 50 | // default is 0, which will remove the shortcut key from the native peer |
| 51 | private volatile char mnemonicKey = 0; |
| 52 | private volatile String tooltip; |
| 53 | |
| 54 | public |
| 55 | MenuItem() { |
| 56 | } |
| 57 | |
| 58 | public |
| 59 | MenuItem(final String text) { |
| 60 | this.text = text; |
| 61 | } |
| 62 | |
| 63 | public |
| 64 | MenuItem(final String text, final ActionListener callback) { |
| 65 | this.text = text; |
| 66 | this.callback = callback; |
| 67 | } |
| 68 | |
| 69 | public |
| 70 | MenuItem(final String text, final String imagePath) { |
| 71 | this(text, imagePath, null); |
| 72 | } |
| 73 | |
| 74 | public |
| 75 | MenuItem(final String text, final File imageFile) { |
| 76 | this(text, imageFile, null); |
| 77 | } |
| 78 | |
| 79 | public |
| 80 | MenuItem(final String text, final URL imageUrl) { |
| 81 | this(text, imageUrl, null); |
| 82 | } |
| 83 | |
| 84 | public |
| 85 | MenuItem(final String text, final InputStream imageStream) { |
| 86 | this(text, imageStream, null); |
| 87 | } |
| 88 | |
| 89 | public |
| 90 | MenuItem(final String text, final Image image) { |
| 91 | this(text, image, null); |
| 92 | } |
| 93 | |
| 94 | public |
nothing calls this directly
no outgoing calls
no test coverage detected