title: adding swing components at run time in netbeans
body: <p>i have learnt core java and just started working with <strong>netbeans</strong>,but i am stuck at a point when i was trying to add the components like buttons,labels etc. at the run time in my project.I searched for it on google but the examples which i studied include some extra overhead of using panels in them,,,,but why  can't i create the components at run time as i was creating them in the simple editor like <strong>notepad</strong> as follows</p>
  
  <pre><code>JButton b4=new JButton("ok");
  add b4;
  </code></pre>
  
  <p>its not working.</p>