f分型小试第一节的总结
?
?
参数传递的三种方法:
1.方法
2.构造器
3.?忘了
?
Definition
xn+1?=?sin(a?yn)?+?c?cos(a?xn)
yn+1?=?sin(b?xn)?+?d?cos(b?yn)
where?a,?b,?c,?d?are?variabies?that?define?each?attractor.?
?
?
<!--EndFragment-->package 画点;import javax.swing.JFrame;public class Point extends JFrame {public void initUI(){this.setSize(500,400);this.setVisible(true);java.awt.Graphics g = this.getGraphics();//创建我们已经实现的监听器对象Pointadd pa = new Pointadd(g);//把监听器对象,嫁给界面this.addMouseListener(pa);}public static void main(String[] args){Point pt = new Point();pt.initUI();}}?
package 画点;import java.awt.Graphics;import java.awt.event.MouseEvent;//实现Mouse监听器,放开时画线public class Pointadd implements java.awt.event.MouseListener{ private double a=1.5f,b=-1.8f,c=1.6f,d=0.9f,x1,y1,x2,y2; private java.awt.Graphics g;//画布 public Pointadd(Graphics g){ this.g=g; } /** * Invoked when a mouse button has been pressed on a component. */ public void mousePressed(MouseEvent e){ } public void mouseReleased(MouseEvent e){ for(int i=0;i<100000;i++){ this.x2=Math.sin(a*y1)+c*Math.cos(b*x1); this.y2=Math.sin(b*x1)+d*Math.cos(a*y1); int x3=(int)(x2*170)+500; int y3=(int)(y2*170)+400; g.drawLine(x3, y3,x3,y3); x1=x2; y1=y2; } } /** * Invoked when the mouse enters a component. */ public void mouseEntered(MouseEvent e){ } /** * Invoked when the mouse button has been clicked (pressed * and released) on a component. */ public void mouseClicked(MouseEvent e){ } /** * Invoked when the mouse exits a component. */ public void mouseExited(MouseEvent e){ }}?