Java Swing Tutorial - Java Point.setLocation(Point p)








Syntax

Point.setLocation(Point p) has the following syntax.

public void setLocation(Point p)

Example

In the following code shows how to use Point.setLocation(Point p) method.

//from   w w  w  . jav  a 2s . c om
import java.awt.Point;


public class Main {
  public static void main(String[] args) {
    Point p = new Point();
    
    p.setLocation(new Point(2,3));
    System.out.println(p.toString());
  }
}

The code above generates the following result.