Java Rectangle formatRectangle(Rectangle rect)

Here you can find the source of formatRectangle(Rectangle rect)

Description

format Rectangle

License

Open Source License

Declaration

public static String formatRectangle(Rectangle rect) 

Method Source Code

//package com.java2s;
/*//www. j av  a 2 s.  c om
 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
 * Description:
 *
 */

import java.awt.Rectangle;
import java.text.MessageFormat;

public class Main {
    private static final MessageFormat RECTANGLE_FORMAT = new MessageFormat(
            "{0},{1},{2},{3}");

    public static String formatRectangle(Rectangle rect) {
        if (rect == null) {
            return "";
        }
        return RECTANGLE_FORMAT.format(new Object[] { rect.x, rect.y,
                rect.width, rect.height });
    }
}

Related

  1. expand(Rectangle rect, int amount)
  2. expand(Rectangle rectangle, int expansion)
  3. firstSmallerThanSecond(java.awt.Rectangle first, java.awt.Rectangle second)
  4. flip(Dimension view, Rectangle rect, int direction)
  5. formatRect(Rectangle rc)
  6. getAbsoluteRectangle(Rectangle rect)
  7. getFrameOrientations(Rectangle parent)
  8. getMaximalRectangle(Rectangle r1, Rectangle r2)
  9. getRect(byte[] data, int i)