当前位置: 首页>>代码示例>>Java>>正文


Java Dimension2D.setSize方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:15,代码来源:Table.java

示例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;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:14,代码来源:DimensionObjectDescription.java

示例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;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:14,代码来源:Dimension2DObjectDescription.java

示例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;
 	}
 }
 
开发者ID:mleoking,项目名称:PhET,代码行数:65,代码来源:AgingRock.java

示例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 );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:46,代码来源:InjectorNode.java


注:本文中的java.awt.geom.Dimension2D.setSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。