I’ve been at this one for a bit now.
I’ve got a null pointer exception so I’m guessing somethings not been initialized.
AdminMessages.inbox1.setText(messageRsetArray[0]);
That’s my code where it’s targetting. But I can’t find what’s inside. It hasn’t been
initialized.
AdminMessages is a class which contains a JTextField called inbox1, messageRsetArray is an array which has taken variables from an array.
Also inbox1 is static. I couldn’t get the getters and setter to work. I know it’s bad practice though.
Exception in thread "main" java.lang.NullPointerException
at project.AdminMessages.fillInboxGui(AdminMessages.java:587)
at project.AdminMessages.<init>(AdminMessages.java:156)
at project.AdminUser.createAdminMessages(AdminUser.java:31)
at project.AdminUser.<init>(AdminUser.java:17)
at project.AdminUser.main(AdminUser.java:45)
To the best of my knowledge what you want cannot be easily done (ANY “dot” is a candidate for the exception).
A slight rewrite of the source code may be the easiest way to get what you need.
into
This leaves you with only one “dot” operation per line, and makes it obvious which one is broken.
You may also want to help the person to see the stacktrace with a
(I like this for method arguments. When inside code you may want NullPointerExceptions instead).