getting actionPerformed to work when importedgreenspun.com : LUSENET : Java Programming : One Thread
My main class is called Timesheet, which contains an init() method. It contains:
add(object1.getTextField1()); add(object1.getTextField2()); add(object1.getLabel());
add(object2.getTextField1()); add(object2.getTextField2()); add(object2.getLabel());
where object1 and object2 are created from the Cell() class, which contains methods getTextField1, getTextField2, getLabel, and actionPerformed. actionPerformed is supposed to generate the difference of the two TextField, assigning it resultLabel, which is returned by the getLabel method. Problem is, actionPerfomed keeps giving me a nullpointerexception. Object1 and Object2 should have their own respective copies of getTextField1, getTextField2, getLabel, and actionPerformed. Why would there be a nullpointer? How can I get around this?
-- Chris Orr (email@example.com), June 24, 2002