⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 penqiang.java

📁 windows画图板.类似于windows自带的画图程序!
💻 JAVA
字号:
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class PenQiang extends FreeShape {
	
    public PenQiang(Color c, Stroke s, int x, int y) {
        super(c, s, x, y);
    }
    
    public PenQiang() {
        super();
    }
    
    public void draw(Graphics2D g) {
    	Rectangle2D rect=new Rectangle2D.Double(1,3,6,9);
    	BufferedImage bufferedImage = null;
		try {
			bufferedImage = ImageIO.read(new File("E:\\java练习\\java练习\\SmallPhoto\\src\\img\\未命名.jpg"));
		} catch (IOException e) {
			e.printStackTrace();
		}
     	g.setPaint(new TexturePaint(bufferedImage,rect));
        g.setStroke(new BasicStroke(10.0f));
        int[][] points = pointsSet.getPoints();
        if (points == null)
            return;
        int s = points[0].length;
        if (s == 1) {
            int x = points[0][0];
            int y = points[1][0];
            g.drawLine(x, y, x, y);
        } else {
            g.drawPolyline(points[0], points[1], s);
        }
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -