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








Syntax

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

public void setLocation(double x,  double y)

Example

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

/*w w  w .ja v  a  2s .c  o m*/
import java.awt.Point;


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

The code above generates the following result.