实现调整画笔粗细

2019-01-28 16:35:49 浏览数 (1)

代码语言:javascript复制
​​​​	BufferedImage image = new BufferedImage( 570, 390, BufferedImage.TYPE_INT_BGR);
	Graphics gs = image.getGraphics();//获得绘制图像
	Graphics2D g = (Graphics2D) gs;//将绘制图像转换为Graphics2D;



    strokeButton1.addActionListener(new ActionListener() {
		
		@Override
		public void actionPerformed(final ActionEvent e) {
			// TODO Auto-generated method stub
			//声明画笔属性 :粗 细(单位像素) 末端无修饰 折线处呈尖角
			BasicStroke bStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
			g.setStroke(bStroke);
		}
	});

0 人点赞