MCPcopy Create free account
hub / github.com/dorkbox/SystemTray / Status

Class Status

src/dorkbox/systemTray/Status.java:26–80  ·  view source on GitHub ↗

This represents a common menu-status entry, that is cross platform in nature

Source from the content-addressed store, hash-verified

24 * This represents a common menu-status entry, that is cross platform in nature
25 */
26public
27class Status extends Entry {
28 private volatile String text;
29
30 public
31 Status() {
32 }
33
34 /**
35 * @param peer the platform specific implementation for all actions for this type
36 * @param parent the parent of this menu, null if the parent is the system tray
37 * @param imageResizeUtil the utility used to resize images. This can be Tray specific because of cache requirements
38 */
39 public
40 void bind(final StatusPeer peer, final Menu parent, ImageResizeUtil imageResizeUtil) {
41 super.bind(peer, parent, imageResizeUtil);
42
43 peer.setText(this);
44 }
45
46 /**
47 * @return the text label that the menu entry has assigned
48 */
49 public
50 String getText() {
51 return text;
52 }
53
54 /**
55 * Specifies the new text to set for a menu entry
56 *
57 * @param text the new text to set
58 */
59 public
60 void setText(final String text) {
61 this.text = text;
62
63 if (peer != null) {
64 ((StatusPeer) peer).setText(this);
65 }
66 }
67
68 /**
69 * @return a copy of this Status as a swing JMenuItem, with all elements converted to their respective swing elements.
70 */
71 public
72 JMenuItem asSwingComponent() {
73 JMenuItem jMenuItem = new JMenuItem();
74
75 jMenuItem.setText(getText());
76 jMenuItem.setEnabled(false);
77
78 return jMenuItem;
79 }
80}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected