當前位置: 首頁>>代碼示例>>Java>>正文


Java RoundRectangle2D.Float方法代碼示例

本文整理匯總了Java中java.awt.geom.RoundRectangle2D.Float方法的典型用法代碼示例。如果您正苦於以下問題:Java RoundRectangle2D.Float方法的具體用法?Java RoundRectangle2D.Float怎麽用?Java RoundRectangle2D.Float使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.geom.RoundRectangle2D的用法示例。


在下文中一共展示了RoundRectangle2D.Float方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: installFocusListener

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
/**
 * <pre>
 * 初始化邊框焦點監聽器
 *
 * Initializes the border focus listener
 * <pre>
 *
 * @param c
 */
protected void installFocusListener(JComponent c)
{
    handle = new LuckComboboxFocusHandle();

    isFocusBorder = UIManager.getBoolean(LuckComboBoxUIBundle.ISFOCUSBORDER);

    if (isFocusBorder)
    {
        contentShape = new RoundRectangle2D.Float(0, 0, 0, 0, 8, 8);

        borderShape = new RoundRectangle2D.Float(0, 0, 0, 0, 8, 8);

        c.addMouseListener(handle);

        c.addFocusListener(handle);
    }
}
 
開發者ID:freeseawind,項目名稱:littleluck,代碼行數:27,代碼來源:LuckComboBoxUI.java

