Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set GridLayout for a JPanel that is inside JFrame having BorderLayout

 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the following code, I am getting the run time error, Please help



Runtime error is coming for the following lines,


 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have this
private JLabel ...,...,lbladdress,lblage;

then this
lbladdress=new JLabel("Address");
lbladdress=new JLabel("Age");

look odd?
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even after making JLabel public doesn't solve my problem as when I run the program I am getting Exception in thread "main" java.lang.NullPointerException
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
read *every* word in my reply (hint: look for duplicates)
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was really my very silly mistake Thanks alot Michael
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic