Asmo86 Posted October 2, 2004 Share Posted October 2, 2004 (edited) DelTree Edited October 5, 2004 by Asmo86 Link to comment Share on other sites More sharing options...
0 kjordan2001 Posted October 2, 2004 Share Posted October 2, 2004 What have you gotten done on it so far? Seems fairly straightforward except for the slightly poorly laid out instructions. Link to comment Share on other sites More sharing options...
0 cq_ Posted October 2, 2004 Share Posted October 2, 2004 except for the slightly poorly laid out instructions. i found those instructions pretty lame as well. of course I'm almost drunk. But at least I can type :) Link to comment Share on other sites More sharing options...
0 Asmo86 Posted October 2, 2004 Author Share Posted October 2, 2004 I have this so far import java.awt.*;import java.applet.*; /* * Created on Oct 1, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ /** * @author Isaak * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class Exercise4a extends Applet{ /* Applet description */ public void paint(Graphics graphics){ Point myPoint = new Point(); Door doorOne = new Door(); Door doorTwo = new Door(); Door doorThree = new Door(); doorOne.drawOne(graphics); doorTwo.drawTwo(graphics); doorThree.drawThree(graphics); } } In one class file and the following in another class file import java.awt.*; /* * Created on Oct 1, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ /** * @author Isaak * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class Door{ public Door(Point myPoint){ Point thePoint = new Point(); } public void drawOne(Graphics graphics){ //draw doorOne graphics.drawRect(10,10,10,10); } public void drawTwo(Graphics graphics){ //draw doorTwo graphics.drawRect(10,10,20,10); } public void drawThree(Graphics graphics){ //draw doorThree graphics.drawRect(10,10,30,10); } } I can get the boxes to draw but i can't get them to respond to the Point stuff :( Help would be Appreciated Link to comment Share on other sites More sharing options...
0 Asmo86 Posted October 2, 2004 Author Share Posted October 2, 2004 Bump Link to comment Share on other sites More sharing options...
0 kjordan2001 Posted October 3, 2004 Share Posted October 3, 2004 import java.awt.*; import java.applet.*; /* * Created on Oct 1, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ /** * @author Isaak * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class Exercise4a extends Applet{ /* Applet description */ public void paint(Graphics graphics){ //Point myPoint = new Point(); Point myPoint = new Point(1,2); Door doorOne = new Door(myPoint); Door doorTwo = new Door(myPoint); Door doorThree = new Door(myPoint); doorOne.drawOne(graphics); doorTwo.drawTwo(graphics); doorThree.drawThree(graphics); } } In one class file and the following in another class file import java.awt.*; /* * Created on Oct 1, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ /** * @author Isaak * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class Door{ Point thePoint; public Door(Point myPoint){ //Set thePoint } public void drawOne(Graphics graphics){ //draw doorOne //Draw rectangle with x and y set to x and y from thePoint } public void drawTwo(Graphics graphics){ //draw doorTwo //Draw rectangle with x and y set to x and y from thePoint } public void drawThree(Graphics graphics){ //draw doorThree //Draw rectangle with x and y set to x and y from thePoint } } Link to comment Share on other sites More sharing options...
0 Asmo86 Posted October 3, 2004 Author Share Posted October 3, 2004 this code gives me an error? I however am not sure what it means can someone please clarify java.lang.InstantiationException: Door load: Door.class can't be instantiated. at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) nvm i am retarded lol Link to comment Share on other sites More sharing options...
0 davemania Posted October 3, 2004 Share Posted October 3, 2004 is the error from your code or from Kjordan's sample ? Link to comment Share on other sites More sharing options...
Question
Asmo86
DelTree
Edited by Asmo86Link to comment
Share on other sites
7 answers to this question
Recommended Posts