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


Java Polygon.getBounds方法代码示例

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


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

示例1: paintInterior

import java.awt.Polygon; //导入方法依赖的package包/类
public void paintInterior(Graphics g, Component c) {
    NimbusEditorTabCellRenderer ren = (NimbusEditorTabCellRenderer) c;
    Polygon p = getInteriorPolygon(c);

    Rectangle bounds = p.getBounds();
    int yDiff = getHeightDifference(ren);
    paintTabBackground(g, 0, c, bounds.x, bounds.y + yDiff, 
            bounds.width, bounds.height - yDiff);
    
    if (!supportsCloseButton((JComponent)c)) {
        return;
    }
    
    paintCloseButton( g, (JComponent)c );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:NimbusEditorTabCellRenderer.java

示例2: translatePointsToRealSize

import java.awt.Polygon; //导入方法依赖的package包/类
private SelectionShape translatePointsToRealSize(SelectionShape selectionPoint)
{
	float resultH = (float) this.glitchArt.realHeight / this.glitchArt.lblImageRender.getHeight();
	float resultW = (float) this.glitchArt.realWidth / this.glitchArt.lblImageRender.getWidth();
	if(selectionPoint.getSelectionType() == SelectionTypes.FREEHAND && selectionPoint.isFreeHandSelectionConnected())
	{
		for(Point freeHandPoint: selectionPoint.getFreeHandSelectionPointList())
		{
			selectionPoint.addTranslatedFreeHandPoint(new Point(Math.round(freeHandPoint.x * resultW), Math.round(freeHandPoint.y * resultH)));
		}
		Polygon polygon = getPolygonFromPoints(selectionPoint.getFreeHandTranslatedSelectionPointList());
		Rectangle boundedRegion = polygon.getBounds();
		
		if(boundedRegion.height > this.glitchArt.realHeight - 1)
		{
			boundedRegion.height = this.glitchArt.realHeight - 1;
		}
		
		if(boundedRegion.y < 0) 
		{
			boundedRegion.y = 0;
		}
		selectionPoint.setTranslatedRectangle(boundedRegion);
		selectionPoint.setTranslatedPolygon(polygon);
	}
	else if(selectionPoint.getSelectionType() == SelectionTypes.RECTANGLE)
	{
		Point startPoint = new Point(Math.round(selectionPoint.getStartPoint().x * resultW), Math.round(selectionPoint.getStartPoint().y * resultW));
		Point endPoint = new Point(Math.round(selectionPoint.getEndPoint().x * resultH), Math.round(selectionPoint.getEndPoint().y * resultH));
		Rectangle selectionRectangle= new Rectangle(startPoint);
		selectionRectangle.add(endPoint);
		selectionPoint.setTranslatedRectangle(selectionRectangle);
	}
	return selectionPoint;
}
 
开发者ID:scriptkittie,项目名称:GlitchKernel,代码行数:36,代码来源:SelectionManager.java

示例3: paint

import java.awt.Polygon; //导入方法依赖的package包/类
public void paint(Polygon shape, Graphics g, Color color, int side) {
    Rectangle r = shape.getBounds();
    int length = Math.max(r.height / 3, 1);
    int[] lengthPattern = { length, length };
    Color[] colorPattern = { color, null };
    paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:CSSBorder.java


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