Merge pull request #53 from informatik-ag-ngl/f/background_execution
Added background execution
This commit is contained in:
		| @@ -5,6 +5,7 @@ import java.io.IOException; | ||||
| import java.util.logging.Level; | ||||
| import java.util.logging.Logger; | ||||
|  | ||||
| import javax.swing.JFrame; | ||||
| import javax.swing.JOptionPane; | ||||
|  | ||||
| import envoy.client.Client; | ||||
| @@ -84,7 +85,7 @@ public class Startup { | ||||
| 					throw new EnvoyException("Could not enter offline mode: user name unknown"); | ||||
| 				client.setSender(clientUser); | ||||
| 			} catch(Exception e2) { | ||||
| 				JOptionPane.showMessageDialog(null, e1.toString(), "Client error", JOptionPane.ERROR_MESSAGE); | ||||
| 				JOptionPane.showMessageDialog(null, e2.toString(), "Client error", JOptionPane.ERROR_MESSAGE); | ||||
| 				System.exit(1); | ||||
| 				return; | ||||
| 			} | ||||
| @@ -118,6 +119,9 @@ public class Startup { | ||||
|  | ||||
| 				try { | ||||
| 					new StatusTrayIcon(chatWindow).show(); | ||||
| 					 | ||||
| 					// If the tray icon is supported, hide the chat window on close | ||||
| 					chatWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); | ||||
| 				} catch (EnvoyException e) { | ||||
| 					logger.warning("The StatusTrayIcon is not supported on this platform!"); | ||||
| 				} | ||||
|   | ||||
| @@ -75,16 +75,15 @@ public class StatusTrayIcon implements EventHandler { | ||||
| 		focusTarget.addWindowFocusListener(new WindowAdapter() { | ||||
|  | ||||
| 			@Override | ||||
| 			public void windowGainedFocus(WindowEvent e) { | ||||
| 				displayMessages = false; | ||||
| 			} | ||||
| 			public void windowGainedFocus(WindowEvent e) { displayMessages = false; } | ||||
|  | ||||
| 			@Override | ||||
| 			public void windowLostFocus(WindowEvent e) { | ||||
| 				displayMessages = true; | ||||
| 			} | ||||
| 			public void windowLostFocus(WindowEvent e) { displayMessages = true; } | ||||
| 		}); | ||||
|  | ||||
| 		// Show the window if the user clicks on the icon | ||||
| 		trayIcon.addActionListener((evt) -> { focusTarget.setVisible(true); focusTarget.requestFocus(); }); | ||||
|  | ||||
| 		// Start processing message events | ||||
| 		EventBus.getInstance().register(this); | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 GitHub
						GitHub