I don't use the pack() method.
I have solved the problem.If the setVisible() methos is called
when the JFrame object is created it's contents ara also visible without resizing.anyhow helpme with the pack()method().
code:****************************************************
import javax.swing.*;
import java.awt.*;
public class SampJFrame extends JFrame
{
public SampJFrame()
{
setSize(400,400);
setTitle("Mr.Clean,The Disk_Space Optimizer");
String spac=" ";
Container con=getContentPane();
JLabel title=new JLabel(spac+"Kick out uninvited Guests R..i..g..h..t NOW!!");
JPanel p1=new JPanel();
p1.setLayout(new BorderLayout());
p1.add("North",title);
JTextArea lfile=new JTextArea("",10,30);
lfile.setEditable(false);
lfile.setLineWrap(true);
JScrollPane jsp=new JScrollPane(lfile);
JPanel p2=new JPanel();
p2.setLayout(new BorderLayout());
p2.add("Center",
jsp);
con.setLayout(new BorderLayout());
con.add("North",p1);
con.add("Center",p2);
}
public static void main(String args[])
{
new SampJFrame().setVisible(true);
}
}
end of code: ***************************************