當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。