16. 5. 3. 改变Stroke厚度-Changing the Thickness of the Stroking Pen
来源:互联网 发布:万维网域名注册 编辑:程序博客网 时间:2024/05/22 01:35
import java.awt.BasicStroke;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.Rectangle;import java.awt.TexturePaint;import java.awt.image.BufferedImage;import javax.swing.JComponent;import javax.swing.JFrame;public class BasicDraw {BasicDraw(){JFrame frame = new JFrame(); frame.add(new MyComponent()); frame.setSize(300, 300); frame.setVisible(true);}public static void main(String[] args) {new BasicDraw();}}class MyComponent extends JComponent{public void paint(Graphics g){Graphics2D g2d = (Graphics2D) g;// float strokeThickness = 15.0f;//thickness:厚度// BasicStroke stroke = new BasicStroke(strokeThickness);// g2d.setStroke(stroke);// g2d.draw(new Rectangle(20,20,200,200));//int x = 10;//int y = 10;//int width = 50;//int height = 25;//BufferedImage bi = new BufferedImage(20,20,BufferedImage.TYPE_INT_RGB);//TexturePaint texture = new TexturePaint(bi,new Rectangle(x,y,width,height));//纹理//g2d.setPaint(texture);float strokeThickness = 5.0f; float miterLimit = 10f; float[] dashPattern = { 10f }; float dashPhase = 5f; BasicStroke stroke = new BasicStroke(strokeThickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, miterLimit, dashPattern, dashPhase);//虚线 g2d.setStroke(stroke); g2d.draw(new Rectangle(20,20,200,200));}}
- 16. 5. 3. 改变Stroke厚度-Changing the Thickness of the Stroking Pen
- Changing the Thickness of the Stroking Pen:改变画笔的厚度
- The changing marketplace of bioinformatics
- Changing the ID of Dynamixel
- YUI Changing the Contents of the DataTable
- Changing the ID of the Dynamixel
- The Changing Face of Business Intelligence(正在改变中的BI的脸)一
- The Changing Face of Business Intelligence(正在改变中的BI的脸)二
- #316 – 改变按钮的ClickMode(Changing the ClickMode of a Button)
- Changing The Size Of An Image
- Changing the name of your SQL Server
- Changing the sharing of a project
- Changing the description of the standard SAP fields
- The Hound of the Baskervilles——8、The Stapletons of Pen House
- the Five-stroke Method
- 14.5.2 Changing the Number or Size of InnoDB Redo Log Files 改变InnoDB Redo Log Files的数量
- Changing the Title of a Print Dialog in Delphi
- Changing the layout direction of a form item in Flex
- 程序员面试题精选--扑克牌的顺子
- 芯片的开发
- 虚拟继承、虚函数学习总结
- Linux下,Java图形界面程序中文显示不正常(显示为方格)问题解决
- linux上网老是断线的解决方法
- 16. 5. 3. 改变Stroke厚度-Changing the Thickness of the Stroking Pen
- Android 开发手记一 NDK编程实例
- Bitmap & BitmapData classes in Actionscript 3.0
- 配置编译内核
- 在Struts2中实现自定义分页标签全攻略(一)
- JSP漏洞大观
- Java Servlet及Cookie的使用
- jsp防盗链
- (JSP)如何将网页数据输出为Excel或Word文件