示例2: TipNode

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
public TipNode() {
    super();
    
    // rounded corners at top
    Shape roundRect = new RoundRectangle2D.Float( 0f, 0f, 1f, 1.5f, 0.4f, 0.4f );
    
    // mask out rounded corners at bottom
    Shape rect = new Rectangle2D.Float( 0f, 0.5f, 1f, 1f );
    
    // point at the bottom
    GeneralPath triangle = new GeneralPath();
    triangle.moveTo( 0f, 1.5f );
    triangle.lineTo( 0.5f, 2.5f );
    triangle.lineTo( 1f, 1.5f );
    triangle.closePath();
    
    // constructive area geometry
    Area area = new Area( roundRect );
    area.add( new Area( rect ) );
    area.add( new Area( triangle ) );
    
    setPathTo( area );
    setPaint( TIP_COLOR );
    setStroke( null );
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:26,代碼來源:ProbeNode.java

示例3: readObject

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
private void readObject(ObjectInputStream in) throws IOException
{
    x = in.readFloat();
    y = in.readFloat();
    width = in.readFloat();
    height = in.readFloat();
    rx = in.readFloat();
    ry = in.readFloat();

    if (rx == 0f && ry == 0f)
    {
        rect = new Rectangle2D.Float(x, y, width, height);
    } else
    {
        rect = new RoundRectangle2D.Float(x, y, width, height, rx * 2, ry * 2);
    }
}
 
開發者ID:Longri,項目名稱:cachebox3.0,代碼行數:18,代碼來源:Rect.java

示例4: paint

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
public void paint(Graphics2D g, int x, int y, int width, int height) {
	g.setRenderingHints( Thumbnail.qualityHints );
	Shape outer, inner;
	g.setColor(color);
	if(innerCurvature>0 || outerCurvature>0) {
		outer = new RoundRectangle2D.Float(x, y, width, height, outerCurvature, outerCurvature);
		inner = new RoundRectangle2D.Float(x + thickness, y + thickness, width - thickness*2, height - thickness*2, innerCurvature, innerCurvature);
	} else {
		outer = new Rectangle(x, y, width, height);
		inner = new Rectangle(x + thickness, y + thickness, width - thickness*2, height - thickness*2);
	}
	
	AffineTransform tx = g.getTransform();
	if(tx.getShearX()==0 && tx.getShearY()==0) {
		//this should be faster, but produces pixelated artifacts when rotated
		GeneralPath path = new GeneralPath( GeneralPath.WIND_EVEN_ODD );
		path.append(outer, false);
		path.append(inner, false);
		g.fill(path);
	} else {
		Area area = new Area(outer);
		area.subtract(new Area(inner));
		g.fill(area);
	}
}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:26,代碼來源:BasicThumbnail.java

示例5: paintBorder

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
	Graphics2D g2d = (Graphics2D) g.create();
	g2d.setRenderingHints(ProcessDrawer.HI_QUALITY_HINTS);
	g2d.setStroke(new BasicStroke(2f));

	// clear edges, otherwise they will be in the color of the component background
	if (drawRoundFrame && !c.getBackground().equals(c.getParent().getBackground())) {
		Shape frame = new Rectangle2D.Float(x + 2, y + 2, width - 4, height - 4);
		g2d.setPaint(c.getParent().getBackground());
		g2d.draw(frame);
	}

	g2d.setPaint(paint);
	g2d.setFont(new Font("Dialog", Font.BOLD, 21));

	if (drawRoundFrame) {
		Shape roundFrame = new RoundRectangle2D.Float(x + 2, y + 2, width - 4, height - 4, 10, 10);
		g2d.draw(roundFrame);
	}

	if (number > 0) {
		Shape circle = new Ellipse2D.Float(20, 20, 34, 34);
		g2d.fill(circle);
		g2d.setPaint(Color.WHITE);
		g2d.drawString(String.valueOf(number), 29, 44);
	}

	if (key != null) {
		g2d.setPaint(paint);
		g2d.drawString(key, 60, 44);
	}

	g2d.dispose();
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:36,代碼來源:RoundTitledBorder.java

示例6: insertImage

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
/**
 * 插入LOGO
 *
 * @param size         二維碼尺寸
 * @param source       二維碼圖片
 * @param logoPath     LOGO圖片地址
 * @param needCompress 是否壓縮
 * @throws Exception
 */
private static void insertImage(int size, BufferedImage source, String logoPath, boolean needCompress) throws Exception {
	int logoWidth = size / 5; //設置logo圖片寬度為二維碼圖片的五分之一
	int logoHeight = size / 5; //設置logo圖片高度為二維碼圖片的五分之一

	Image src = ImageIO.read(new URL(logoPath));
	int width = src.getWidth(null);
	int height = src.getHeight(null);
	if (needCompress) { // 壓縮LOGO
		if (width > logoWidth) {
			width = logoWidth;
		}
		if (height > logoHeight) {
			height = logoHeight;
		}
		Image image = src.getScaledInstance(width, height, Image.SCALE_SMOOTH);
		BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
		Graphics g = tag.getGraphics();
		g.drawImage(image, 0, 0, null); // 繪製縮小後的圖
		g.dispose();
		src = image;
	}
	// 插入LOGO
	Graphics2D graph = source.createGraphics();
	int x = (size - width) / 2;
	int y = (size - height) / 2;
	graph.drawImage(src, x, y, width, height, null);
	Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
	graph.setStroke(new BasicStroke(3f));
	graph.draw(shape);
	graph.dispose();
}
 
開發者ID:funtl,項目名稱:framework,代碼行數:41,代碼來源:QRCodeUtils.java

示例7: renderLexiconMarker

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
private void renderLexiconMarker(ViwnNodeSynset node, Point2D.Float pos,
                                 GraphicsDecorator g) {

    Shape lexicon = new Area(new RoundRectangle2D.Float(pos.x - 40, pos.y - 17, 23, 10, 12.5f, 5));
    g.setColor(ViwnNodeSynset.PosBgColors.get(node.getPos()));
    g.fillRoundRect(Math.round(pos.x - 40), Math.round(pos.y - 17), 23, 10, 12, 5);
    g.setColor(Color.black);
    g.draw(lexicon);
    Font smallFont = new Font("Tahoma", Font.BOLD, 6);
    g.setFont(smallFont);
    g.drawString(node.getLexiconLabel(), pos.x - 38, pos.y - 10);

}
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:14,代碼來源:ViwnVertexRenderer.java

示例8: paintBorder

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
/**
 * Paints the border for the specified component with the
 * specified position and size.
 * @param c the component for which this border is being painted
 * @param g the paint graphics
 * @param x the x position of the painted border
 * @param y the y position of the painted border
 * @param width the width of the painted border
 * @param height the height of the painted border
 */
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if ((this.thickness > 0) && (g instanceof Graphics2D)) {
        Graphics2D g2d = (Graphics2D) g;

        Color oldColor = g2d.getColor();
        g2d.setColor(this.lineColor);

        Shape outer;
        Shape inner;

        int offs = this.thickness;
        int size = offs + offs;
        if (this.roundedCorners) {
            float arc = .2f * offs;
            outer = new RoundRectangle2D.Float(x, y, width, height, offs, offs);
            inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc);
        }
        else {
            outer = new Rectangle2D.Float(x, y, width, height);
            inner = new Rectangle2D.Float(x + offs, y + offs, width - size, height - size);
        }
        Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);
        path.append(outer, false);
        path.append(inner, false);
        g2d.fill(path);
        g2d.setColor(oldColor);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:39,代碼來源:LineBorder.java

示例9: insertImage

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
private static void insertImage(BufferedImage source, String imgPath,
        boolean needCompress) throws Exception {
    File file = new File(imgPath);
    if (!file.exists()) {
        System.err.println(""+imgPath+"   該文件不存在!");
        return;
    }
    Image src = ImageIO.read(new File(imgPath));
    int width = src.getWidth(null);
    int height = src.getHeight(null);
    if (needCompress) {// 壓縮LOGO
        if (width > WIDTH) {
            width = WIDTH;
        }
        if (height > HEIGHT) {
            height = HEIGHT;
        }
        Image image = src.getScaledInstance(width, height,
                Image.SCALE_SMOOTH);
        BufferedImage tag = new BufferedImage(width, height,
                BufferedImage.TYPE_INT_RGB);
        Graphics g = tag.getGraphics();
        g.drawImage(image, 0, 0, null); // 繪製縮小後的圖
        g.dispose();
        src = image;
    }
 // 插入LOGO
    Graphics2D graph = source.createGraphics();
    int x = (QRCODE_SIZE - width) / 2;
    int y = (QRCODE_SIZE - height) / 2;
    graph.drawImage(src, x, y, width, height, null);
    Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
    graph.setStroke(new BasicStroke(3f));
    graph.draw(shape);
    graph.dispose();
}
 
