()
| 42 | } |
| 43 | |
| 44 | private TaskBar() { |
| 45 | startShowMessageThread(); |
| 46 | showTaskBar(); |
| 47 | addActionListener(); |
| 48 | |
| 49 | ThreadPoolUtil.getInstance().executeTask(() -> { |
| 50 | EventManagement instance = EventManagement.getInstance(); |
| 51 | while (instance.notMainExit()) { |
| 52 | if (popupMenu != null && popupMenu.isVisible() && (GetHandle.INSTANCE.isKeyPressed(L_BUTTON) || GetHandle.INSTANCE.isKeyPressed(R_BUTTON))) { |
| 53 | Point point = java.awt.MouseInfo.getPointerInfo().getLocation(); |
| 54 | Point location = popupMenu.getLocationOnScreen(); |
| 55 | int X = location.x; |
| 56 | int Y = location.y; |
| 57 | int width = popupMenu.getWidth(); |
| 58 | int height = popupMenu.getHeight(); |
| 59 | if (!(X <= point.x && point.x <= X + width && Y < point.y && point.y <= Y + height)) { |
| 60 | SwingUtilities.invokeLater(() -> popupMenu.setVisible(false)); |
| 61 | } |
| 62 | } |
| 63 | try { |
| 64 | TimeUnit.MILLISECONDS.sleep(50); |
| 65 | } catch (InterruptedException e) { |
| 66 | throw new RuntimeException(e); |
| 67 | } |
| 68 | } |
| 69 | }); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * 显示托盘消息线程 |
nothing calls this directly
no test coverage detected