⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 line.java

📁 该程序是实现JAVA中用applet实现图片的加载和视频
💻 JAVA
字号:
import java.applet.Applet;
import java.util.Scanner;
import java.awt.Color;
import java.awt.Graphics;
public class Line extends Applet{
private int x0,y0;
private int x1,y1;
public void init()
{
 Scanner scanner = new Scanner(System.in);	
 System.out.println("please input four Integer numbers:");
 x0 = scanner.nextInt();
 y0 = scanner.nextInt();
 x1 = scanner.nextInt();
 y1 = scanner.nextInt();

}
public void paint(Graphics g){
	int x;
	float dy,dx,y,m;
	dx = x1-x0;
	dy = y1-y0;
	m=dy/dx;
	y=y0;
	g.setColor(Color.red);
	for(x = x0;x <= x1;x++){
		{g.drawString(".", x, (int)(y+0.5));
		y+=m;
		}
	}
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -