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

Java绘图:绘制虚线与实线

于 2022-01-28 发布 文件大小:3.46 kB
0 184
下载积分: 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 个回复

  • MFC汉诺塔游戏。 软件设计了增强的视觉反馈效果,当鼠标滑过,颜色会变得更为鲜艳。【三列的标准色彩为 红、绿、蓝 。】 每当单击某一列,颜色变成灰黑色,...
    MFC汉诺塔游戏。 软件设计了增强的视觉反馈效果,当鼠标滑过,颜色会变得更为鲜艳。【三列的标准色彩为 红、绿、蓝 。】 每当单击某一列,颜色变成灰黑色,表示可以拖动这一列。 请保持exe文件与snd文件夹处于同一目录下面!否则听不到正确的声音! BUG(仅列举未改正的): 1.延时使用了sleep函数,而这个函数 运行时 无法接收其他操作,可能导致失去相应。 2.当圆盘数调至 8个以上时,有时(偶尔)会出现无故的错误,比如程序报错而关闭。 原因尚不可知,不过应该不是核心算法的错误,可能是某一处指针使用不够谨慎。
    2023-01-20 19:15:03下载
    积分:1
  • COM versus CORBAA Decision Framework! 1 introduced the use COM or CORBA record D...
    COM versus CORBAA Decision Framework!一本介绍应该使用COM还是CORBA的记录文摘!-COM versus CORBAA Decision Framework! 1 introduced the use COM or CORBA record Digest!
    2022-02-20 20:57:59下载
    积分:1
  • java games prepared by the 1000 block of Terry Avenue prepared by the 1000 block...
    java编写的连连看游戏 java编写的连连看游戏 -java games prepared by the 1000 block of Terry Avenue prepared by the 1000 block of Terry Avenue java games prepared by the 1000 block of Terry Avenue java preparation of the 1000 block of Terry Avenue java games prepared by the 1000 block of Terry Avenue games java games prepared by the 1000 block of Terry Avenue
    2022-07-24 04:56:20下载
    积分:1
  • Delphi时间设置得到Windows系统时间
    Delphi获取Windows当前时间,并设置系统时间,功能类似于Windows时间设置程序,先获取系统时间中的年月日、时分秒信息,然后可以自定义各个时间信息。
    2022-11-17 15:45:03下载
    积分:1
  • 在阵列中进行DOA估计的matlab程序,RBF神经网络实现
    在阵列中进行DOA估计的matlab程序,RBF神经网络实现-In the array in DOA estimation matlab program, RBF neural network
    2022-02-22 01:37:48下载
    积分:1
  • procedures for the importation of a series of float, derived average M, S ^ 2 va...
    这个程序对于输入的一系列浮点数,求出其平均值 M,方差 S^2,标准差 S-procedures for the importation of a series of float, derived average M, S ^ 2 variance, standard deviation S
    2022-02-04 11:58:40下载
    积分:1
  • 竖长带缩略图幻灯片切换代码
    一个竖长的带缩略图幻灯片切换代码,曾经在中国移动12530网站上使用过,现在整理出来了,你可以用在自己的网站上。效果描述:鼠标放在最下边的小图上,对应的大图片淡入淡出切换显示,大图带文字说明。
    2022-01-24 17:00:43下载
    积分:1
  • labview教材的配书课件。制作详细,可供参考。共6部分,下载后统一解压...
    labview教材的配书课件。制作详细,可供参考。共6部分,下载后统一解压-LabVIEW courseware materials with the book. The production of detailed, for reference. A total of 6 parts, download decompression unification
    2022-01-25 15:20:12下载
    积分:1
  • 此为icl8038的函数发生器芯片使用说明,该芯片可以完成三角波、正弦波、方波的变换,经过使用,效果可以满足一般的要求。...
    此为icl8038的函数发生器芯片使用说明,该芯片可以完成三角波、正弦波、方波的变换,经过使用,效果可以满足一般的要求。-This is the ICL8038 function generator chip for use, the chip can complete the triangular wave, sine wave, square wave of transformation, through the use of results to meet the general requirements.
    2023-04-26 23:35:04下载
    积分:1
  • 对grwave PC版需要一台IBM PC / AT或等效
    地波场强计算,高频地波场强衰减计算,高频电磁波地波传播计算仿真,Fortran源程序,可以在cirr公开网址上获得。- The PC version of GRWAVE requires an IBM PC/AT or equivalent (80286 microprocessor) with a math co-processor and a minimum of 256 kilobytes of memory. Disk Contents: GRWAVE is supplied on a 3.5" or 5.25" disk which contains three main files. These are GRWAVE.EXE, GRWAVE.FOR and GRWUSR.MAN. GRWAVE.EXE is executable machine language code. GRWAVE.FOR is the FORTRAN source code. Compilation of this source code to produce an executable code requires a FORTRAN compiler which supports double precision complex arithmetic. Microsoft FORTRAN Version 4.01 was used to compile and link GRWAVE.FOR to produce GRWAVE.EXE. Compilation has also been tested with Lahey FORTRAN F77L [*]. It is known the IBM Professional FORTRAN will not work because of a lack of support for double precision complex arithmetic. [*] Note: GRWAVE uses a function, DREAL, which is not an in
    2022-04-14 19:32:30下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载