Java tutorial
//package com.java2s; /* * This file is part of WebLookAndFeel library. * * WebLookAndFeel library is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * WebLookAndFeel library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with WebLookAndFeel library. If not, see <http://www.gnu.org/licenses/>. */ import java.awt.Color; import java.awt.Dimension; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; public class Main { /** * Returns dimension copy. * * @param dimension * dimension to copy * @return dimension copy */ public static Dimension copy(final Dimension dimension) { return new Dimension(dimension); } /** * Returns point copy. * * @param point * point to copy * @return point copy */ public static Point copy(final Point point) { return new Point(point); } /** * Returns rectangle copy. * * @param rectangle * rectangle to copy * @return rectangle copy */ public static Rectangle copy(final Rectangle rectangle) { return new Rectangle(rectangle); } /** * Returns insets copy. * * @param insets * insets to copy * @return insets copy */ public static Insets copy(final Insets insets) { return new Insets(insets.top, insets.left, insets.bottom, insets.right); } /** * Returns color copy. * * @param color * color to copy * @return color copy */ public static Color copy(final Color color) { return new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()); } }