本文整理匯總了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);
}
示例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));
}
示例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 );
}
示例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;
}
示例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 );
}
示例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);
}
示例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() );
}
示例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);
}
}
}
}
示例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()));
}
示例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));
}
示例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));
}
示例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
}
示例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 );
}
示例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() );
}
示例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)
);
}