Can anyone please help me out in removing this error

Exception in thread "main" java.lang.NullPointerException
at java.awt.Container.addImpl(Container.java:1045)
at java.awt.Container.add(Container.java:365)
at Client.<init>(Client.java:33)
at Client.main(Client.java:17)

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
public class Client {
JFrame frame1;
JList list;
JList list1;
JTextField tf;
JButton send;
JButton lout;
JLabel label;
JScrollPane scrollpane;
JScrollPane scrollpane1;
public static void main(String args[]) {
       Client myclient = new Client();
		
		}
public Client()
{
		frame1 = new JFrame("Client");
		tf=new JTextField();
		send=new JButton("Send");
		lout=new JButton("Logout");
		label=new JLabel("Message");
		JPanel panel = new JPanel(); 
		panel.add(label);
        panel.add(tf);
        panel.add(label);
		panel.add(send);
		panel.add(lout);
		panel.add(scrollpane1);	
		panel.add(scrollpane);
		label.setBounds(10,320,80,30);
		tf.setBounds(10,350,220,50);
		send.setBounds(260,350,90,20);
		lout.setBounds(260,375,90,20);
		scrollpane.setBounds(10,20,220,300);
		scrollpane1.setBounds(250,20,120,300);
		
        frame1.add(panel);
		panel.setLayout(null);            	
        frame1.setSize(400,450);
	    frame1.setVisible(true);
		frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	

}

1) place this code line panel.setLayout(null); before placing JComponent

2) variables JScrollPane scrollpane; and JScrollPane scrollpane1; aren't initialized and rest of JComponents

Thanks :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.