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. leetcode笔记:Range Sum Query - Mutable

    一. 题目描写叙述 Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), ...

  2. AJAX--XMLHttpRequest五步使使用方法

    传统浏览方式和AJAX方式的不同 多数Web应用程序都使用请求/响应模型从server上获得完整的HTML页面.经常是点击一个button,等待server对应,在点击还有一个button.然后在等待 ...

  3. placement new和delete

    注意,我们无法改变new和delete操作符. 但是我们可以重载来里面的operator new 和 operator delete 方法,这个方法是被new操作符调用的,调用之后获得地址,会继续用构 ...

  4. Ubuntu 经常使用软件安装

    Chromium 14.04+ FlashPlayer 原理 就是安装一个flash插件而已啊,网上都没有详解. 我们首先在浏览器地址栏输入chrome://plugins, 全部插件都会展示出来了. ...

  5. poj 2240 Bellman-Flod 求环

    http://poj.org/problem?id=2240 深刻体现了自己代码能力有问题外加改模板能力有问题.外加Debug有问题.以后做到: 1.算法原理能够轻易弄出来. 2.代码模板自己收集各种 ...

  6. [9]EC_屏蔽ecshop云提示no_license

    安装完后,打开后台就看到这个,特别烦,想立刻干掉它. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdXB0b255dWFu/font/5a6L5L2T/f ...

  7. scikit-learn 为机器学习

    如何使用 scikit-learn 为机器学习准备文本数据   欢迎大家前往云+社区,获取更多腾讯海量技术实践干货哦~ 文本数据需要特殊处理,然后才能开始将其用于预测建模. 我们需要解析文本,以删除被 ...

  8. 13.ng-value

    转自:https://www.cnblogs.com/best/tag/Angular/ 绑定给定的表达式到input[select]或 input[radio]的值上 <input type= ...

  9. js --- 中字符串与unicode编码

    1.charAt():把字符串分成每一个字符,从左往右提取指定位置的字符 var str = '天气'; alert( str.charAt(1) );            //气 2.charCo ...

  10. rem的解决方案

    http://www.qdfuns.com/notes/32967/37b8f127797c6c2b66f2c1dc6d133e45.html rem 作为一个低调的长度单位,由于手机端网页的兴起,在 ...