|
Author |
Topic: os x p5 application (Read 1293 times) |
|
michael05
|
os x p5 application
« on: Jan 14th, 2004, 2:00am » |
|
this is a short tutorial how to make an os x application of your applet: the shell-command to launch an p5-applet in the sketchbook/projectname/applet folder is java -cp projectName.jar BApplet projectName theres an application in the os x developer tools called "jar bundler". - type in the Main Class "BApplet" in "Build Information" - "Arguments to Main" should contain the projectName - choose the jvm version (default 1.3.1) - add your projectName.jar in "Classpath and Files" to "Additional Files and Resources" - add "$JAVAROOT/projectName.jar" to the line "Additions to Clathpass" - click "Create Application" you can choose an icon, too. hope it works. michael05
|
°°°°°°°°°°°°°°°°°°°° http://www.m05.de
|
|
|
michael05
|
Re: os x p5 application
« Reply #1 on: Jan 14th, 2004, 1:39pm » |
|
i am trying to add a fullscreen option to the BApplet-class. ben fry posted the source code in an older thread. does this version still work? i get no errors but the applet does not start anymore. why do these lines not work anymore in eclipse? frame.setLocation((screen.width - applet.g.width) / 2, (screen.height - applet.g.height) / 2); there is a problem with 'applet.g' (cannot be resolved or is not a field). do i have to include something? this doe not work, too: frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); same error.. here is the sourcecode: ------------------------------------------------------------ import java.awt.*; import java.applet.*; public class BApplet extends Applet{ static public void main(String args[]) { if (args.length != 1) { System.err.println("error: BApplet <appletname>"); System.exit(1); } System.out.println("start"); try { Frame frame = new Frame(); Class c = Class.forName(args[0]); BApplet applet = (BApplet) c.newInstance(); applet.init(); applet.start(); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice (); GraphicsConfiguration gc = gd.getDefaultConfiguration(); frame.setLayout(new BorderLayout()); frame.add(applet, BorderLayout.CENTER); frame.pack(); if (gd.isFullScreenSupported()) { gd.setFullScreenWindow(frame); } if (gd.isDisplayChangeSupported()) { gd.setDisplayMode(new DisplayMode(640,480,16,0)); } frame.setLocation((screen.width - applet.g.width) / 2, (screen.height - applet.g.height) / 2); frame.show(); applet.requestFocus(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } }
|
°°°°°°°°°°°°°°°°°°°° http://www.m05.de
|
|
|
|