I am trying to add an image to my JOptionPane and I have been piecing things together to see if it will work but I am getting a NullPointerException
Here is my code:
public class MonitoringSystem {
public static void main(String[] a) throws IOException, UnSupportedLookAndFeelException{
FileInputStream fileBytesStream = null;
Scanner inFS = null;
{
{
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
}
ImageIcon icon = new ImageIcon(MonitoringSystem.class.getResource ("C:\\Users\\Zoltek\\Desktop\\Zoo.jpg"));
Object[] options = {"Animals","Habitats","Exit"};
int n = JOptionPane.showOptionDialog(null,
"Zookeepers would you like to view animal activities or monitor habitats?",
"Welcome to the Brooklyn Zoo!",
JOptionPane.YES_NO_CANCEL_OPTION,
icon,
options,
options[1]);
System.out.println(n);
JFrame animal = new JFrame("Animals");
JFrame habitat = new JFrame("Habitats");
if(n==0){
animal.setVisible(true);
String[] choices = {"Lions","Bears","Giraffes"};
String input = (String) JOptionPane.showInputDialog(null,"Select Animal:","Zoo Animals",
JOptionPane.QUESTION_MESSAGE,null,choices,choices[1]);