Upload
randall-hart
View
215
Download
1
Embed Size (px)
Citation preview
Serialization
Allows you to turn Java Objects into serial data that can be either save to a file or sent over a network.
Usefull for persisting data.
Serialization Syntax
FileOutputStream filOut = new FileOutputStream("gamestate.ser"); ObjectOutputStream out = new ObjectOutputStream(filOut); out.writeObject(gst); out.close(); filOut.close();
Deserialization Syntax
FileInputStream filIn = new FileInputStream("gamestate.ser"); ObjectInputStream ois = new
ObjectInputStream(filIn); gst= (GameState) ois.readObject(); ois.close(); filIn.close();
Ant Build Tool
Ant is integrated into Eclipse
Ant allows you to build, copy files, deploy files, generate jar files, etc.
Ant exe-JAR
1/ right-click your project in eclipse project- or package-explorer and select Export
2/ Select the AntBuildfiles from the General directory
3/ accept the defaults, and make sure both check boxes are selected.
4/ Select Window || Show View || Ant5/ drag your build.xml file into the Ant view. 6/ open up the build.xml file in the editor
Ant exe-JAR
7/ add the below target (next slide) within the enclosing <project> </project> tags
8/ save the build.xml. click on the jar target in the Ant view and click run
9/ refresh your project by clicking F5 and you will see the generated executable jar.
SwingWorkerSwingWorker takes two Object parameters.
+The first is the return value and is passed to done()+The second parameter is the progress value and is
passed to publish/process.
Example: SwingWorker<Boolean, Integer>
There are three important methods of SwingWorker.+doInBackGround() --background thread+process() -main UI thread+done() -main UI thread