Code example for Display

Methods: getHeight, getWidth

0
                .addPointer(0, p1.x, p1.y)
                .setIntermediateNote(false)); 
    } 
 
    private PointF randomPoint(Random random, Display display) {
        return new PointF(random.nextInt(display.getWidth()), random.nextInt(display.getHeight()));
    } 
 
    private PointF randomVector(Random random) {
        return new PointF((random.nextFloat() - 0.5f) * 50, (random.nextFloat() - 0.5f) * 50);
    } 
 
    private void randomWalk(Random random, Display display, PointF point, PointF vector) {
        point.x = (float) Math.max(Math.min(point.x + random.nextFloat() * vector.x,
                display.getWidth()), 0);
        point.y = (float) Math.max(Math.min(point.y + random.nextFloat() * vector.y,
                display.getHeight()), 0);
    } 
 
    /** 
     * Generates a random trackball event. This consists of a sequence of small moves, followed by