I have modified java code from jar and after doing compiled, the code I've written doesn't work. I try to decompile and I found the following error it is saying:
Unresolved compilation problems:
No enclosing instance of the type DirectDelivDetail is accessible in scope
this$0 cannot be resolved or is not a field
The method setComments() from the type DirectDelivDetail is not visible
I know there are a ton of threads that discuss about that, but I didn't find a solution. Okay, this is the code:
public class DirectDelivDetail extends CMSApplet implements
LookupHandler {
private MultiLineEditor comments = null;
private CMSShipment shipment = null;
private void setComments() {
try {
if (this.shipment != null) {
this.shipment.setComments(this.comments.getText());
}
} catch (BusinessRuleException bre) {
JOptionPane.showMessageDialog(null, res.getString(bre.getMessage()));
SwingUtilities.invokeLater(new Runnable() {
public void run() {
DirectDelivDetail.this.comments.requestFocus();
}
});
} finally {
checkFields();
}
}
private JPanel createDetailPanel() {
this.comments = new MultiLineEditor();
this.comments.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
if (!e.isTemporary()) {
DirectDelivDetail.this.setComments();
}
}
});
return detailPanel;
}
}
The code change after compiled. This is the following changes.
private JPanel createDetailPanel() {
this.comments = new MultiLineEditor();
this.comments.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
throw new Error("Unresolved compilation problems: \n\tNo enclosing instance of the type DirectDelivDetail is accessible in scope\n\tThe method checkCancelCommand(FocusEvent) from the type DirectDelivDetail is not visible\n\tthis$0 cannot be resolved or is not a field\n\tNo enclosing instance of the type DirectDelivDetail is accessible in scope\n\tThe method setComments() from the type DirectDelivDetail is not visible\n");
}
});
return detailPanel;
}