实现调整画笔粗细

​​​​	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);
		}
	});

 

你可能感兴趣的:(java)