Sets the size of this Dimension object to the specified width and height in double precision. Note that if width or height are larger than Integer.MAX_VALUE, they will be reset to Integer.MAX_VALUE.
setSize in class Dimension2D
width - the new width for the Dimension object
height - the new height for the Dimension object
Syntax:public void setSize(double width,
double height)
Example:import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Window;
public class GUI
static public void paintImmediately(JComponent component)
{
component.paintImmediately(0, 0, component.getWidth(),
component.getHeight());
}
static public void center(Window window)
{
center(window, new Rectangle(java.awt.Toolkit.getDefaultToolkit().getScreenSize()));
}
static public void center(Window window, Rectangle rect)
{
Dimension winSize = window.getSize();
int left = (rect.getSize().width - winSize.getSize().width) / 2 + rect.getLocation().x;
int top = (rect.getSize().height - winSize.getSize().height) / 2 + rect.getLocation().y;
window.setLocation(left, top);
}
}
License.
All information of this service is derived from the free sources and is provided solely in the form of quotations.
This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 253 / 159176757. Delta: 0.03620 с