Reputation: 21
I would like to have a view of the simulation date and time in my view area. I tried to copy the method of the product and delivery example but it didn't work. I did the following:
in the simulation experiment properties window I typed the following code in the import java section
import java.text.SimpleDateFormat;
in the main view I used the following code in a text block
new SimpleDateFormat("MMM d, yyyy HH:mm", Locale.ENGLISH).format( new Date() )
The error that I'm getting is: "SimpleDateFormat cannot be resolved to a type".
Does it have to do something with my dependencies? Are dependencies needed?
Upvotes: 0
Views: 507
Reputation: 3930
When you use classes not available by default they need to be imported into the current class.
You can do this in the imports section of the agent you are using the class
But not to worry, had you used code complete it would have been done for you. Simply go to the end of the of SimpleDateFormat
code and press code complete (ctr+space on Windows, cmd+space on Mac) and viola, the import section will be updated for you
Upvotes: 1