From f4dab70179e7869c1df617d290f48120ff668ffe Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 24 Jan 2018 17:34:38 +0100 Subject: [PATCH] SwingMenu and TrayPopup are now public in order to support nativeUI for windows --- src/dorkbox/systemTray/ui/swing/SwingMenu.java | 2 ++ src/dorkbox/systemTray/ui/swing/TrayPopup.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/dorkbox/systemTray/ui/swing/SwingMenu.java b/src/dorkbox/systemTray/ui/swing/SwingMenu.java index 59350ea..fb33780 100644 --- a/src/dorkbox/systemTray/ui/swing/SwingMenu.java +++ b/src/dorkbox/systemTray/ui/swing/SwingMenu.java @@ -34,6 +34,7 @@ import dorkbox.util.SwingUtil; // this is a weird composite class, because it must be a Menu, but ALSO a Entry -- so it has both (and duplicate code) @SuppressWarnings("ForLoopReplaceableByForEach") +public class SwingMenu implements MenuPeer { final JComponent _native; @@ -41,6 +42,7 @@ class SwingMenu implements MenuPeer { // This is NOT a copy constructor! @SuppressWarnings("IncompleteCopyConstructor") + public SwingMenu(final SwingMenu parent, final Menu entry) { this.parent = parent; diff --git a/src/dorkbox/systemTray/ui/swing/TrayPopup.java b/src/dorkbox/systemTray/ui/swing/TrayPopup.java index 072478e..6ccb783 100644 --- a/src/dorkbox/systemTray/ui/swing/TrayPopup.java +++ b/src/dorkbox/systemTray/ui/swing/TrayPopup.java @@ -41,6 +41,7 @@ import dorkbox.util.ScreenUtil; * * This is our "golden standard" since we have 100% control over it on all platforms */ +public class TrayPopup extends JPopupMenu { private static final long serialVersionUID = 1L; @@ -51,6 +52,7 @@ class TrayPopup extends JPopupMenu { private volatile File iconFile; @SuppressWarnings("unchecked") + public TrayPopup() { super(); setFocusable(true); @@ -108,6 +110,7 @@ class TrayPopup extends JPopupMenu { /** * Sets the image for the title-bar, so IF it shows in the task-bar, it will have the corresponding image as the SystemTray image */ + public void setTitleBarImage(final File imageFile) { if (this.iconFile == null || !this.iconFile.equals(imageFile)) { this.iconFile = imageFile; @@ -129,6 +132,7 @@ class TrayPopup extends JPopupMenu { hiddenDialog.dispatchEvent(new WindowEvent(hiddenDialog, WindowEvent.WINDOW_CLOSING)); } + public void doShow(final Point point, int offset) { Dimension size = getPreferredSize(); Rectangle bounds = ScreenUtil.getScreenBoundsAt(point);