MCPcopy Create free account
hub / github.com/bither/bither-desktop-java / initialiseJVM

Method initialiseJVM

src/main/java/net/bither/Bither.java:204–250  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

mainMethod · 0.95

Calls 6

isMacMethod · 0.95
addOSXKeyStrokesMethod · 0.95
setLookAndFeelMethod · 0.80
getMessageMethod · 0.80
errorMethod · 0.65
getNameMethod · 0.45

Tested by

no test coverage detected