Web Hosting Tomcat, Java, JSP, Servlets, J2EE, PHP, MySQL

Cheap web hosting provider

28
Sep

Black Art of Java Game Programming by Joel

Black Art of Java Game Programming by Joel Fan Sams, Macmillan Computer Publishing ISBN: 1571690433 Pub Date: 11/01/96 Previous Table of Contents Next Creating Graphics Graphics operations are performed by a Graphics object (also known as a Graphics context). Graphics is a class that s defined in the package java.awt. Every applet has a Graphics object associated with it that addresses the screen real estate allocated for the applet. For example, the Graphics object of the applet from the preceding section paints to a rectangle that s 113 pixels wide and 117 pixels high. Figure 1-14 illustrates the coordinate system that s used by the Graphics object. Figure 1-14 Coordinate system of Graphics object Now let s look at some instance methods that java.awt.Graphics provides. Drawing drawLine(int x1, int y1, int x2, int y2) draws a line between (x1,y1) and (x2,y2). To draw a single point, use drawLine(x,y,x,y). drawRect(int x,int y,int w,int h) draws a rectangle at (x,y) with width w and height h. drawOval(int x, int y,int w,int h) draws an oval inside the rectangle at (x,y) with width w and height h. Filling fillRect(int x,int y,int w,int h) fills a rectangle with the specified dimensions. fillOval(int x,int y,int w,int h) fills an oval with the specified dimensions. Color setColor(Color c) sets the current Color of the Graphics object. Subsequent graphics
Note: If you are looking for cheap and quality provider to host and run your java application check Astra java hosting services

Comments are closed.

Home | About Us | Compare Plans | Standard Hosting | Business Hosting | Java Tomcat Hosting | Support | FAQ | Order Now!

Powered by Omnicus java hosting services. All rights reserved.
Entries (RSS) and Comments (RSS).