package com.yang;

 import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.List; import javax.swing.JFrame;
import javax.swing.JPanel; public class drawlineforspline extends JFrame{ private static final long serialVersionUID = 1L;
static List <mypoint>plist;
public static class mypoint{
int x;
int y;
public mypoint(int x,int y){
this.x=x;
this.y=y;
}
}
public drawlineforspline(){
init();
}
public drawlineforspline(ArrayList plist){
init();
this.plist=plist; }
private void init(){ this.setTitle("drawline");
this.setBounds(200, 200, 500, 400);
this.setBackground(Color.white);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
this.setVisible(true); plist =new ArrayList();
plist.add(new mypoint(50,80));
plist.add(new mypoint(50,120));
plist.add(new mypoint(80,50));
plist.add(new mypoint(150,10));
plist.add(new mypoint(180,80));
plist.add(new mypoint(230,200)); } public class Mypanel extends JPanel{
public void paint(Graphics g){
mypoint fromP=new mypoint(50,80);
mypoint toP=new mypoint(370,240);
for(int i=0;i<plist.size()-1;i++){
g.drawLine(plist.get(i).x, plist.get(i).y, plist.get(i+1).x, plist.get(i+1).y);
}
}
} public static void main(String[] args) {
drawlineforspline d=new drawlineforspline();
Mypanel myp=d.new Mypanel();
d.add(myp);
} }

根据点画线java的更多相关文章

  1. 计算机图形学之扫描转换直线-DDA,Bresenham,中点画线算法

    1.DDA算法 DDA(Digital Differential Analyer):数字微分法 DDA算法思想:增量思想 公式推导: 效率:采用了浮点加法和浮点显示是需要取整 代码: void lin ...

  2. 计算机图形学DDA画线法+中点画线法+Bresenham画线法

    #include <cstdio> #include <cstring> #include <conio.h> #include <graphics.h> ...

  3. 扫描转换算法——DDA、中点画线画圆、椭圆

    我的理解:在光栅图形学中,由于每一个点的表示都只能是整数值,所以光栅图形学实际只是对对实际图形的近似表示. 数值微分法(DDA):以下PPT截图来自北京化工大学李辉老师 代码实现: import ma ...

  4. google map 点与点画线

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  5. 屏幕上两点画线+DDALine算法

    编译环境VS2017+EasyX #include "stdafx.h" #include"graphics.h" void DDALine(int x0, i ...

  6. Python 使用 Matplotlib 做图时,如何画竖直和水平的分割线或者点画线或者直线?

    作者:看看链接:https://www.zhihu.com/question/21929761/answer/164975814 可以使用: vlines(x, ymin, ymax) hlines( ...

  7. OpenGL进阶演示样例1——动态画线(虚线、实线、颜色、速度等)

            用OpenGL动态绘制线段.事实上非常easy,但到如今为止.网上可參考资料并不多. 于是亲自己主动手写一个函数,方便动态绘制线段.代码例如以下: #include<GL/glu ...

  8. webkit事件处理

    1,概述 原文地址:http://blog.csdn.net/awebkit/article/details/8493716 浏览器处理事件一般有两个过程,捕获过程和冒泡过程,这是由addEventL ...

  9. C#源码500份

    C Sharp  短信发送平台源代码.rar http://1000eb.com/5c6vASP.NET+AJAX基础示例 视频教程 http://1000eb.com/89jcC# Winform ...

随机推荐

  1. bug14052601

    AppDelegate.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall cocos2d::ui::Margin::Margin(void ...

  2. CSS元素选择器 element selector(type selector)

    http://www.w3school.com.cn/css/css_selector_type.asp 元素选择器 最常见的 CSS 选择器是元素选择器.换句话说,文档的元素就是最基本的选择器. 如 ...

  3. SQL大小写金额转换

    --功能: 用于将小写的数值翻译成大写的字符串(支持到分,即小数点后两位) --入口参数:@decNum------数字型变量 --返回:字符串 --举例:select dbo.fn_ChnMoney ...

  4. Coderfroces 862 C. Mahmoud and Ehab and the xor

    C. Mahmoud and Ehab and the xor Mahmoud and Ehab are on the third stage of their adventures now. As ...

  5. installp 软件的4种状态

    安装和维护LPP软件     installp 对包提供了如下四种主要的操作: Apply Commit Reject Remove   webes.4.0.0.1 commited webes.4. ...

  6. 开发板ping得通本地,但是不能上网

    在3531D的开发板上面接入LAN7500的USB转以太网口,加载完驱动后. 然后开启eth1 查看一下ifconfig,发现没有ip,配置一下ip 直接ping本地发现可以ping得通,代表链路是连 ...

  7. 【Nginx从入门到实战】

    目录 1. 网站服务 2. 所谓Nginx 3. 安装Nginx 4. Nginx配置文件详述 5. 开始玩转Nginx Nginx虚拟主机 Nginx状态信息(status)配置 Nginx错误页面 ...

  8. Flask--Python中常用的Web框架之一

    Web框架 什么是框架? 协助开发者快速开发web应程序的一套功能代码 开发者只需要按照框架约定要求,在指定位置写上自己的业务逻辑代码即可 为什么要用web框架? 使用web框架的主要目的就是避免重复 ...

  9. 51nod 01背包

    #include<cstdio> #include<algorithm> #define REP(i, a, b) for(int i = (a); i < (b); i ...

  10. 51nod 最长公共子序列+输出路径

    当x = 0 或 y = 0时 f[x][y] = 0 当a[x] = b[y]时  f[x][y] = f[x-1][y-1]+1 当a[x] != b[y]时 f[x][y] = max(f[x] ...