Starting point for the application. General initialization should be done inside the ApplicationController's init() method. If certain kinds of non-Swing initialization takes too long, it should happen in a new Thread and off the Swing event dispatch thread (EDT). @author hansi
| 33 | * @author hansi |
| 34 | */ |
| 35 | public class JAppleMenuBar { |
| 36 | static JAppleMenuBar instance; |
| 37 | static final String FILENAME = "libjAppleMenuBar.jnilib"; |
| 38 | |
| 39 | static { |
| 40 | try { |
| 41 | File temp = File.createTempFile("processing", "menubar"); |
| 42 | temp.delete(); // remove the file itself |
| 43 | temp.mkdirs(); // create a directory out of it |
| 44 | temp.deleteOnExit(); |
| 45 | |
| 46 | File jnilibFile = new File(temp, FILENAME); |
| 47 | InputStream input = JAppleMenuBar.class.getResourceAsStream(FILENAME); |
| 48 | if (input != null) { |
| 49 | if (PApplet.saveStream(jnilibFile, input)) { |
| 50 | System.load(jnilibFile.getAbsolutePath()); |
| 51 | instance = new JAppleMenuBar(); |
| 52 | |
| 53 | } else { |
| 54 | sadness("Problem saving " + FILENAME + " for full screen use."); |
| 55 | } |
| 56 | } else { |
| 57 | sadness("Could not load " + FILENAME + " from core.jar"); |
| 58 | } |
| 59 | } catch (IOException e) { |
| 60 | sadness("Unknown error, here's the stack trace."); |
| 61 | e.printStackTrace(); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | |
| 66 | static void sadness(String msg) { |
| 67 | System.err.println("Full screen mode disabled. " + msg); |
| 68 | } |
| 69 | |
| 70 | |
| 71 | // static public void show() { |
| 72 | // instance.setVisible(true); |
| 73 | // } |
| 74 | |
| 75 | |
| 76 | static public void hide() { |
| 77 | instance.setVisible(false, false); |
| 78 | } |
| 79 | |
| 80 | |
| 81 | public native void setVisible(boolean visibility, boolean kioskMode); |
| 82 | |
| 83 | |
| 84 | // public void setVisible(boolean visibility) { |
| 85 | // // Keep original API in-tact. Default kiosk-mode to off. |
| 86 | // setVisible(visibility, false); |
| 87 | // } |
| 88 | } |
nothing calls this directly
no test coverage detected