Java Swing Tutorial - Java Point.setLocation(int x, int y)








Syntax

Point.setLocation(int x, int y) has the following syntax.

public void setLocation(int x,  int y)

Example

In the following code shows how to use Point.setLocation(int x, int y) method.

//ww w .  j  av  a2s  .co  m
import java.awt.Point;


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

The code above generates the following result.