()
| 202 | } |
| 203 | |
| 204 | private static void initialiseJVM() throws Exception { |
| 205 | |
| 206 | log.debug("Initialising JVM..."); |
| 207 | |
| 208 | // Although we guarantee the JVM through the packager it is possible that |
| 209 | // a power user will use their own |
| 210 | try { |
| 211 | // We guarantee the JVM through the packager so we should try it first |
| 212 | UIManager.setLookAndFeel(new NimbusLookAndFeel()); |
| 213 | UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
| 214 | defaults.put("nimbusOrange", defaults.get("nimbusBase")); |
| 215 | } catch (UnsupportedLookAndFeelException e) { |
| 216 | try { |
| 217 | UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); |
| 218 | } catch (Exception e1) { |
| 219 | System.exit(-1); |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | // Set any bespoke system properties |
| 224 | try { |
| 225 | // Fix for Windows / Java 7 / VPN bug |
| 226 | System.setProperty("java.net.preferIPv4Stack", "true"); |
| 227 | |
| 228 | // Fix for version.txt not visible for Java 7 |
| 229 | System.setProperty("jsse.enableSNIExtension", "false"); |
| 230 | |
| 231 | if (OSUtils.isMac()) { |
| 232 | |
| 233 | // Ensure the correct name is displayed in the application menu |
| 234 | System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Bither"); |
| 235 | // Ensure OSX key bindings are used for copy, paste etc |
| 236 | // Use the Nimbus keys and ensure this occurs before any component creation |
| 237 | addOSXKeyStrokes((InputMap) UIManager.get("TextField.focusInputMap")); |
| 238 | addOSXKeyStrokes((InputMap) UIManager.get("FormattedTextField.focusInputMap")); |
| 239 | addOSXKeyStrokes((InputMap) UIManager.get("TextArea.focusInputMap")); |
| 240 | addOSXKeyStrokes((InputMap) UIManager.get("PasswordField.focusInputMap")); |
| 241 | addOSXKeyStrokes((InputMap) UIManager.get("EditorPane.focusInputMap")); |
| 242 | |
| 243 | } |
| 244 | |
| 245 | |
| 246 | } catch (SecurityException se) { |
| 247 | log.error(se.getClass().getName() + " " + se.getMessage()); |
| 248 | } |
| 249 | |
| 250 | } |
| 251 | |
| 252 | private static void addOSXKeyStrokes(InputMap inputMap) { |
| 253 |
no test coverage detected