07 Feb 2016
Customize and use BookClasses in eclipse
If you are familiar with eclipse and don’t want to use DrJava. Follow the below mentioned steps to setup eclipse environment to use same examples in eclipse.
- Download BookClasses from following link. http://home.cc.gatech.edu/TeaParty/47
- Once downloaded, unzip into a folder.
- Create new project in eclipse. I assume you are familiar with eclipse environment
- Include given folder in your source code
- Import External libraries in your project available in your bookclass folder. Libraries are listed below.
- AVIDemo.jar
- javazoom.jar
- jmf.jar
- You will get few errors, don’t worry just add appropriate package into your class
- Now run your first Multimedia program and enjoy.
import bookClasses.*; public class Example1 { public static void main(String[] args ){ String fileName = FileChooser.pickAFile(); Picture pictureObj = new Picture(fileName); int width = pictureObj.getWidth(); System.out.println("The picture width is " + width); int height = pictureObj.getHeight(); System.out.println("The picture height is " + height); Pixel[] pixelArray = pictureObj.getPixels(); System.out.println(pixelArray.length + " pixels"); System.out.println(pixelArray[500]); pictureObj.explore(); } }
Output :
The picture width is 214
The picture height is 236
50504 pixels
Pixel red=255 green=255 blue=255
No Responses