So right now I have a GUI program that I was working on last night and it’s almost done, though some graphical changes will be made. But I was wondering if it were possible to display a picture based on a class.
Like,
Employee John = New Employee("John", "Doe")
How would I make it so a picture displays with John Doe’s face? Do I use a picture box or what?
There’s a number of ways to do this, of course, but you might decide to store some reference to the image you want to use. Maybe you’d do that in your Employee class by holding the path to it like so:
Then you could just load that up, assuming it’s a path
Another approach would be to hold the actual image in the Employee object itself like so:
and load those up ahead of time. Depends on how many you’ve got in your collection of employees.
Assuming they’re already loaded as
Imageobjects in the employees, you’re just calling