Code cleanup
This commit is contained in:
parent
09143f7630
commit
d08904d634
@ -140,7 +140,7 @@ class TrayPopup extends JPopupMenu {
|
|||||||
hiddenDialog.dispatchEvent(new WindowEvent(hiddenDialog, WindowEvent.WINDOW_CLOSING));
|
hiddenDialog.dispatchEvent(new WindowEvent(hiddenDialog, WindowEvent.WINDOW_CLOSING));
|
||||||
}
|
}
|
||||||
|
|
||||||
void doShow(final MenuImpl systemTray, 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);
|
||||||
|
|
||||||
@ -174,19 +174,14 @@ class TrayPopup extends JPopupMenu {
|
|||||||
|
|
||||||
// critical to get the keyboard listeners working for the popup menu
|
// critical to get the keyboard listeners working for the popup menu
|
||||||
setInvoker(hiddenDialog.getContentPane());
|
setInvoker(hiddenDialog.getContentPane());
|
||||||
|
|
||||||
|
|
||||||
hiddenDialog.setLocation(x, y);
|
hiddenDialog.setLocation(x, y);
|
||||||
hiddenDialog.setVisible(true);
|
hiddenDialog.setVisible(true);
|
||||||
|
|
||||||
setLocation(x, y);
|
setLocation(x, y);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
|
||||||
// when the menu entries are changed, this makes sure to correctly show them
|
|
||||||
invalidate();
|
|
||||||
revalidate();
|
|
||||||
doLayout();
|
|
||||||
|
|
||||||
requestFocusInWindow();
|
requestFocusInWindow();
|
||||||
|
|
||||||
((EntryImpl) systemTray.getFirst())._native.requestFocusInWindow();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ class _AppIndicatorTray extends MenuImpl {
|
|||||||
.getLocation();
|
.getLocation();
|
||||||
|
|
||||||
TrayPopup popupMenu = (TrayPopup) _native;
|
TrayPopup popupMenu = (TrayPopup) _native;
|
||||||
popupMenu.doShow(_AppIndicatorTray.this, point, SystemTray.DEFAULT_TRAY_SIZE);
|
popupMenu.doShow(point, SystemTray.DEFAULT_TRAY_SIZE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class _GtkStatusIconTray extends MenuImpl {
|
|||||||
.getLocation();
|
.getLocation();
|
||||||
|
|
||||||
TrayPopup popupMenu = (TrayPopup) _native;
|
TrayPopup popupMenu = (TrayPopup) _native;
|
||||||
popupMenu.doShow(_GtkStatusIconTray.this, point, 0);
|
popupMenu.doShow(point, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class _SwingTray extends MenuImpl {
|
|||||||
public
|
public
|
||||||
void mousePressed(MouseEvent e) {
|
void mousePressed(MouseEvent e) {
|
||||||
TrayPopup popupMenu = (TrayPopup) _native;
|
TrayPopup popupMenu = (TrayPopup) _native;
|
||||||
popupMenu.doShow(_SwingTray.this, e.getPoint(), 0);
|
popupMenu.doShow(e.getPoint(), 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user