登录
首页 » 其他 » Java绘图:绘制虚线与实线

Java绘图:绘制虚线与实线

于 2022-01-28 发布 文件大小:3.46 kB
0 178
下载积分: 2 下载次数: 1

代码说明:

Java绘图:绘制虚线与实线   public LineDemo(){    super("实线与虚线"); //调用父类构造函数    setSize(300,200); //设置窗口尺寸    setVisible(true); //设置窗口可视    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //关闭窗口时退出程序   }   public void paint(Graphics g){ //绘制组件方法    Graphics2D g2=(Graphics2D)g; //得到2D图形    Dimension dim = this.getSize(); //得到组件尺寸    g2.setColor(Color.white); //设置绘制颜色为白色    g2.fillRect(0, 0, dim.width, dim.height); //填充整个组件    g2.setColor(Color.black); //设置绘制颜色    g2.drawLine(40,160,280,160); //绘制实线    g2.drawLine(40,160,40,40);    g2.drawString("0",30,165); //绘制字符串    g2.drawString("100",16,50);    g2.drawString("200",270,175);    float[] dash={5,5}; //短划线图案    BasicStroke bs = new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER, 10.0f,dash,0.0f); //实例化新画刷    g2.setStroke(bs); //设置新的画刷    g2.drawLine(40,160,100,120); //用新的画刷绘制虚线

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 开放的Java报告生成库。XML报告模板被用来生成准备打印的文档,这些文档来自指定的数据源,包括JDBC。输出可以传送到屏幕,或者以PDF,HTML或者XML的...
    开放的Java报告生成库。XML报告模板被用来生成准备打印的文档,这些文档来自指定的数据源,包括JDBC。输出可以传送到屏幕,或者以PDF,HTML或者XML的格式存储-open Java for report generation. XML report templates are used to create print ready files, these files from the specified data sources, including JDBC. Output can be sent to the screen, or PDF, HTML or XML format storage
    2023-01-05 23:15:03下载
    积分:1
  • 原生Js浮动弹出层 可拖动 关闭 最小化
    原生Js浮动弹出层 可拖动 关闭和最小化,用到了几个小图片,分别是标题栏、关闭按钮和最小化按钮,关闭和最小化我给误删了,自己再找个类似的图片覆盖掉吧,弹出层的其它部分都是完全正常的,兼容性也很好,具体效果,请参见源码测试截图。   例子页面演示了三种内容的拖动弹出层,分别是图片、文字和图文混合方式,各有各的用途,仅供参考。
    2022-03-21 05:07:28下载
    积分:1
  • CTI applications, mainly used in automatic voice response, the development of te...
    CTI应用,主要应用于自动语音应答,开发技术比较成熟,在国外应用比较多.-CTI applications, mainly used in automatic voice response, the development of technology and more mature, more applications in foreign countries.
    2022-07-11 03:02:03下载
    积分:1
  • Web site development related to the code, mainly to achieve a site' s home pa...
    网站开发的相关代码,主要是实现了一个网站的首页,是关于健康咨询的一个网站-Web site development related to the code, mainly to achieve a site" s home page, is a web site on health consultation
    2023-04-24 10:40:03下载
    积分:1
  • 汽车信号灯控制系统 汽车上有一转弯控制杆。此控制杆有三个位置: 1、 中间位置时,汽车不转弯; 2、 向上时,汽车左转; 3、 向下时,汽车右转...
    汽车信号灯控制系统 汽车上有一转弯控制杆。此控制杆有三个位置: 1、 中间位置时,汽车不转弯; 2、 向上时,汽车左转; 3、 向下时,汽车右转; 4、 汽车转弯时,要求左右尾灯、左右头灯和仪表板上的2个指标灯相应地发出闪烁信号; 5、 当应急开关合上时,所有6个信号灯都应闪烁; 6、 汽车刹车时,2个尾灯发出不闪烁的信号; 7、 如刹车时正在转弯,则相应的转弯闪烁信号不受影响。 8、 汽车转弯或应急状态下,外部信号灯和仪表板指示灯的闪烁频率为1HZ。 9、 停靠(合上停靠开关):头灯、尾灯以30Hz的频率闪烁。 -car lights on the car control system is a turn-control. This control rod position are three : a middle position, the car turns; 2, upward, the vehicle turn left; 3. downward car when turning; four car turning, asked about taillights, about headlights and instrument panel in the two corresponding indicator lights flashing to send signals; 5, when a switch on the emergency, all six lights should be flashing; 6, car brakes, two rear of no flashing signal; 7. if the brakes are turning, turning corresponding flashing signal is not affected. 8, cars turning or state of emergency, external appearance and the dashboard lights flicker frequency 1HZ. 9, call (a call on the switch) : headlights, taillights to the frequ
    2023-03-15 12:30:03下载
    积分:1
  • JSP ajax无刷新弹出层实例
    JSP ajax无刷新弹出层实例,一个无刷新弹出框,点击“注册”或“查看图片”文字链接后,网页背景变暗,紧接着弹出一个加载框,这个加载框中可以是图片,也可以一个网页,支持关闭功能,有不少网站特别是用户注册或登录的时候会使用此类效果。
    2022-07-17 15:08:08下载
    积分:1
  • gps for ppc gps for ppc enjoy this!!
    gps for ppc enjoy this-gps for ppc gps for ppc enjoy this!!
    2023-06-25 04:05:03下载
    积分:1
  • This system is a competition I took part in ESRI works mainly use the GIS capabi...
    本系统是我参加ESRI大赛的一个作品 主要利用GIS功能对水土流失模型USLE中的各个因子的提取(如根基降雨量站点插值生成等值线,利用等高线生成TIN提取坡度,坡向等)再生成专题图输出。系统包含数据采用的ACCESS,有对数据库的通用操作,以及各种绘图分析,如对年、月、日的降雨量,流量等的图形对比分析等等。系统功能还算比较完善。 是基于VB6.0+ArcEngine9.2开发,皮肤界面用的是Activebar3.0 里面的数据比较大,不便上传,需要的可向我索要。-This system is a competition I took part in ESRI works mainly use the GIS capabilities of the USLE soil erosion model for the extraction of the various factors (such as the foundations of rainfall site, contour interpolation, using contour lines generated TIN extraction slope, aspect, etc. ) and then generate the thematic map output. System contains the data used in ACCESS, there is a common database operations, and a variety of mapping analysis, such as year, month, day of rainfall, flow, etc. graphic correlation and so forth. Relatively perfect system functions fairly. Is based on VB6.0+ ArcEngine9.2 development, the skin interface, using a relatively large data inside Activebar3.0, inconvenience upload, need to be to my request.
    2023-06-23 08:40:03下载
    积分:1
  • 管理系统小十分 而就身体后 是上 按时上突然后
    管理系统小十分 而就身体后 是上 按时上突然后 -management system is very small and it is on the body after time after suddenly
    2022-02-04 02:42:28下载
    积分:1
  • 输入阿拉伯数字(1到7)显示星期的英文字母
    输入阿拉伯数字(1到7)显示星期的英文字母-The importation of Arabic numerals (1-7) shows the letters of the alphabet Week
    2022-03-02 05:58:59下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载