DOC PREVIEW
GT LCC 6310 - Computation as an Expressive Medium

This preview shows page 1-2-3-4-5 out of 16 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Computation as an Expressive MediumYou are going to be sick of me.Hold up—what the heck is a .JAR?Let's add us some external codeAdding (uncompiled) external codeJava-mode gotchas!More Java-Mode GotchasEven More Java-Mode GotchasUsing Web crawling on CoursewareSlide 10Signing your jar fileSlide 12Slide 13Slide 14Viewing the jar fileEnd of SlidesComputation as an Computation as an Expressive MediumExpressive MediumLab 9: Java Mode, External Lab 9: Java Mode, External Code, and .JAR signingCode, and .JAR signingAnnie LausierAnnie LausierYou are going to be You are going to be sick of me.sick of me.Adding external code!Adding external code!Squirreled-away java-mode tips! Squirreled-away java-mode tips! .jar signing – not just for .jar signing – not just for pottery celebrities anymore!pottery celebrities anymore!Review of the code you didn't Review of the code you didn't finish!finish!Hold up—what the heck is a Hold up—what the heck is a .JAR?.JAR?A A .JAR.JAR file is a java applet. file is a java applet.When you write a When you write a sketchsketch in processing… in processing………it gets converted to a full-up it gets converted to a full-up .java.java file file(See this in the (See this in the Applet Applet folder! Read it! folder! Read it! Ponder!)Ponder!)the .java file gets compiled into a the .java file gets compiled into a .class.classthe .class gets compressed into a the .class gets compressed into a .jar.jarIn fact, if you change the extension from .jar In fact, if you change the extension from .jar to .zip,to .zip, you can unzip it and see the you can unzip it and see the original .class!!original .class!!Let's add us some Let's add us some external codeexternal codeYou've just downloaded a java You've just downloaded a java library off the amazing INTARWEB!library off the amazing INTARWEB!toastmaker.jartoastmaker.jarYou can do two things:You can do two things:Put it in Put it in ……or, put it intoor, put it into(which, like files in (which, like files in datadata, gets , gets exported)exported)processing-0091/libraries/toastmaker/library/toastmaker.jarprocessing-0091/libraries/toastmaker/library/toastmaker.jar<your sketch folder><your sketch folder>/code/toastmaker.jar/code/toastmaker.jarAdding (uncompiled) Adding (uncompiled) external codeexternal codeSee that arrow See that arrow on the left?on the left?Click it, and choose Click it, and choose Add Tab…Add Tab…Give the new file a name and it Give the new file a name and it adds adds another .pdeanother .pde in your sketch folder in your sketch folder……oror end the name with end the name with .java.java and it and it will add a full-up .java file in your will add a full-up .java file in your sketch foldersketch folder(Useful for when you have an (Useful for when you have an uncompiled .java classuncompiled .java class that you want to that you want to add to your project!)add to your project!)Java-mode gotchas!Java-mode gotchas!First of all, as you've found, you First of all, as you've found, you don't need to go into java mode to don't need to go into java mode to use the import statementuse the import statementIf you If you dodo decide to use java mode, decide to use java mode, you have to writeyou have to writepublicpublic class class Something Something extends extends PApplet {PApplet { … …This This publicpublic is important! And it is is important! And it is ONLY necessary on the ONLY necessary on the class … extends class … extends PAppletPAppletMore Java-Mode GotchasMore Java-Mode Gotchaspublic class happy extends PApplet { // global vars void setup(){ … } void draw(){ … } void othermethod(){ … } class something{ … }}class somethingelse { // fields somethingelse(){ … } void method(){ … } void totallyawesome(){ … }}happy.pdesomethingelse.pdeThe class code in The class code in somethingelse.pdesomethingelse.pdeGets Gets addedadded to the to the endend of the code of the code insideinside public public class happyclass happy before compiling before compilingDoes Does NOTNOT have a have a publicpublic in front of the class, in front of the class, that is, it's just plain that is, it's just plain class somethingelse {class somethingelse {Even More Java-Mode Even More Java-Mode GotchasGotchaspublic class happy extends PApplet { // global vars yetanother varname; void setup(){ … } void draw(){ … } class something{ … }}public class yetanother { // fields public static void main blah blah…}happy.pdeyetanother.javaThe class code in The class code in yetanother.javayetanother.javaCan be any standard java Can be any standard java .java file.java file, pretty , pretty muchmuchCan have Can have publicpublic wherever the heck it wants it… wherever the heck it wants it… (not true, but you get the picture)(not true, but you get the picture)Using Web crawling on Using Web crawling on CoursewareCoursewareSo…now you've seen that the code in So…now you've seen that the code in the Processing window the Processing window extends extends PAppletPApplet. You can view Applets on the . You can view Applets on the web, which is why they work (usually) web, which is why they work (usually) seamlessly with the Courseware.seamlessly with the Courseware.HOWEVER, browsers HOWEVER, browsers have security have security problemsproblems when a Java applet when a Java applet tries to tries to access other filesaccess other files at different at different sites.sites.Using Web crawling on Using Web crawling on CoursewareCoursewareFor instance, this call works both in For instance, this call works both in Processing and on the Courseware (provided Processing and on the Courseware (provided image1.jpgimage1.jpg is in your data directory): is in your data directory):PImage im = loadImage(“image1.jpg”);PImage im = loadImage(“image1.jpg”);But this call works But this call works onlyonly in the Processing in the Processing program, program, not onlinenot online::PImage im = PImage im = loadImage(“loadImage(“http://idt.gatech.edu/~mateas/imagehttp://idt.gatech.edu/~mateas/image1.jpg1.jpg”);”);Signing your jar fileSigning your jar fileTo allow browsers to control the security To allow browsers to control the security of your applet, you must sign it first.of your applet, you must sign it first.Two steps:Two steps:Create


View Full Document

GT LCC 6310 - Computation as an Expressive Medium

Documents in this Course
Load more
Download Computation as an Expressive Medium
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Computation as an Expressive Medium and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Computation as an Expressive Medium 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?