All,
I am having a bit of trouble displaying someting using the JOption.Pane format. I know we are not supposed to pose questions here But I am at a loss and simply do not know where to turn. I am writing this code for class. It is a mortgage claculator and it needs to display each monthly payment and the balance after each payment until the loan will be paid off. I have the claculations done, arrays are set up, etc... my problem is simply the display. I just do not know how to call it to print on the screen.

Any ideas???

Javanewbie

What are you trying to do, exactly?

The usual syntax is JOptionPane.showMessageDialog(null, "string");

However, if you're doing anything more advanced than a one line message, you may want to look into something more advanced than that.

hi javanewbie,

one way you can solve your problem using JOptionPane is by first creating the functions that will calculate the monthly payment and balance (this could be in the same class as the JOptionPane or in another clas), and then calling those functions using dot notation. For example:

private void info()
{
 JOptionPane.showMessageDialog(frame, 
                    "Course Timetable Information:   \n" +
                    " \n" +
                    "The day with the most scheduled hours: " + course.getDayMostScheduledHours() + " (" + course.getMostScheduledHours() + " hours) \n" +
                    "The day with the least scheduled hours: " + course.getDayLeastScheduledHours() + " (" + course.getLeastScheduledHours() + " hours) \n" +   
                    "The average number of hours scheduled daily: " + course.getAvgDailyHours() + " hours per day"
}

I have above a JOptionPane function that calls 2 other functions from a course class. These course. functions calculate what you want, then using dot notation will help display it in you JOptionPane.

I hope this helps :)

All,
I am having a bit of trouble displaying someting using the JOption.Pane format. I know we are not supposed to pose questions here But I am at a loss and simply do not know where to turn. I am writing this code for class. It is a mortgage claculator and it needs to display each monthly payment and the balance after each payment until the loan will be paid off. I have the claculations done, arrays are set up, etc... my problem is simply the display. I just do not know how to call it to print on the screen.

Any ideas???

Javanewbie

This article has been dead for over six months. Start a new discussion instead.