Results 1 to 5 of 5
Thread: Using an Instance method
- 12-06-2009, 09:32 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 11
- Rep Power
- 0
Using an Instance method
I have my constructor written, but I need to execute an Instance variable called reset() which will call the method reset and place a dot into the middle of a square.
Here is my constructor
/**
* Constructor for objects of class Dice
*/
public Dice(Square bg, Circle tL, Circle tM, Circle tR, Circle mid, Circle bL, Circle bM, Circle bR)
{
background = bg;
bg.setLength(75);
tL = topLeftSpot;
tM = topMiddleSpot;
tR = topRightSpot;
mid = middleSpot;
bL = bottomLeftSpot;
bM = bottomMiddleSpot;
bR = bottomRightSpot;
this.reset();
}
here is the instance method
public void reset()
{
this.getBackground().setXPos(0);
this.getTopLeftSpot().setXPos(3);
this.getTopLeftSpot().setYPos(3);
this.getTopMiddleSpot().setXPos(25);
this.getTopMiddleSpot().setYPos(3);
this.getTopRightSpot().setXPos(48);
this.getTopRightSpot().setYPos(3);
this.getMiddleSpot().setXPos(25);
this.getMiddleSpot().setYPos(25);
this.getBottomLeftSpot().setXPos(3);
this.getBottomLeftSpot().setYPos(48);
this.getBottomMiddleSpot().setXPos(25);
this.getBottomMiddleSpot().setYPos(48);
this.getBottomRightSpot().setXPos(48);
this.getBottomRightSpot().setYPos(48);
this.face1();
}
I can compile the class with out any errors but when I run it the square appears but the dot does not appear in the center like it should. I just can't get the reset to work. I'm sure its a simple fix but as I'm new to Java everything seems complicated
Thanks for any helpLast edited by Thumper; 12-06-2009 at 09:58 PM.
- 12-07-2009, 09:44 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
I wish you'd gone back to your old thread to say you'd fixed it. It's a little rude not to, you know.
And use code tags, please.
On the point of the topic...what does face1() do?
- 12-07-2009, 02:57 PM #3
Member
- Join Date
- Dec 2009
- Posts
- 11
- Rep Power
- 0
- 12-07-2009, 07:04 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
OK, well there's nothing in the code you've posted that tells us anything about what's going on, or what could be wrong.
- 12-09-2009, 06:43 PM #5
Member
- Join Date
- Dec 2009
- Posts
- 24
- Rep Power
- 0
Similar Threads
-
Accessing instance outside of creation method
By meringue in forum New To JavaReplies: 6Last Post: 03-22-2009, 01:36 AM -
[SOLVED] Non-synchronized instance method of an Object
By piyu.sha in forum Threads and SynchronizationReplies: 2Last Post: 10-06-2008, 06:35 AM -
public instance method
By steve123 in forum New To JavaReplies: 5Last Post: 06-20-2008, 08:45 PM -
Instantiation using an instance factory method
By Java Tip in forum Java TipReplies: 0Last Post: 03-29-2008, 12:35 PM -
Instantiation using an instance factory method
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 08:25 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks