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