for(double i = 0; i600; i += 0.01)
{
line = new Line2D.Double(i, dy - Math.cos(getReal_X(i)) * w_times, i + 1, dy - Math.cos(getReal_X(i + 1)) * w_times);
g2.draw(line);
}
break;
case 2:
g2.drawString("y = Atan(Bx + C) + D", 105, 60);
for(double i = 0; i600; i += 0.01)
{
line = new Line2D.Double(i, dy - Math.tan(getReal_X(i)) * w_times, i + 1, dy - Math.tan(getReal_X(i + 1)) * w_times);
g2.draw(line);
}
break;
case 3:
g2.drawString("y = Apow(Bx + C, 2) + D", 105, 60);
for(double i = 0; i600; i += 0.01)
{
line = new Line2D.Double(i, dy - Math.pow(getReal_X(i), 2) * w_times, i + 1, dy - Math.pow(getReal_X(i + 1), 2) * w_times);
g2.draw(line);
}
break;
case 4:
g2.drawString("y = Apow(Bx + C, 3) + D", 105, 60);
for(double i = 0; i600; i += 0.01)
{
line = new Line2D.Double(i, dy - Math.pow(getReal_X(i), 3) * w_times, i + 1, dy - Math.pow(getReal_X(i + 1), 3) * w_times);
g2.draw(line);
}
break;
case 5:
g2.drawString("y = Alog(Bx + C) + D", 105, 60);
for(double i = 0; i600; i += 0.01)
{
line = new Line2D.Double(i, dy - Math.log(getReal_X(i)) * w_times, i + 1, dy - Math.log(getReal_X(i + 1)) * w_times);
g2.draw(line);
}
break;
case 6:
g2.drawString("y = Apow(2, Bx + C) + D", 105, 60);
for(double i = 0; i600; i += 0.01)
{
line = new Line2D.Double(i, dy - Math.pow(2, getReal_X(i)) * w_times, i + 1, dy - Math.pow(2, getReal_X(i + 1)) * w_times);
g2.draw(line);
}
break;
case 7:
g2.drawString("y = Asqrt(Bx + C) + D", 105, 60);
for(double i = 0; i600; i += 0.01)
{
line = new Line2D.Double(i, dy - Math.sqrt(getReal_X(i)) * w_times, i + 1, dy - Math.sqrt(getReal_X(i + 1)) * w_times);
g2.draw(line);
}
break;
case 8:
g2.drawString("y = a(sita)", 105, 60);
for(double i = 0; i600; i += 0.01)
{
line = new Line2D.Double(getReal_X(i) * Math.cos(getReal_X(i)), dy - getReal_X(i) * Math.sin(getReal_X(i)) * w_times, getReal_X(i) * Math.cos(getReal_X(i + 1)), dy - getReal_X(i) * Math.sin(getReal_X(i + 1)) * w_times);
g2.draw(line);
}
break;
}
if(flag != -1)
{
g2.drawString("A = " + w_times, 105, 90);
g2.drawString("B= " + h_times, 105, 120);
g2.drawString("C= " + (300 - dx), 105, 150);
g2.drawString("D= " + (300 - dy), 105, 180);
}
}
private double getReal_X(double x)
{
return (x - dx) * h_times;
}
private void drawCoordinate(Graphics2D g2)
{
int len = 20;
Line2D line;
for(int i = 0; i = 600 / len; i++)
{
g2.setColor(Color.PINK.darker());
if(i == 300 / len)
g2.setColor(Color.RED);
else;
line = new Line2D.Double(0, i * len, 600, i * len);
g2.draw(line);
line = new Line2D.Double(i * len, 0, i * len, 600);
g2.draw(line);
}
drawPoint(g2, 300, 300);
}
private void drawPoint(Graphics2D g2, double x, double y)
{
g2.setColor(Color.YELLOW);
Ellipse2D circle = new Ellipse2D.Double(x - 2, y - 2, 4, 4);
g2.fill(circle);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == ui.rb1)
{
ui.tf.setEnabled(true);
ui.cb.setEnabled(false);
flag = -1;
}
if(e.getSource() == ui.rb2)
{
ui.tf.setEnabled(false);
ui.cb.setEnabled(true);
}
if(e.getSource() == ui.bn1)
{
h_times /= 1.1;
}
if(e.getSource() == ui.bn2)
{
h_times *= 1.1;
}
if(e.getSource() == ui.bn3)
{
//ui.bn4.setEnabled(true);
w_times += 10;
//if(w_times = 300)
//ui.bn3.setEnabled(false);
}
if(e.getSource() == ui.bn4)
推荐阅读
- gis里如何画面,gis 画图形
- 解析js对象的属性,js修改对象的某个属性的值
- jqueryui中文api,jquery 中文网
- ps4恋爱养成游戏排行,ps4恋爱养成游戏排行榜在哪看
- 怎么关闭mysql的日志 mysql8关闭binlog
- 发舞狮视频配什么成语的简单介绍
- les与sap集成关键的简单介绍
- 制作饼干视频用什么面粉,做饼干用的什么面粉
- 水仙花python函数 python,水仙花数