開發者ID:Fetax,項目名稱:Fetax-AI,代碼行數:37,代碼來源:CodeUtil.java

示例10: insertImage

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
private static void insertImage(BufferedImage source, String imgPath,
        boolean needCompress) throws Exception {
    File file = new File(imgPath);
    if (!file.exists()) {
        System.err.println(""+imgPath+"   該文件不存在!");
        return;
    }
    Image src = ImageIO.read(new File(imgPath));
    int width = src.getWidth(null);
    int height = src.getHeight(null);
    if (needCompress) { // 壓縮LOGO
        if (width > WIDTH) {
            width = WIDTH;
        }
        if (height > HEIGHT) {
            height = HEIGHT;
        }
        Image image = src.getScaledInstance(width, height,
                Image.SCALE_SMOOTH);
        BufferedImage tag = new BufferedImage(width, height,
                BufferedImage.TYPE_INT_RGB);
        Graphics g = tag.getGraphics();
        g.drawImage(image, 0, 0, null); // 繪製縮小後的圖
        g.dispose();
        src = image;
    }
    // 插入LOGO
    Graphics2D graph = source.createGraphics();
    int x = (QRCODE_SIZE - width) / 2;
    int y = (QRCODE_SIZE - height) / 2;
    graph.drawImage(src, x, y, width, height, null);
    Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
    graph.setStroke(new BasicStroke(3f));
    graph.draw(shape);
    graph.dispose();
}
 
開發者ID:HuiJa,項目名稱:bicycleSharingServer,代碼行數:37,代碼來源:QRCodeUtil.java

示例11: paintBorder

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
/**
 * Paints the border for the specified component with the
 * specified position and size.
 *
 * @param c the component for which this border is being painted
 * @param g the paint graphics
 * @param x the x position of the painted border
 * @param y the y position of the painted border
 * @param width the width of the painted border
 * @param height the height of the painted border
 */
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if ((this.thickness > 0) && (g instanceof Graphics2D)) {
        Graphics2D g2d = (Graphics2D) g;

        Color oldColor = g2d.getColor();
        g2d.setColor(this.lineColor);

        Shape outer;
        Shape inner;

        int offs = this.thickness;
        int size = offs + offs;
        if (this.roundedCorners) {
            float arc = .2f * offs;
            outer = new RoundRectangle2D.Float(x, y, width, height, offs, offs);
            inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc);
        }
        else {
            outer = new Rectangle2D.Float(x, y, width, height);
            inner = new Rectangle2D.Float(x + offs, y + offs, width - size, height - size);
        }
        Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);
        path.append(outer, false);
        path.append(inner, false);
        g2d.fill(path);
        g2d.setColor(oldColor);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:40,代碼來源:LineBorder.java

示例12: getRegiao

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
@Override
public Shape getRegiao() {
    if (Regiao == null) {
        Regiao = new RoundRectangle2D.Float(getLeft(), getTop(), getWidth(), getHeight(), getWidth()/3, getHeight());
    }
    return Regiao;
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:8,代碼來源:EstadoAtividade.java

示例13: getRegiao

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
@Override
public Shape getRegiao() {
    if (Regiao == null) {
        Regiao = new RoundRectangle2D.Float(getLeft(), getTop(), getWidth(), getHeight(), distSelecao * 8, distSelecao * 8);
    }
    return Regiao;
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:8,代碼來源:FluxProcesso.java

示例14: getRegiao

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
@Override
public Shape getRegiao() {
    if (Regiao == null) {
        Regiao = new RoundRectangle2D.Float(getLeft(), getTop(), getWidth(), getHeight(), getWidth() / 3, getHeight());
    }
    return Regiao;
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:8,代碼來源:FluxIniFim.java

示例15: insertImage

import java.awt.geom.RoundRectangle2D; //導入方法依賴的package包/類
private static void insertImage(BufferedImage source, String imgPath, boolean needCompress) throws Exception {
	File file = new File(imgPath);
	if (!file.exists()) {
		System.err.println("" + imgPath + "   ���ļ������ڣ�");
		return;
	}
	Image src = ImageIO.read(new File(imgPath));
	int width = src.getWidth(null);
	int height = src.getHeight(null);
	if (needCompress) { // ѹ��LOGO
		if (width > WIDTH) {
			width = WIDTH;
		}
		if (height > HEIGHT) {
			height = HEIGHT;
		}
		src = src.getScaledInstance(width, height, Image.SCALE_SMOOTH);
	}
	// ����LOGO
	Graphics2D graph = source.createGraphics();
	int x = (QRCODE_SIZE - width) / 2;
	int y = (QRCODE_SIZE - height) / 2;
	graph.drawImage(src, x, y, width, height, null);
	Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
	graph.setStroke(new BasicStroke(3f));
	graph.draw(shape);
	graph.dispose();
}
 
開發者ID:hoticer,項目名稱:FoodOrder,代碼行數:29,代碼來源:QRCodeUtil.java


注:本文中的java.awt.geom.RoundRectangle2D.Float方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。