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


Java Dimension2D.getHeight方法代码示例

本文整理汇总了Java中java.awt.geom.Dimension2D.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Dimension2D.getHeight方法的具体用法?Java Dimension2D.getHeight怎么用?Java Dimension2D.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.Dimension2D的用法示例。


在下文中一共展示了Dimension2D.getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setFitZoom

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
public void setFitZoom(Dimension size) {
    Dimension2D pageSize = getPageSize();
    int pageCount = printable.getPageCount();
    if (pageCount == 0)
        return;
    double xy = (pageSize.getWidth() + W_SPACE)
            * (pageSize.getHeight() + W_SPACE) * (pageCount + 1);
    double mxy = size.getWidth() * size.getHeight();
    double zoom = Math.sqrt(mxy / xy);
    int columnCount = (int) (size.getWidth() / ((pageSize.getWidth() + W_SPACE
            / zoom) * zoom));
    if (columnCount <= 0)
        columnCount = 1;
    if (columnCount > pageCount)
        columnCount = pageCount;
    setup(columnCount, zoom);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:18,代码来源:PrintPreviewComponent.java

示例2: toImage

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
/** @return A MultiResolution image created from nsImagePtr, or null. */
private Image toImage() {
    if (ptr == 0) return null;

    final Dimension2D size = nativeGetNSImageSize(ptr);
    final int w = (int)size.getWidth();
    final int h = (int)size.getHeight();

    Dimension2D[] sizes
            = nativeGetNSImageRepresentationSizes(ptr,
                    size.getWidth(), size.getHeight());

    return sizes == null || sizes.length < 2 ?
            new MultiResolutionCachedImage(w, h, (width, height)
                    -> toImage(w, h, width, height))
            : new MultiResolutionCachedImage(w, h, sizes, (width, height)
                    -> toImage(w, h, width, height));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:CImage.java

示例3: FineCrosshairNode

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
/**
 * Constructor for a crosshair where horizontal and vertical dimensions can be different.
 *
 * @param size
 * @param stroke
 * @param strokePaint
 */
public FineCrosshairNode( Dimension2D size, Stroke stroke, Paint strokePaint ) {
    super();
    setPickable( false );
    setChildrenPickable( false );

    PPath hPath = new PPath( new Line2D.Double( -size.getWidth() / 2, 0, size.getWidth() / 2, 0 ) );
    hPath.setStrokePaint( strokePaint );
    hPath.setStroke( stroke );
    addChild( hPath );

    PPath vPath = new PPath( new Line2D.Double( 0, -size.getHeight() / 2, 0, size.getHeight() / 2 ) );
    vPath.setStrokePaint( strokePaint );
    vPath.setStroke( stroke );
    addChild( vPath );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:FineCrosshairNode.java

示例4: buildEllipse

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
/**
 * Builds an ellipse shape.
 * 
 * @return the ellipse or null if its size is not specified
 */
protected Shape buildEllipse()
{
	Ellipse2D ellipse = null;
	Dimension2D size = getSize();
	if (size != null)
	{
		Point offset = getOffset(size);
		ellipse = 
			new Ellipse2D.Float(
				-offset.getX(), 
				-offset.getY(), 
				(float)size.getWidth(), 
				(float)size.getHeight()
				);
	}
	return ellipse;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:AbstractShapeCustomizer.java

示例5: ProbeNode

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
public ProbeNode( Dimension2D size, Color color, String label, Color labelColor ) {

            PPath pathNode = new PPath( new Rectangle2D.Double( -size.getWidth() / 2, -size.getHeight(), size.getWidth(), Math.abs( size.getHeight() ) ) );
            pathNode.setStroke( PROBE_STROKE );
            pathNode.setStrokePaint( PROBE_STROKE_COLOR );
            pathNode.setPaint( color );
            addChild( pathNode );

            PText labelNode = new PText( label );
            labelNode.setTextPaint( labelColor );
            labelNode.setFont( PROBE_LABEL_FONT );
            addChild( labelNode );

            double x = pathNode.getFullBoundsReference().getCenterX() - ( labelNode.getFullBoundsReference().getWidth() / 2 );
            double y = pathNode.getFullBoundsReference().getMaxY() - labelNode.getFullBoundsReference().getHeight() - 3;
            labelNode.setOffset( x, y );
        }
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:ConductivityTesterNode.java

示例6: setGraphicsNode

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
public void setGraphicsNode(GraphicsNode gn, boolean createDispatcher) {
    Dimension2D dim = bridgeContext.getDocumentSize();
    Dimension   mySz = new Dimension((int)dim.getWidth(),
                                     (int)dim.getHeight());
    JSVGComponent.this.setMySize(mySz);
    SVGSVGElement elt = svgDocument.getRootElement();
    prevComponentSize = getSize();
    AffineTransform at = calculateViewingTransform
        (fragmentIdentifier, elt);
    CanvasGraphicsNode cgn = getCanvasGraphicsNode(gn);
    if (cgn != null) {
        cgn.setViewingTransform(at);
    }
    viewingTransform = null;
    initialTransform = new AffineTransform();
    setRenderingTransform(initialTransform, false);
    jsvgComponentListener.updateMatrix(initialTransform);
    addJGVTComponentListener(jsvgComponentListener);
    addComponentListener(jsvgComponentListener);
    super.setGraphicsNode(gn, createDispatcher);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:22,代码来源:JSVGComponent.java

示例7: updateLayout

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
protected void updateLayout() {

        Dimension2D worldSize = getWorldSize();
        if ( worldSize.getWidth() <= 0 || worldSize.getHeight() <= 0 ) {
            // canvas hasn't been sized, blow off layout
            return;
        }
        else if ( EatingAndExerciseConstants.DEBUG_CANVAS_UPDATE_LAYOUT ) {
            System.out.println( "PhysicsCanvas.updateLayout worldSize=" + worldSize );//XXX
        }

        humanControlPanelPSwing.setOffset( 0, getHeight() - humanControlPanelPSwing.getFullBounds().getHeight() );
        ageRangeMessage.setOffset( humanControlPanelPSwing.getFullBounds().getMaxX(), humanControlPanelPSwing.getFullBounds().getY() + humanControlPanel.getAgeSliderY() );
        starvingMessage.setOffset( humanAreaNode.getGlobalFullBounds().getCenterX() - starvingMessage.getFullBounds().getWidth() / 2, humanAreaNode.getGlobalFullBounds().getCenterY() );
        heartAttackMessage.setOffset( starvingMessage.getFullBounds().getX(), starvingMessage.getFullBounds().getMaxY() );
        updateHealthIndicatorLocation();

        caloriePanel.setOffset( humanControlPanelPSwing.getFullBounds().getWidth(), 0 );
        playAreaBackgroundNode.setPathToRectangle( 0, 0, (float) humanControlPanelPSwing.getFullBounds().getWidth(), getHeight() );
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:EatingAndExerciseCanvas.java

示例8: updateAutoSize

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
/**
 * Overwritten to freeze nodes to their center on
 * size changes.
 */
@Override
public void updateAutoSize(CellView view) {
    if (view != null && !isEditing()) {
        Rectangle2D bounds =
            (view.getAttributes() != null) ? GraphConstants.getBounds(view.getAttributes())
                : null;
        AttributeMap attrs = getModel().getAttributes(view.getCell());
        if (bounds == null) {
            bounds = GraphConstants.getBounds(attrs);
        }
        if (bounds != null) {
            boolean autosize = GraphConstants.isAutoSize(view.getAllAttributes());
            boolean resize = GraphConstants.isResize(view.getAllAttributes());
            if (autosize || resize) {
                Dimension2D d = getPreferredSize(view);
                int inset = 2 * GraphConstants.getInset(view.getAllAttributes());
                // adjust the x,y corner so that the center stays in place
                double shiftX = (bounds.getWidth() - d.getWidth() - inset) / 2;
                double shiftY = (bounds.getHeight() - d.getHeight() - inset) / 2;
                bounds.setFrame(bounds.getX() + shiftX, bounds.getY() + shiftY, d.getWidth(),
                    d.getHeight());
                // Remove resize attribute
                snap(bounds);
                if (resize) {
                    if (view.getAttributes() != null) {
                        view.getAttributes().remove(GraphConstants.RESIZE);
                    }
                    attrs.remove(GraphConstants.RESIZE);
                }
                view.refresh(getGraphLayoutCache(), getGraphLayoutCache(), false);
            }
        }
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:39,代码来源:JGraph.java

示例9: newInstance

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
/**
 * Factory method to construct a new nod layout out of an attribute map.
 * Parameters not provided in the attribute map receive a default value.
 * @param visuals the visual attribute map
 * @return a new node layout based on <code>jAttr</code>
 */
static public JVertexLayout newInstance(VisualMap visuals) {
    Dimension2D size = visuals.getNodeSize();
    Point2D pos = visuals.getNodePos();
    return new JVertexLayout(new Rectangle2D.Double(pos.getX() - size.getWidth() / 2,
        pos.getY() - size.getHeight() / 2, size.getWidth(), size.getHeight()));
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:13,代码来源:JVertexLayout.java

示例10: toImage

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
/** @return A MultiResolution image created from nsImagePtr, or null. */
private Image toImage() {
    if (ptr == 0) {
        return null;
    }

    AtomicReference<Dimension2D> sizeRef = new AtomicReference<>();
    execute(ptr -> {
        sizeRef.set(nativeGetNSImageSize(ptr));
    });
    final Dimension2D size = sizeRef.get();
    if (size == null) {
        return null;
    }
    final int w = (int)size.getWidth();
    final int h = (int)size.getHeight();
    AtomicReference<Dimension2D[]> repRef = new AtomicReference<>();
    execute(ptr -> {
        repRef.set(nativeGetNSImageRepresentationSizes(ptr, size.getWidth(),
                                                       size.getHeight()));
    });
    Dimension2D[] sizes = repRef.get();

    return sizes == null || sizes.length < 2 ?
            new MultiResolutionCachedImage(w, h, (width, height)
                    -> toImage(w, h, width, height))
            : new MultiResolutionCachedImage(w, h, sizes, (width, height)
                    -> toImage(w, h, width, height));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:CImage.java

示例11: setParameterFromObject

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
/**
 * Sets the parameters of this description object to match the supplied object.
 *
 * @param o  the object (should be an instance of <code>Dimension2D</code>).
 *
 * @throws ObjectFactoryException if the object is not an instance of <code>Point2D</code>.
 */
public void setParameterFromObject(final Object o) throws ObjectFactoryException {
    if (!(o instanceof Dimension2D)) {
        throw new ObjectFactoryException("The given object is no java.awt.geom.Dimension2D.");
    }

    final Dimension2D dim = (Dimension2D) o;
    final float width = (float) dim.getWidth();
    final float height = (float) dim.getHeight();

    setParameter("width", new Float(width));
    setParameter("height", new Float(height));
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:20,代码来源:Dimension2DObjectDescription.java

示例12: updateLayout

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
protected void updateLayout() {

        Dimension2D worldSize = getWorldSize();
        if ( worldSize.getWidth() <= 0 || worldSize.getHeight() <= 0 ) {
            // canvas hasn't been sized, blow off layout
            return;
        }
        else if ( TitrationConstants.DEBUG_CANVAS_UPDATE_LAYOUT ) {
            System.out.println( "TitrateCanvas.updateLayout worldSize=" + worldSize );//XXX
        }
        
        //XXX lay out nodes
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:14,代码来源:AdvancedCanvas.java

示例13: createRandomShape

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
public static Shape createRandomShape( Dimension2D size, int seed ) {
    Random rand = new Random( seed );
    List<Point2D> pointList = new ArrayList<Point2D>();
    // Create a series of points that will enclose a space.
    for ( double angle = 0; angle < 1.9 * Math.PI; angle += Math.PI / 10 + rand.nextDouble() * Math.PI / 10 ) {
        pointList.add( Vector2D.createPolar( 0.5 + rand.nextDouble(), angle ).toPoint2D() );
    }

    Shape unscaledShape = createRandomShapeFromPoints( pointList, seed );

    // Scale the shape to the specified size.
    double horizontalScale = size.getWidth() / unscaledShape.getBounds2D().getWidth();
    double verticalScale = size.getHeight() / unscaledShape.getBounds2D().getHeight();
    return AffineTransform.getScaleInstance( horizontalScale, verticalScale ).createTransformedShape( unscaledShape );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:BioShapeUtils.java

示例14: updateReturnBeadButtonVisibility

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
/**
 * Makes the "Return Bead" button visible if the bead is not visible on the canvas.
 */
private void updateReturnBeadButtonVisibility() {

    Dimension2D worldSize = getWorldSize();
    Rectangle2D worldBounds = new Rectangle2D.Double( 0, 0, worldSize.getWidth(), worldSize.getHeight() );
    Rectangle2D beadBounds = _beadNode.getFullBoundsReference();

    // Note: using intersects is a bit imprecise, since the bead is a circle
    _returnBeadButtonWrapper.setVisible( !worldBounds.intersects( beadBounds ) );
    _returnBeadButtonWrapper.setPickable( _returnBeadButtonWrapper.getVisible() );
    _returnBeadButtonWrapper.setChildrenPickable( _returnBeadButtonWrapper.getVisible() );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:15,代码来源:PhysicsCanvas.java

示例15: getOffset

import java.awt.geom.Dimension2D; //导入方法依赖的package包/类
@Override
protected Point getOffset(Dimension2D size)
{
	return
		new Point(
			(int)(size.getWidth() / 2),
			(int)(size.getHeight() / 2)
			);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:10,代码来源:LineDotShapeCustomizer.java


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