Change Point location in Java

Description

The following code shows how to change Point location.

Example


/*from   w  w w.  ja v a2  s. co m*/
import java.awt.Point;

class Main {

  public static void main(String[] arguments) {
    Point location = new Point(4, 13);

    System.out.println("Starting location:");
    System.out.println("X equals " + location.x);
    System.out.println("Y equals " + location.y);

    System.out.println("\nMoving to (7, 6)");
    location.x = 7;
    location.y = 6;

    System.out.println("\nEnding location:");
    System.out.println("X equals " + location.x);
    System.out.println("Y equals " + location.y);
  }
}




















Home »
  Java Tutorial »
    Graphics »




Animation
BufferedImage
Color
Font
Gradient
Graphics Settings
Image
Mouse Draw
Print
Shape
Text
Transform