Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing objects

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I have created two classes that extend JPanel. These JPanels are placed on a JTabbedPane. One of these classes represents a 'Project Maintenance' tab. The other represents an 'Order Maintenance' tab. These two classes each have a combo box on them that contains project ID's. I want to be able to re-populate the data in this combo box on the order maintenance tab whenever a user has pressed the save button on the project maintenance tab, and there were no errors.
The main class that creates the JTabbedPane, also creates the ProjectMaintenance class and the OrderMaintenance class. I thought I could just pass OrderMaintenace into ProjectMaintenance, and access it that way, but I get a runtime error when I do this. (ClassNotFoundException). In the code, OrderMaintenance is created before ProjectMaintenance so I thought it should recognize it. However, if I switch the order that these two classes are added to the JTabbedPane it works. But I don't want OrderMaintenance before ProjectMaintenance on my TabbedPane.
Does anyone know of a way I can do this?
Here is the code for my main class..

 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could someone move this topic to the AWT/Swing folder?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only if you promise to solve the problem.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ClassNotFoundException means that the JDK cannot find the class you have specified... sounds like a package name problem or misspelling. If the JDK finds the class, but the reference is bad, you would get a NullPointerException.

Look in the stacktrace of the exception to see what class and line the exception is being thrown on...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic