Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-02-2008, 10:11 PM
Member
 
Join Date: Mar 2008
Posts: 8
CyberFrog is on a distinguished road
Classes in graphics
Hey,

Have been practising writing classes and having been used passing some parameters through a methd. Now, I am faced with graphics : (

How or what can I pass through in my main for each of the parameters I have defined i.e. Graphics page, int x, int y, int rad, Color color. Obviosuly I know that x, y and rad are intergers but not sure what to pass thru for a graphics page and how to pass thru a color??

Also, I have deliberatley not put a return type in my method but with my new instance in main I am not sure what type to use for the new circle object??

Code:
package Chapter4; import java.awt.*; // assumes java.awt.* is imported public class DrawCircle{ public DrawCircle(){ } public DrawCircle (Graphics page, int x, int y, int rad, Color color) { page.setColor(color); page.drawOval(x, y, rad, rad); } public static void main(String[]args){ DrawCircle circle = new DrawCircle(); newcircle = circle.drawcircle(4,4,4,blue);????? } }
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing classes in graphics CyberFrog Java Applets 2 04-05-2008 06:37 PM
Graphics Joe2003 Advanced Java 1 01-25-2008 07:24 PM
graphics Joe2003 Advanced Java 4 01-18-2008 08:44 PM
Graphics feniger New To Java 1 12-29-2007 05:22 PM
Updating Graphics Greedful Java 2D 2 07-20-2007 08:12 PM


All times are GMT +3. The time now is 11:12 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org