Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar wrote:Hi Tawi,
Welcome to CodeRanch!
No offences, but the code given at blog link is horribly formatted.
Due to that reason, I couldn't figure out which is real 'line 812' - where the program is giving NPE.
Can you please post that part of code?
Also, please UseCodeTags while doing so (paste the code, select code part and hit 'Code' button at top of post editor).
Jayesh A Lalwani wrote:Format your code before posting. The harder you make it for people to help you, the less help you will get
Tawi Oei wrote:I cannot write the code in this forum, please open http://www.tawijakarta.blogspot.com to see my code.
Henry Wong wrote:
Tawi Oei wrote:I cannot write the code in this forum, please open http://www.tawijakarta.blogspot.com to see my code.
Just took a look at the code in the blog.... and wow... people weren't kidding when they said that it wasn't readable. There is no formatting whatsoever -- in fact, there are whole sections where there are no line breaks at all.
Henry
Tony Docherty wrote:Copy and Paste your code into your post. Highlight the code for each class you are pasting in and click on the code button in the toolbar.
Tawi Oei wrote:I do not know how to do that, just download the file and open it please? I need to finish this work as soon as possible and sorry if you feel not good because of this. This is not an offence ok?
Henry Wong wrote:
Tawi Oei wrote:I do not know how to do that, just download the file and open it please? I need to finish this work as soon as possible and sorry if you feel not good because of this. This is not an offence ok?
In a world full of viruses and malware, I think that many people will feel very uncomfortable going to a file sharing site. If you don't want to post the code here, that is your choice. There is nothing wrong with not wanting to do it... However, keep in mind that everyone here is a volunteer, and there are many questions being asked here. So, I can easily see that people would prefer to answer the questions that doesn't require them to register on another site.
Good luck though. Maybe another rancher is willing to download and look into it for you.
Henry
Tony Docherty wrote:Copy and Paste your code into your post. Highlight the code for each class you are pasting in and click on the code button in the toolbar.
I do not know how to do that
, just download the file and open it please?
Tawi Oei wrote:
I guess you don't need to register to that site.
SCJP
Visit my download page
Jesper de Jong wrote:A NullPointerException means that you are trying to dereference a variable that is null. For example, you call a method on a variable that is null.
Note that the stack trace tells you exactly in which line it happens; in this case, line 812 of your code.
In your code, line 812 is this:
If this throws a NullPointerException, it means that isi is null.
Check your code to see where isi is initialized. I see that it happens in line 759, where you call getContentPane() to initialize it.
Note that that line is executed when your FrameBaru object is being initialized. Most likely, the frame does not have a content pane yet at that moment, so getContentPane() returns null.
Remove line 759.
Just before line 812, add the line:
This will make isi a local variable in the constructor instead of a member variable.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Tawi Oei wrote:
Ok, its done. The problem is I get some error messages which are:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at PrgTesisServer.FrameBaru.<init>(ProgramTesisBaru.java:820)
at PrgTesisServer.ProgramTesisBaru$1.lanjut(ProgramTesisBaru.java:102)
at PrgTesisServer.ProgramTesisBaru$1.actionPerformed(ProgramTesisBaru.java:99)
I cannot copy and paste the code to this forum because I cannot make this site to post my message to the forum.
Joanne
Joanne Neal wrote:First of all : indent. It makes your code a lot easier to read.
Your stack trace is showing that the NPE happens at line 66. Look at line 66 and decide which variables are being dereferenced (being used to access one of their fields). Now try and work out which of those variables is null.
Follow Joanne’s suggestions. By reading the line she quoted, you should be able to work out what is null.Tawi Oei wrote: . . . I wrote some codes to solve this but They failed, What should I do?
Don’t know. How could we know?Tawi Oei wrote:By the way, why can't I access this forum from computer at my home?
Tawi Oei wrote:I wrote some codes to solve this but They failed, What should I do?
Joanne
Rob Spoor wrote:
I tried to apply the codes that are similar with below codes but they failed, so what should I do?
Joanne
Tawi Oei wrote:
Well, I tried this on my prior codes but failed. What should I do? NetBeans said that the variable was defined before, so?
Joanne
Tawi Oei wrote:Please open http://www.tawijakarta.blogspot.com and see Java Program III article. Why do I get NullPointerException?
Joanne
Squanch that. And squanch this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|