# Thread: graph continues to emerge each time the coordinates is calculated

1. Member Join Date
Dec 2010
Posts
17
Rep Power
0

## graph continues to emerge each time the coordinates is calculated

I want the window remains open and the graph continues to emerge each time the coordinates is calculated the first step: the window opens and there's just ordinate and abscissa. the second stage: once the factorial function computes factorial (k = 2) then the window displays the graph (k = 1, fact (k = 1) = 1) (k = 2, fact (k = 2) = 2) (the line) (as it did the update to the window and it displays the line and the window remains open after the factorial function computes factorial (k = 3) while the window displays the graph (k = 2, fact (k = 2) = 2) (k = 3, fact (k = 3) = 6) (line) ex ..
/*I do not want the loop
you then you calculate the poster I want to draw each time for giving and its factorial k
*/

import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;
import javax.swing.*;

public class GraphingData11 extends JPanel {
/*3 variables to draw the line
(k = 1, fact (k = 1) = 1) (k = 2, fact (k = 2) = 2)*/

static int multi=1;static int multi1;static int k;

/*factorial function*/
public static double factorial(int N){
multi=1;
for (int i = 1; i <= N; i++){multi = multi*i;}
System.out.println(multi);
return multi;}

/*a function that calculates the factorial of k = 1 to 100, and I draw the graph
for each k*/

public static double FUNCTION(){
int k=1;multi1=0;
while (k<=100){factorial(k);

/*can not with the method paintComponent (Graphics g)
paintComponent (Graphics g) I want to call the paintComponent (Graphics g) each time with new cords (k = 1, fact (k = 1) = 1) (k = 2, fact (k = 2) = 2 ) fact (k = 1) is variable and MULTI1 fact (k = 2) is the multi-variable
*/

// wait for a while and then compute factorial k(
////////////////////////////////////////////
t0 = System.currentTimeMillis ();
do {t1 = System.currentTimeMillis ();} while (t1 - t0 <10000);
///////////////////////////////////////

multi1=multi;
k=k+1;}
return 0;}

/*I do not want the loop
you then you calculate the poster I want to draw each time for giving and its factorial k
*/
//the function that draws the dots and lines
protected void paintComponent1(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASIN G,RenderingHints.VALUE_ANTIALIAS_ON);
int w = getWidth(); // Window Width
// Window height
int h = getHeight();

// draw axis.
// draw horizontal axis.
// line color
g2.setPaint(Color.red);
// draw the line
// color dot
g2.setPaint(Color.red);
// draw point
}

public static void main(String[] args) {
FUNCTION();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
}
}

I give you another example as the task manager----->Performance
you see the pattern I want my program to do exactly

In fact I want the same result (a visual standpoint), but I used what has already been drawn before, just by adding new lines ... 2. ## Same as your post from yesterday, so I'm locking this post. And still you refuse to use code tags, why? #### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•