I have uploaded a specific portion of my code and i hope that this will suffice to understand my problem. I'm using the p6 panel in a frame which has multiple buttons and one of the buttons display this panel. 
This panel p6 has two buttons. One clicking check_api, the program requires some time to execute and to the user, it would seem as if the application has hung. Therefore I tried adding a method which would show a waiting message while the button is busy. But on doing that, my panels lose their user defined size.
Is there a way to display a wait message without compromising on my panel size?
public static void prepare_url(JPanel p6, JPanel content, int count) {
    InnerOperations.removeexcept(6, content);
    if (count != 1) {
        p6.removeAll();
        p6.revalidate();
        System.out.println("Count is greater than 1");
    }
    JPanel p_back = new JPanel();
    JTextField field = new JTextField(" Enter url(s) with delimiter ';'");
    JButton check_list = new JButton(" CHECK URL LIST STATUS");
    JButton check_api = new JButton(" CHECK  PREDEFINED API LIST");
    p_back.add(check_list);
    p_back.add(field);
    p_back.add(l_check);
    p_back.add(check_api);
    check_api.setBounds(200, 130, 400, 30);
    l_check.setBounds(50, 300, 600, 20);
    field.setBounds(200, 50, 400, 30);
    check_list.setBounds(200, 90, 400, 30);
    p6.add(p_back);
    p_back.setBounds(0, 0, 800, 600);
    check_list.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String url_pref 
            String list[] = url_pref.split(";");
            int i = 0;
            while (i < list.length) {
                try {
                    // thread1.start();
                    prepareurl(p6, p_back, list, list.length);
                    // thread1.stop();
                } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
                i++;
            }
        }
    });
    check_api.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // thread2.start();
            // p_back.removeAll();
            //check_api.setText("Will load in a while");
            prepare_api(p6, content, p_back);
            // thread2.stop();
        }
    });
}
public static void userwait(JPanel ppanel)
{
    JLabel waiting = new JLabel();
    ppanel.add(waiting);
    waiting.setText("Please Wait......");
    waiting.setBounds(200, 200, 400, 30);
}   
 
     
     
    