private void drawLimb(Graphics g, int x, int y, UserData user, JointType from, JointType to) { com.primesense.nite.SkeletonJoint fromJoint = user.getSkeleton().getJoint(from); com.primesense.nite.SkeletonJoint toJoint = user.getSkeleton().getJoint(to); if (fromJoint.getPositionConfidence() == 0.0 || toJoint.getPositionConfidence() == 0.0) { return; } com.primesense.nite.Point2D<Float> fromPos = mTracker.convertJointCoordinatesToDepth(fromJoint.getPosition()); com.primesense.nite.Point2D<Float> toPos = mTracker.convertJointCoordinatesToDepth(toJoint.getPosition()); // draw it in another color than the use color g.setColor(new Color(mColors[(user.getId() + 1) % mColors.length])); g.drawLine( x + fromPos.getX().intValue(), y + fromPos.getY().intValue(), x + toPos.getX().intValue(), y + toPos.getY().intValue()); }