本文整理汇总了Java中java.awt.Dimension.clone方法的典型用法代码示例。如果您正苦于以下问题:Java Dimension.clone方法的具体用法?Java Dimension.clone怎么用?Java Dimension.clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Dimension
的用法示例。
在下文中一共展示了Dimension.clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSourceRenderSize
import java.awt.Dimension; //导入方法依赖的package包/类
/**
* If the image is able to be rendered at an arbitrary size, sets
* the source width and height to the supplied values. Note that
* the values returned from the <code>getWidth</code> and
* <code>getHeight</code> methods on <code>ImageReader</code> are
* not affected by this method; they will continue to return the
* default size for the image. Similarly, if the image is also
* tiled the tile width and height are given in terms of the default
* size.
*
* <p> Typically, the width and height should be chosen such that
* the ratio of width to height closely approximates the aspect
* ratio of the image, as returned from
* <code>ImageReader.getAspectRatio</code>.
*
* <p> If this plug-in does not allow the rendering size to be
* set, an <code>UnsupportedOperationException</code> will be
* thrown.
*
* <p> To remove the render size setting, pass in a value of
* <code>null</code> for <code>size</code>.
*
* @param size a <code>Dimension</code> indicating the desired
* width and height.
*
* @exception IllegalArgumentException if either the width or the
* height is negative or 0.
* @exception UnsupportedOperationException if image resizing
* is not supported by this plug-in.
*
* @see #getSourceRenderSize
* @see ImageReader#getWidth
* @see ImageReader#getHeight
* @see ImageReader#getAspectRatio
*/
public void setSourceRenderSize(Dimension size)
throws UnsupportedOperationException {
if (!canSetSourceRenderSize()) {
throw new UnsupportedOperationException
("Can't set source render size!");
}
if (size == null) {
this.sourceRenderSize = null;
} else {
if (size.width <= 0 || size.height <= 0) {
throw new IllegalArgumentException("width or height <= 0!");
}
this.sourceRenderSize = (Dimension)size.clone();
}
}
示例2: setSourceRenderSize
import java.awt.Dimension; //导入方法依赖的package包/类
/**
* If the image is able to be rendered at an arbitrary size, sets
* the source width and height to the supplied values. Note that
* the values returned from the {@code getWidth} and
* {@code getHeight} methods on {@code ImageReader} are
* not affected by this method; they will continue to return the
* default size for the image. Similarly, if the image is also
* tiled the tile width and height are given in terms of the default
* size.
*
* <p> Typically, the width and height should be chosen such that
* the ratio of width to height closely approximates the aspect
* ratio of the image, as returned from
* {@code ImageReader.getAspectRatio}.
*
* <p> If this plug-in does not allow the rendering size to be
* set, an {@code UnsupportedOperationException} will be
* thrown.
*
* <p> To remove the render size setting, pass in a value of
* {@code null} for {@code size}.
*
* @param size a {@code Dimension} indicating the desired
* width and height.
*
* @exception IllegalArgumentException if either the width or the
* height is negative or 0.
* @exception UnsupportedOperationException if image resizing
* is not supported by this plug-in.
*
* @see #getSourceRenderSize
* @see ImageReader#getWidth
* @see ImageReader#getHeight
* @see ImageReader#getAspectRatio
*/
public void setSourceRenderSize(Dimension size)
throws UnsupportedOperationException {
if (!canSetSourceRenderSize()) {
throw new UnsupportedOperationException
("Can't set source render size!");
}
if (size == null) {
this.sourceRenderSize = null;
} else {
if (size.width <= 0 || size.height <= 0) {
throw new IllegalArgumentException("width or height <= 0!");
}
this.sourceRenderSize = (Dimension)size.clone();
}
}