I posted this NullPointerExce ption error a week ago. Ive made progress as now parts of it are being populated. 'report' all throughout the other non-listed classes is being populated. 'gui' all throughout the other non-listed classes is being populated too. 'report' in DCWorkbenchGUI is not being populated and 'gui' in ReportData is not being populated. Both of these are the problems and I have tried everything to get them to work. Any help would be much appreciated... thanks
btw, I have not included all the code as there is far too much of it
ReportData class in report package
[CODE=java]
import dcw.script.*;
import dcw.gui.*;
import dcw.controller. *;
public class ReportData
{
public DCWorkbenchGUI gui;
public ComplexScript script;
//flags for the future predictions
public boolean flagPolicyChang ed = false;
//state variables for the script
public int publicDisorder = 0;
public int soldierInjuries = 0;
public int publicInjuries = 0;
public int civilanFireInju ries = 0;
public int civilanFireFata lities = 0;
public int soldierFataliti es = 0;
public int suspectApprehen sion = 0;
public int baseDamage = 0;
public int pressCoverage = 0;
/**
* Constructor for the ReportData thread
*
* @param g the gui
* @param c the controller
* @param s the script
*/
public ReportData(DCWo rkbenchGUI g, ComplexScript s)
{
gui = g;
script = s;
}
public void reportInfo()
{
System.out.prin tln("ReportInfo GUI: " + gui);
String Report = ("Public Disorder (0 - 100): " + publicDisorder +"\n" +
"Soldier Injuries (max 27): " + soldierInjuries +"\n" +
"Public Injuries (max 20): " + publicInjuries +"\n" +
"Civilian Emergency Services Injuries (max 10): " + civilanFireInju ries +"\n" +
"Soldier Fatalities (max 15): " + soldierFataliti es +"\n" +
"Civilian Emergency Services Fatalities (max 10): " + civilanFireFata lities +"\n" +
"Suspect Capture likelihood (0 - 100): " + suspectApprehen sion +"\n" +
"Base Damage (0 - 100): " + baseDamage +"\n" +
"Press Coverage During Incident (0 - 100): " + pressCoverage);
//display info dialog to the user
gui.scenInfo("T he following information has been found by your assistant \n" + Report,
"General Information",
script.currentT imeInSecs());
}
public void assistantAdvice ()
{
System.out.prin tln("flagPolicy Changed: " + flagPolicyChang ed);
if(flagPolicyCh anged)
{
String Probabilities = ("Changing the Access Policy to: \n" +
" a) 'Nobody' may limit the sharing of information \n" +
" b) 'Authorised' or 'Essential Only' may jeopardise confidential information \n" +
"Changing the Exit Policy to: \n" +
" a) 'Nobody' may increase the possibility of suspect apprehension by 20% \n" +
" b) 'Essential Only' may increase the possibility of suspect apprehension by 15% \n" +
" c) 'Authorised' may not affect the possibility of suspect apprehension");
//display info dialog to the user
gui.scenInfo("Y our assistant has predicted the following: \n" + Probabilities,
"General Information",
script.currentT imeInSecs());
flagPolicyChang ed = false;
}
}[/CODE]
DCWorkbenchGUI Class in gui package
[CODE=java]
import dcw.gui.*;
import dcw.report.*;
import dcw.controller. *;
public class DCWorkbenchGUI extends JFrame
{
private ComplexScript script;
private ReportData report;
/**
* Constructor for DCWorkbenchGUI
*
* @param c the central controlling script
*/
public DCWorkbenchGUI( ComplexScript c, ReportData r)
{
initComponents( report);
setVisible(true );
script = c;
report = r;
System.out.prin tln("Report: " + report);
}
/**
* This method is called from within the constructor to initialize the GUIs components.
*/
private void initComponents( ReportData report)
{
System.out.prin tln("InitComp: " + report);
Report.addMouse Listener(new java.awt.event. MouseAdapter()
{
public void mouseClicked(ja va.awt.event.Mo useEvent evt)
{
reportMouseClic ked(evt);
}
});
AssistantAdvice .addMouseListen er(new java.awt.event. MouseAdapter()
{
public void mouseClicked(ja va.awt.event.Mo useEvent evt)
{
assistantAdvice MouseClicked(ev t);
}
});
/**
* Action for the pressing of the button, upon pressing the button, the button
* is removed from the GUI, and the script resumes action.
*
* @param evt MouseEvent for the pressing of the button
*/
private void reportMouseClic ked(java.awt.ev ent.MouseEvent evt)
{
report.reportIn fo();
}
private void assistantAdvice MouseClicked(ja va.awt.event.Mo useEvent evt)
{
System.out.prin tln("MouseClick ed: " + report);
report.assistan tAdvice();
}
}
[/CODE]
ComplexScript Class in script package
[CODE=java]
import dcw.gui.*;
import dcw.report.*;
import dcw.controller. *;
public class ComplexScript
{
//variables for control of the workbench
public DCWorkbenchGUI gui;
public VppController control = new VppController() ;
public ReportData report;
private short cid;
private PrintWriter pw;
/**
* Main Method for the workbench.
*
* @param args the command line arguments
*/
public static void main(String args[])
{
ComplexScript test = new ComplexScript() ;
test.run();
}
/**
* The run method for ComplexScript
*/
public void run()
{
try
{
//initialise the gui, passing the script and report data
gui = new DCWorkbenchGUI( this, report);
report = new ReportData(gui, this);
}
catch(Exception e)
{
}
}[/CODE]
btw, I have not included all the code as there is far too much of it
ReportData class in report package
[CODE=java]
import dcw.script.*;
import dcw.gui.*;
import dcw.controller. *;
public class ReportData
{
public DCWorkbenchGUI gui;
public ComplexScript script;
//flags for the future predictions
public boolean flagPolicyChang ed = false;
//state variables for the script
public int publicDisorder = 0;
public int soldierInjuries = 0;
public int publicInjuries = 0;
public int civilanFireInju ries = 0;
public int civilanFireFata lities = 0;
public int soldierFataliti es = 0;
public int suspectApprehen sion = 0;
public int baseDamage = 0;
public int pressCoverage = 0;
/**
* Constructor for the ReportData thread
*
* @param g the gui
* @param c the controller
* @param s the script
*/
public ReportData(DCWo rkbenchGUI g, ComplexScript s)
{
gui = g;
script = s;
}
public void reportInfo()
{
System.out.prin tln("ReportInfo GUI: " + gui);
String Report = ("Public Disorder (0 - 100): " + publicDisorder +"\n" +
"Soldier Injuries (max 27): " + soldierInjuries +"\n" +
"Public Injuries (max 20): " + publicInjuries +"\n" +
"Civilian Emergency Services Injuries (max 10): " + civilanFireInju ries +"\n" +
"Soldier Fatalities (max 15): " + soldierFataliti es +"\n" +
"Civilian Emergency Services Fatalities (max 10): " + civilanFireFata lities +"\n" +
"Suspect Capture likelihood (0 - 100): " + suspectApprehen sion +"\n" +
"Base Damage (0 - 100): " + baseDamage +"\n" +
"Press Coverage During Incident (0 - 100): " + pressCoverage);
//display info dialog to the user
gui.scenInfo("T he following information has been found by your assistant \n" + Report,
"General Information",
script.currentT imeInSecs());
}
public void assistantAdvice ()
{
System.out.prin tln("flagPolicy Changed: " + flagPolicyChang ed);
if(flagPolicyCh anged)
{
String Probabilities = ("Changing the Access Policy to: \n" +
" a) 'Nobody' may limit the sharing of information \n" +
" b) 'Authorised' or 'Essential Only' may jeopardise confidential information \n" +
"Changing the Exit Policy to: \n" +
" a) 'Nobody' may increase the possibility of suspect apprehension by 20% \n" +
" b) 'Essential Only' may increase the possibility of suspect apprehension by 15% \n" +
" c) 'Authorised' may not affect the possibility of suspect apprehension");
//display info dialog to the user
gui.scenInfo("Y our assistant has predicted the following: \n" + Probabilities,
"General Information",
script.currentT imeInSecs());
flagPolicyChang ed = false;
}
}[/CODE]
DCWorkbenchGUI Class in gui package
[CODE=java]
import dcw.gui.*;
import dcw.report.*;
import dcw.controller. *;
public class DCWorkbenchGUI extends JFrame
{
private ComplexScript script;
private ReportData report;
/**
* Constructor for DCWorkbenchGUI
*
* @param c the central controlling script
*/
public DCWorkbenchGUI( ComplexScript c, ReportData r)
{
initComponents( report);
setVisible(true );
script = c;
report = r;
System.out.prin tln("Report: " + report);
}
/**
* This method is called from within the constructor to initialize the GUIs components.
*/
private void initComponents( ReportData report)
{
System.out.prin tln("InitComp: " + report);
Report.addMouse Listener(new java.awt.event. MouseAdapter()
{
public void mouseClicked(ja va.awt.event.Mo useEvent evt)
{
reportMouseClic ked(evt);
}
});
AssistantAdvice .addMouseListen er(new java.awt.event. MouseAdapter()
{
public void mouseClicked(ja va.awt.event.Mo useEvent evt)
{
assistantAdvice MouseClicked(ev t);
}
});
/**
* Action for the pressing of the button, upon pressing the button, the button
* is removed from the GUI, and the script resumes action.
*
* @param evt MouseEvent for the pressing of the button
*/
private void reportMouseClic ked(java.awt.ev ent.MouseEvent evt)
{
report.reportIn fo();
}
private void assistantAdvice MouseClicked(ja va.awt.event.Mo useEvent evt)
{
System.out.prin tln("MouseClick ed: " + report);
report.assistan tAdvice();
}
}
[/CODE]
ComplexScript Class in script package
[CODE=java]
import dcw.gui.*;
import dcw.report.*;
import dcw.controller. *;
public class ComplexScript
{
//variables for control of the workbench
public DCWorkbenchGUI gui;
public VppController control = new VppController() ;
public ReportData report;
private short cid;
private PrintWriter pw;
/**
* Main Method for the workbench.
*
* @param args the command line arguments
*/
public static void main(String args[])
{
ComplexScript test = new ComplexScript() ;
test.run();
}
/**
* The run method for ComplexScript
*/
public void run()
{
try
{
//initialise the gui, passing the script and report data
gui = new DCWorkbenchGUI( this, report);
report = new ReportData(gui, this);
}
catch(Exception e)
{
}
}[/CODE]
Comment