При наведении на иконку трея, текуший прокси в подсказке к иконке автоматически обновляется
This commit is contained in:
		
							parent
							
								
									e34d242688
								
							
						
					
					
						commit
						9918b47043
					
				
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -4,7 +4,7 @@ import org.json.simple.parser.ParseException; | ||||||
| 
 | 
 | ||||||
| import javax.swing.*; | import javax.swing.*; | ||||||
| import java.awt.*; | import java.awt.*; | ||||||
| import java.awt.event.ActionListener; | import java.awt.event.*; | ||||||
| import java.io.*; | import java.io.*; | ||||||
| import java.net.*; | import java.net.*; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
|  | @ -202,6 +202,7 @@ public class Main { | ||||||
|         Image icon; |         Image icon; | ||||||
|         icon = Toolkit.getDefaultToolkit().getImage("res" + osSeparator + "icon off.png"); |         icon = Toolkit.getDefaultToolkit().getImage("res" + osSeparator + "icon off.png"); | ||||||
|         trayIcon = new TrayIcon(icon, "Current proxy: " + currentProxyPub, trayMenu); |         trayIcon = new TrayIcon(icon, "Current proxy: " + currentProxyPub, trayMenu); | ||||||
|  |         trayIcon.addMouseMotionListener(trayMouseListener()); | ||||||
|         trayIcon.setImageAutoSize(!isLinux); |         trayIcon.setImageAutoSize(!isLinux); | ||||||
|         try { |         try { | ||||||
|             tray.add(trayIcon); |             tray.add(trayIcon); | ||||||
|  | @ -210,6 +211,24 @@ public class Main { | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public static MouseMotionListener trayMouseListener(){ | ||||||
|  |         return new MouseMotionListener() { | ||||||
|  |             @Override | ||||||
|  |             public void mouseDragged(MouseEvent e) { | ||||||
|  | 
 | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             @Override | ||||||
|  |             public void mouseMoved(MouseEvent e) { | ||||||
|  |                 try { | ||||||
|  |                     updateIcon(); | ||||||
|  |                 } catch (InterruptedException | IOException ex) { | ||||||
|  |                     exeptionActions("Mouse Entered Event", ex); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         }; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     public static ActionListener addListener(){ |     public static ActionListener addListener(){ | ||||||
|         return e -> { |         return e -> { | ||||||
|             // frame |             // frame | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue