craftyfirst
asked on
Getting the chart to work in my Java program
I need to get my chart to work in the Java program I have developed. I have gotten the basic layout to work, but have not gotten the information from the calculations to work to make the graph. Let me know what I'm doing wrong. MortgageCalculator.java Chart.java InterestRate-Term.txt
This code is from your caclulator part
public void onButtonChart()
{
new Chart((int)(number_of_months));
System.out.println(""+number_of_months);
}
This code is from Chart:
public Chart( int number_years)
{
//set title for the window
super( "Mortgage Payment Calculator Chart" );
this.number_years = number_years ;
// set the size of the window and let it be visible
setSize( 740, 490 );
setVisible( true );
}
So you pass number of months and read it as number of years.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. Looks like it working.
Yes, it does.
In general it is definitely not a good practice to
use actual numbers in the paint(g) method.
You should first retrieve the size of yoour panel
and then exprsess everithyng as height and width mmultuiplied by the
ratio which you need for each point, line, etc
which you are drawing.
Otherwise, when you resize your window, your
drawing will be screwed up.
Well, for the first try - it is OK.
But in general, this is good to keep in mind.
ASKER
Thanks
I will keep this in mind for next time.
I will keep this in mind for next time.
and when it comapres number of montsh with 10 in your chart
it odes not go
to that picve which should darw your red line