如何避免在我的代码中导致Null Pointer异常[重复]

The line westPanel.add(patientList) in the below code, within the searchId method is returning a NullPointerException. I am not sure I completely understand what this error is and neither do I know how to fix this. Can someone give me suggestions to fix it?

public class nextPage {
    private JTabbedPane Monitor;
    private JPanel rootPanel;
    private JPanel tabPane1;
    private JPanel tabPane2;
    private JPanel westPanel;
    private JRadioButton monitorBttn;
    private JPanel northEastPanel;
    private JPanel southEastPanel;
    private JTable monTable;
    private String arg;

    public nextPage(String identification){
        this.arg = identification;
        searchId(this.arg);
    }

    public void searchId(String id){
        /*
        This is a temporary method
         */
//        System.out.println(id);
        String[] names = {"Name1","Name2","Name3"};
        JList<String> patientList = new JList(names);
        westPanel.add(patientList);

    }


    public static void main(String[] args) {
        JFrame frame = new JFrame("Next Page");
        frame.setContentPane(new nextPage("800").rootPanel);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    }
}