{"action":"created","issue":{"url":"https://api.github.com/repos/sarxos/webcam-capture/issues/458","repository_url":"https://api.github.com/repos/sarxos/webcam-capture","labels_url":"https://api.github.com/repos/sarxos/webcam-capture/issues/458/labels{/name}","comments_url":"https://api.github.com/repos/sarxos/webcam-capture/issues/458/comments","events_url":"https://api.github.com/repos/sarxos/webcam-capture/issues/458/events","html_url":"https://github.com/sarxos/webcam-capture/issues/458","id":153162429,"number":458,"title":"keep open webcam during the entire application","user":{"login":"julianlujan1","id":19199234,"avatar_url":"https://avatars.githubusercontent.com/u/19199234?v=3","gravatar_id":"","url":"https://api.github.com/users/julianlujan1","html_url":"https://github.com/julianlujan1","followers_url":"https://api.github.com/users/julianlujan1/followers","following_url":"https://api.github.com/users/julianlujan1/following{/other_user}","gists_url":"https://api.github.com/users/julianlujan1/gists{/gist_id}","starred_url":"https://api.github.com/users/julianlujan1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julianlujan1/subscriptions","organizations_url":"https://api.github.com/users/julianlujan1/orgs","repos_url":"https://api.github.com/users/julianlujan1/repos","events_url":"https://api.github.com/users/julianlujan1/events{/privacy}","received_events_url":"https://api.github.com/users/julianlujan1/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sarxos/webcam-capture/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-05T03:37:21Z","updated_at":"2016-05-06T07:27:08Z","closed_at":null,"body":"Good night, I have been using their API which has been very good, only have a concern, as you could keep open the web cam during all my application? This with the purpose of not be open in each form (since you can use it in several forms) because this takes approximately 5 seconds to open the web cam. Can be done only once and keep it open to all forms? Many thank you in advance"},"comment":{"url":"https://api.github.com/repos/sarxos/webcam-capture/issues/comments/217369842","html_url":"https://github.com/sarxos/webcam-capture/issues/458#issuecomment-217369842","issue_url":"https://api.github.com/repos/sarxos/webcam-capture/issues/458","id":217369842,"user":{"login":"sarxos","id":472658,"avatar_url":"https://avatars.githubusercontent.com/u/472658?v=3","gravatar_id":"","url":"https://api.github.com/users/sarxos","html_url":"https://github.com/sarxos","followers_url":"https://api.github.com/users/sarxos/followers","following_url":"https://api.github.com/users/sarxos/following{/other_user}","gists_url":"https://api.github.com/users/sarxos/gists{/gist_id}","starred_url":"https://api.github.com/users/sarxos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarxos/subscriptions","organizations_url":"https://api.github.com/users/sarxos/orgs","repos_url":"https://api.github.com/users/sarxos/repos","events_url":"https://api.github.com/users/sarxos/events{/privacy}","received_events_url":"https://api.github.com/users/sarxos/received_events","type":"User","site_admin":false},"created_at":"2016-05-06T07:27:08Z","updated_at":"2016-05-06T07:27:08Z","body":"You are asking how to reference objects from a different class? This is very simple - just open your webcam immediately after your application is started (in the ```main(String[] args)```) and store in some static field which you later access from different forms.\r\n\r\n```java\r\npublic class MainApplication {\r\n  public static Webcam webcam;\r\n  public static void main(String[] args) {\r\n    webcam = Webcam.getDefault();\r\n    webcam.open();\r\n    // other stuffs\r\n  }\r\n}\r\n```\r\n\r\nAnd in your form:\r\n\r\n```java\r\npublic class SomeForm {\r\n  void doSomething() {\r\n    Webcam webcam = MainApplication.webcam;\r\n    ByufferedImage image = webcam.getImage();\r\n    // do something with image\r\n  }\r\n}\r\n```"}}