本文整理匯總了Java中java.awt.geom.Dimension2D.setSize方法的典型用法代碼示例。如果您正苦於以下問題:Java Dimension2D.setSize方法的具體用法?Java Dimension2D.setSize怎麽用?Java Dimension2D.setSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.geom.Dimension2D
的用法示例。
在下文中一共展示了Dimension2D.setSize方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: applyComlumnsSize
import java.awt.geom.Dimension2D; //導入方法依賴的package包/類
public void applyComlumnsSize(QBounds tableBound, Diagram diagram) {
double width = getMinWidth();
double w = width / columns.length;
double x = tableBound.getLocation().getX();
for (TableColumn tableColumn : columns) {
QBounds bounds = (QBounds) diagram.getBounds(tableColumn);
Dimension2D size = bounds.getSize();
size.setSize(w, size.getHeight());
bounds.setLocation(new Point2D.Double(x, getColumnYLocation(
tableBound, size)));
tableColumn.setWidth(w);
x += w;
}
}
示例2: createObject
import java.awt.geom.Dimension2D; //導入方法依賴的package包/類
/**
* Creates an object based on the description.
*
* @return The object.
*/
public Object createObject() {
final Dimension2D dim = new Dimension();
final float width = getFloatParameter("width");
final float height = getFloatParameter("height");
dim.setSize(width, height);
return dim;
}
示例3: createObject
import java.awt.geom.Dimension2D; //導入方法依賴的package包/類
/**
* Creates an object based on the description.
*
* @return The object.
*/
public Object createObject() {
final Dimension2D dim = new FloatDimension();
final float width = getFloatParameter("width");
final float height = getFloatParameter("height");
dim.setSize(width, height);
return dim;
}
示例4: animate
import java.awt.geom.Dimension2D; //導入方法依賴的package包/類
/**
* Implement the next steps in the animation of the rock based on a
* number of factors, such as its age, whether closure has occurred,
* etc.
*
* @param time
*/
private void animate(double time){
if (_flyCounter > 0){
// Move along the arc.
double flightXTranslation = FINAL_X_TRANSLATION / FLY_COUNT;
double flightYTranslation = (_flyCounter - (FLY_COUNT * 0.58)) * ARC_HEIGHT_FACTOR;
setPosition(getPosition().getX() + flightXTranslation, getPosition().getY() + flightYTranslation);
// Grow.
Dimension2D size = getSize();
size.setSize(size.getWidth() * _growthPerStep, size.getHeight() * _growthPerStep );
setSize(size);
// Rotate.
setRotationalAngle(getRotationalAngle() + ROTATION_PER_STEP);
// Move to the next step.
_flyCounter--;
}
else if (_flyCounter <= 0 && !_closurePossibleSent){
// The rock has landed, so it is now possible to force closure if
// desired.
setClosureState(RadiometricClosureState.CLOSURE_POSSIBLE);
_closurePossibleSent = true;
}
else if (_coolingStartPauseCounter > 0){
if (getClosureState() != RadiometricClosureState.CLOSED){
_coolingStartPauseCounter--;
}
else{
// Closure has been forced externally - skip the rest of this
// stage.
_coolingStartPauseCounter = 0;
_closureOccurredSent = true;
}
}
else if (_coolingCounter > 0){
if (getClosureState() != RadiometricClosureState.CLOSED){
setFadeFactor(Math.min(getFadeFactor() + (1 / (double)COOLING_STEPS), 1));
_coolingCounter--;
}
else {
// Closure has been forced externally - skip the rest of this
// stage.
setFadeFactor( 1 );
_coolingCounter = 0;
_closureOccurredSent = true;
}
}
else if (!_closureOccurredSent){
// The rock has finished cooling, so closure occurs and the rock
// begins radiometrically aging.
setClosureState(RadiometricClosureState.CLOSED);
_closureOccurredSent = true;
}
}
示例5: InjectorNode
import java.awt.geom.Dimension2D; //導入方法依賴的package包/類
public InjectorNode( double rotationAngle, final SimpleObserver inject ) {
this.inject = inject;
// Create the root node to which the various constituent parts can be
// added.
injectorNode = new PNode();
// Load the graphic images for this device. These are offset in order
// to make the center of rotation be the center of the bulb.
BufferedImage injectorBodyImage = RESOURCES.getImage( "squeezer_background.png" );
PNode injectorBodyImageNode = new PImage( injectorBodyImage );
Rectangle2D originalBodyBounds = injectorBodyImageNode.getFullBounds();
injectorBodyImageNode.setOffset( -originalBodyBounds.getWidth() / 2, -originalBodyBounds.getHeight() / 2 );
injectorNode.addChild( injectorBodyImageNode );
pressedButtonImage = RESOURCES.getImage( "button_pressed.png" );
unpressedButtonImage = RESOURCES.getImage( "button_unpressed.png" );
buttonImageNode = new PImage( unpressedButtonImage );
buttonImageNode.setOffset( BUTTON_OFFSET );
injectorNode.addChild( buttonImageNode );
// Rotate and scale the image node as a whole.
double scale = INJECTOR_HEIGHT / injectorBodyImageNode.getFullBoundsReference().height;
injectorNode.rotate( -rotationAngle );
injectorNode.scale( scale );
// Add the injector image node. Note that the position has to be
// tweaked in order to account for the rotation of the node image,
// since the rotation of the square image enlarges the bounds.
injectorNode.setOffset( -Math.abs( Math.sin( rotationAngle * 2 ) ) * 30, 0 );
addChild( injectorNode );
// Set up the injection point offset. This makes some assumptions
// about the nature of the image, and will need to be updated if the
// image is changed.
distanceCenterToTip = 0.7 * INJECTOR_HEIGHT;
final double centerOffsetX = 0.4 * INJECTOR_HEIGHT;
Dimension2D injectionPointOffset = new PDimension();
injectionPointOffset.setSize( distanceCenterToTip * Math.cos( rotationAngle ) + centerOffsetX,
distanceCenterToTip * Math.sin( -rotationAngle ) );
// Set up the button handling.
injectorBodyImageNode.setPickable( false );
buttonImageNode.setPickable( true );
}