本文整理汇总了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 );
}
示例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;
}
示例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);
}