SwingMenu and TrayPopup are now public in order to support nativeUI for
windows
This commit is contained in:
parent
1dc97f1825
commit
f4dab70179
|
@ -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)
|
// 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")
|
@SuppressWarnings("ForLoopReplaceableByForEach")
|
||||||
|
public
|
||||||
class SwingMenu implements MenuPeer {
|
class SwingMenu implements MenuPeer {
|
||||||
|
|
||||||
final JComponent _native;
|
final JComponent _native;
|
||||||
|
@ -41,6 +42,7 @@ class SwingMenu implements MenuPeer {
|
||||||
|
|
||||||
// This is NOT a copy constructor!
|
// This is NOT a copy constructor!
|
||||||
@SuppressWarnings("IncompleteCopyConstructor")
|
@SuppressWarnings("IncompleteCopyConstructor")
|
||||||
|
public
|
||||||
SwingMenu(final SwingMenu parent, final Menu entry) {
|
SwingMenu(final SwingMenu parent, final Menu entry) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ import dorkbox.util.ScreenUtil;
|
||||||
*
|
*
|
||||||
* This is our "golden standard" since we have 100% control over it on all platforms
|
* This is our "golden standard" since we have 100% control over it on all platforms
|
||||||
*/
|
*/
|
||||||
|
public
|
||||||
class TrayPopup extends JPopupMenu {
|
class TrayPopup extends JPopupMenu {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ class TrayPopup extends JPopupMenu {
|
||||||
private volatile File iconFile;
|
private volatile File iconFile;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
public
|
||||||
TrayPopup() {
|
TrayPopup() {
|
||||||
super();
|
super();
|
||||||
setFocusable(true);
|
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
|
* 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) {
|
void setTitleBarImage(final File imageFile) {
|
||||||
if (this.iconFile == null || !this.iconFile.equals(imageFile)) {
|
if (this.iconFile == null || !this.iconFile.equals(imageFile)) {
|
||||||
this.iconFile = imageFile;
|
this.iconFile = imageFile;
|
||||||
|
@ -129,6 +132,7 @@ class TrayPopup extends JPopupMenu {
|
||||||
hiddenDialog.dispatchEvent(new WindowEvent(hiddenDialog, WindowEvent.WINDOW_CLOSING));
|
hiddenDialog.dispatchEvent(new WindowEvent(hiddenDialog, WindowEvent.WINDOW_CLOSING));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public
|
||||||
void doShow(final Point point, int offset) {
|
void doShow(final Point point, int offset) {
|
||||||
Dimension size = getPreferredSize();
|
Dimension size = getPreferredSize();
|
||||||
Rectangle bounds = ScreenUtil.getScreenBoundsAt(point);
|
Rectangle bounds = ScreenUtil.getScreenBoundsAt(point);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user