|
Author |
Topic: BApplet fullscreen modification (Read 12530 times) |
|
michael05
|
Re: BApplet fullscreen modification
« Reply #15 on: Mar 20th, 2004, 10:53pm » |
|
it definetely works with live video input on my os x 10.3. i hope i will find some time next week to modify the code (thanks to ben fry).
|
°°°°°°°°°°°°°°°°°°°° http://www.m05.de
|
|
|
mKoser
|
Re: BApplet fullscreen modification
« Reply #16 on: Mar 22nd, 2004, 11:36pm » |
|
on Feb 13th, 2004, 12:20am, michael05 wrote: i have added a line to the code to remove the window frame: frame.setUndecorated(true); that should work. but i cant test it because i dont have a windows box here. |
| just gave it a go on my XP machine, and it works just fine however, when shown in fullScreen mode, the applet is placed in upper-left corner (0,0) ... it would be noce to have it centered! i tried to hack it myself (compiling it in the lib/export/ folder) by changing this line in: Code: to something like: Code: frame.setLocation(300, 300); |
| ..compiled it, packed it up as a .jar file, and ran the the full-screen .bat file, but no luck, it still shows up at (0,0). is this hackable (is that a word) + mikkel
|
mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
|
|
|
TomC
|
Re: BApplet fullscreen modification
« Reply #17 on: Mar 23rd, 2004, 12:19am » |
|
As Ben suggested elsewhere, you can use this in a less fussy way by just adding the main function to your usual sketch code. Code: // full-screen main function // originally provided by michael05 static public void main(String args[]) { try { Frame frame = new Frame(); // !!! // change this to your sketch name... Class c = Class.forName("your_sketch_name"); BApplet applet = (BApplet) c.newInstance(); applet.init(); applet.start(); // get default screendevice and configuration GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice (); GraphicsConfiguration gc = gd.getDefaultConfiguration(); frame.setUndecorated(true); frame.setBackground(Color.black); frame.setLayout(new GridBagLayout()); frame.add(applet); frame.pack(); // test if fullscreen mode is available (jvm 1.4+) and activate it if (gd.isFullScreenSupported()) { gd.setFullScreenWindow(frame); } // test if display mode is available (jvm 1.4+) and set it to the // size of the applet if (gd.isDisplayChangeSupported()) { gd.setDisplayMode(new DisplayMode(applet.g.width, applet.g.height, 32, 0)); } frame.setLocation(0, 0); frame.show(); applet.requestFocus(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } |
| When you've exported the applet, make a .bat file in the applet directory containing... Code: start javaw -cp your_sketch_name.jar your_sketch_name |
| (Alt-F4 quits...) If you set your applet dimensions to a normal screen resolution, it should switch modes. If not, it should be centred, because I changed: Code: frame.setLayout(new BorderLayout()); frame.add(applet, BorderLayout.CENTER); |
| to: Code: frame.setLayout(new GridBagLayout()); frame.add(applet); |
| and the GridBag layout manager should centre your sketch.
|
« Last Edit: Mar 23rd, 2004, 12:56am by TomC » |
|
|
|
|
TomC
|
Re: BApplet fullscreen modification
« Reply #18 on: Mar 23rd, 2004, 12:42am » |
|
You should also be able to make the jar file standalone... Unzip it with your favourite zipping application, to a directory called your_sketch_name Make a directory inside there called META-INF. Make a text file called manifest.mf, and in it put the following: Code: Manifest-Version: 1.0 Main-Class: your_sketch_name Classpath: ./your_sketch_name.jar |
| Now zip up the your_sketch_name directory and rename the new zip file to your_sketch_name.jar I haven't tested this, but you should be able to double-click the jar file now (depends on your runtime setup). If not, at the very least you can do "java -jar your_sketch_name.jar" which saves a bit of typing
|
|
|
|
fry
|
Re: BApplet fullscreen modification
« Reply #19 on: Mar 23rd, 2004, 3:09am » |
|
yeah, this works, though drop that classpath line, so: Manifest-Version: 1.0 Main-Class: your_sketch_name i've been using this for my own stuff and this will be part of the 'export to application' feature coming in the next big release.
|
|
|
|
mKoser
|
Re: BApplet fullscreen modification
« Reply #20 on: Mar 23rd, 2004, 10:08am » |
|
thanks tom and ben, however, the code you posted tom, is not working on my system (am i doing something wrong?) i made a simple sketch called application_test, the code is this: Code: // full-screen main function edit by Tom Carden // originally provided by michael05 static public void main(String args[]) { try { Frame frame = new Frame(); // !!! // change this to your sketch name... Class c = Class.forName("your_sketch_name"); BApplet applet = (BApplet) c.newInstance(); applet.init(); applet.start(); // get default screendevice and configuration GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice (); GraphicsConfiguration gc = gd.getDefaultConfiguration(); frame.setUndecorated(true); frame.setBackground(Color.black); frame.setLayout(new GridBagLayout()); frame.add(applet); frame.pack(); // test if fullscreen mode is available (jvm 1.4+) and activate it if (gd.isFullScreenSupported()) { gd.setFullScreenWindow(frame); } // test if display mode is available (jvm 1.4+) and set it to the // size of the applet if (gd.isDisplayChangeSupported()) { gd.setDisplayMode(new DisplayMode(applet.g.width, applet.g.height, 32, 0)); } frame.setLocation(0, 0); frame.show(); applet.requestFocus(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } void setup(){ size(300, 300); } void loop(){ background((int)random(255)); } |
| i saved it, exported it and created a openApp.bat file using Textpad... the code in that is here: Code: start javaw -cp application_test.jar application_test |
| when i click it, the DOS window quickly flickers on my screen and then disappears... but nothing else happens! + mikkel ( ps - exams on thursday, and of course i could do with showing my things using michael05's standAlone-hack ... but it would be soo much nicer to show my work on a big screen with no windows borders!)
|
« Last Edit: Mar 23rd, 2004, 10:09am by mKoser » |
|
mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
|
|
|
TomC
|
Re: BApplet fullscreen modification
« Reply #21 on: Mar 23rd, 2004, 10:30am » |
|
*cough* Code: // !!! // change this to your sketch name... Class c = Class.forName("your_sketch_name"); BApplet applet = (BApplet) c.newInstance(); |
| I'm not sure if there's a way to pull this out automatically, so that the same function will do for all sketches...
|
« Last Edit: Mar 23rd, 2004, 10:31am by TomC » |
|
|
|
|
mKoser
|
Re: BApplet fullscreen modification
« Reply #22 on: Mar 23rd, 2004, 11:29am » |
|
* blush * ok, now i'm embarressed!!! sorry, i am hacking some hectic last minute code before the first part of my exam this afternoon, i went the extremely laze route and just copy-pasted your code into my sketch... damn it, when do i learn to think before i speak (ie, read the code before i complain!) thanks alot Tom! it fullscreens, centers as it should now! YEY! + m
|
mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
|
|
|
michael05
|
Re: BApplet fullscreen modification
« Reply #23 on: Mar 23rd, 2004, 2:30pm » |
|
good luck!
|
°°°°°°°°°°°°°°°°°°°° http://www.m05.de
|
|
|
fry
|
Re: BApplet fullscreen modification
« Reply #24 on: Mar 23rd, 2004, 4:47pm » |
|
on Mar 23rd, 2004, 10:30am, TomC wrote: I'm not sure if there's a way to pull this out automatically, so that the same function will do for all sketches... |
| i haven't thought of a method yet.. it's difficult since main() is a static method, so you can't use getClass().getName(), but maybe there's another reflection api method. would most appreciate if anyone were to find a solution. for 'export to application', the little strip of main() code will just be inserted for you (like all the other magical things p5 does to your code to make it work as a real java program) but if there were a better way to do it..
|
|
|
|
cereals
|
Re: BApplet fullscreen modification
« Reply #26 on: May 31st, 2004, 1:24am » |
|
I know this has been talked about before but I seem to get this error on my win Box... Quote: Exception in thread "main" java.lang.NoSuchMethodError: swarm.beginVideo(III)V at followme_big.setup(followme_big.java:81) at BApplet.init(BApplet.java:185) at BAppletFS.main(BAppletFS.java:22) |
| any idea how i can get this to work? Specs. Java 1.4 Win XP using bat file to launch... everything seem to work fine until i want to use video...
|
|
|
|
cereals
|
Re: BApplet fullscreen modification
« Reply #27 on: May 31st, 2004, 1:40am » |
|
its ok... solved it... back to work.
|
|
|
|
fjen
|
Re: BApplet fullscreen modification
« Reply #28 on: Jul 11th, 2004, 7:05pm » |
|
hi all, changed michael's and tom's version since i had trouble (not to mention the java 1.4+ thing) with mouse action not being passed on to the applet and i wanted it to trigger quicktimeplayer to show movies in fullscreen mode which made the screen switch back and forth all the time. ... it's os-x only for the moment, sorry. code & example can be found here: www.florianjenett.de/p55/presentationmode.sit
|
|
|
|
bren
|
Re: BApplet fullscreen modification
« Reply #29 on: Jul 14th, 2004, 7:33pm » |
|
on May 31st, 2004, 1:40am, cereals wrote:its ok... solved it... back to work. |
| er... do you wanna tell us how you solved it I get the same error message: beginVideo(III)V Running Mac OS 10.3 Java 1.4.2
|
|
|
|
|