Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error message whilst trying to load application  RSS feed

 
Alex Lai
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to build a basic light Spreadsheet application, as the subject insists I sometimes face this error message:



To elaborate more, I have two classes in one java file. A public class MainApp and another class CellLabel. CellLabel instances are constructed in the constructor of MainApp. CellLabels are a subclass to the JLabel class. The number of CellLabels to be constructed are controlled by two static variables: defaultNumberOfRows and defaultNumberOfColumns. There is only one line in the main method of MainApp and it just constructs an instance of MainApp. Also, I have two constructors in the CellLabel class to construct editable and non-editable CellLabel objects.

Here is the code to describe my problem a bit more clear:
(the line 101 is line 08 here)



The thing is, after encountering this problem I change the values of defaultNumberOfColumns and defaultNumberOfRows and then I don't see the error message anymore?
May I ask, what could be happening?

Help would be greatly appreciated.
 
Campbell Ritchie
Sheriff
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you recompiling anything? Have you seen the documentation for that Exception?

Where is the constructor for CellLabel?
 
Alex Lai
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After changing the values of defaultNumberOfColumns and defaultNumberOfRows and after running the application a few times (in Netbeans IDE) the error sometimes pops up.

The constructor of CellLabel is in the CellLabel class that is just right beneath the MainApp class.
As said before, there are two classes in one Java file: MainApp and CellLabel.

I've just read the description of the exception, could it be the way that I've used the application during runtime caused somewhat changes to the definition of the CellLabel constructor?
 
Campbell Ritchie
Sheriff
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try running it from the command line, away from NetBeans, and see what happens. NetBeans might be recompiling between successive executions; I don't know.

If you use the command line you will know whether you are recompiling, then you can try to get the Exception again.
 
Alex Lai
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've just ran it several times using the command line, didn't seem to give me the error. I'll still work in netbeans and if I do encounter the same error, I'll try it out in the command line.

Anyways, thank you for your help.
 
Campbell Ritchie
Sheriff
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!