How to use API doc(demo) to create s square rectangle?

来源:互联网 发布:传奇源码完整版 编辑:程序博客网 时间:2024/06/01 10:27
// Rectangle(Dimension d) // Constructs a new Rectangle whose top left corner is (0, 0) // and whose width and height are specified by the Dimension argument.// Dimension(Dimension d) // Creates an instance of Dimension whose width and height // are the same as for the specified dimensionimport java.awt.Dimension;import java.awt.Rectangle;public class TestJava {    public static void main(String[] args) {        Dimension d = new Dimension(100, 100);        Rectangle square = new Rectangle(d);        System.out.println(square);    }}

0 0
原创粉丝点击