Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Variable will not set...

Ok, so I'm making this program for my school counselor to convert credits from other schools to our credit system. Everything works great until I try and print the document with the information on it. For some reason the variables I'm using for the math have their values set everywhere except in the method that I'm using to print them. Here is the code I'm setting them with:
creditsEarned = ((Number)creditsEarnedField.getValue()).doubleValue();
System.out.println(String.valueOf(creditsEarned));
and here is the code that I'm using to print them when they click on the "Print" button.
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent k)
{
//WordProcessing.createNewDocumentFromTemplate("creditConversion");
//WordProcessing.typeTextAtBookmark("studentName", studentName);
System.out.println(String.valueOf(studentName));
//WordProcessing.typeTextAtBookmark("studentNumber", studentNumber);
System.out.println(String.valueOf(studentNumber));
//WordProcessing.typeTextAtBookmark("creditsEarned", creditsEarned);
System.out.println(String.valueOf(creditsEarned));
//WordProcessing.typeTextAtBookmark("remainingCredits", ARHSCredits);
System.out.println(String.valueOf(ARHSCredits));
//WordProcessing.typeTextAtBookmark("totalCreditsNeeded", creditTotal);
//WordProcessing.printToPrinterToSelectByUserAndForget();
//WordProcessing.quitApplication();
//WordProcessing.exec();
System.out.println(getCredits());
}
});
When I print them out in the DOS screen they all have the right values when I print them after I set them.(first code segment) But when I print them when the "Print" button is pressed they all return as null, 0, or 0.0 :confused: (depending on their type). Any help is greatly appreciated and thanks in advance. Feel free to ask any questions if I haven't been clear enough.
[2065 byte] By [EmBraCe] at [2007-11-11 8:08:53]
# 1 Re: Variable will not set...
Looks like in your System.out.println, you're converting to a string, so they are printing correctly.
You're not doing this in the ActionPerformed routine.
Have you tried that?
(Realizing I have no idea how the output functions you're using works.)
big_breakfast at 2007-11-11 22:36:21 >