The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Object connectivity?

Posted by Nam Hu on December 11, 2001 at 3:02 PM

I have written a subroutine, included in this message, that is supposed to extract an object out of a storage array, and then Put in onto the java GUI frame. The object itself already has the "label" aspect of it defined so it should, in theory, just have to be added, and specified as to where it will be on the screen. If you can see any errors please tell me.

public void setUserCards()
{
Player userPl = (Player)storePlayers[0];
int[] hand = new int[userPl.getHand().length];
int cardType;
int layer = 0;
Card manip;

for(int i = 0;i < 7;i++)
{
hand[i] = userPl.getHand()[i];
}

for(int i = 0;i < 7; i++)
{
cardType = hand[i];
manip = (Card)storeCards[cardType];

manip.setLayer(layer);
manip.setX(origin.x);
manip.setY(origin.y);
origin.x -= 15;
layer++;

manip.setBounds(manip.getXPosition(), manip.getYPosition(), 69, 98);
manip.addMouseListener(this);

user.add(manip, new Integer(manip.getLayer()));
}

frame.show();




Replies:
  • Answer Nam Hu December 11, 2001 at 5:46 PM (0)

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us