title: Enabling Components on JFrame from JInternalFrame
body: <ol>
  <li><p>I have an JFrame on which there is JMenubar which has several JMenu and JMenuItem.<br>
  I have set allJMenu.setVisible(false) and allJMenuItem.setVisible(false) and  called JInternalFrame(Login Form)</p></li>
  <li><p>JInternalFrame(Login Form) if the username and password are correct than i have to set visiblity true for appropriate JMenu and JMenuItem depending upon type of login(admin,user etc.)</p></li>
  <li><p>How should i achieve this?</p></li>
  </ol>
  
  <p>I tried   it in two ways<br>
  <strong>First Way:</strong>  </p>
  
  <pre><code> public class LoginForm extends javax.swing.JInternalFrame 
        {
           public LoginForm() 
          {
             initComponents();
          }
  
              my code......
  
          if(username==correct &amp;&amp; password==correct)
          {
               //how should i set the JMenu and JMenuItem as visible=true
               //i tried the below code but does not works
  
             Main_JFrame  mi = new Main_JFrame();
             mi.allJMenu.setVisible(true);
             mi.allJMenuItem.setVisible(true);            //doesn't works
  </code></pre>
  
  <p><strong>Second Way:</strong></p>
  
  <pre><code>           Main_JFrame  mi1=new Main_JFrame(); 
             mi1.visibleTrue(mi1.MenuItem1);          
             mi1.visibleTrue(mi1.Menu5);            //doesn't works
          }
        }     
  </code></pre>
  
  <p><strong>visibleTrue</strong> is a method in JFrame Form(Main_JFrame).The method is as below:   </p>
  
  <pre><code>     public void visibleTrue(Component cmp)
      {
         cmp.setVisible(true);
      }
  </code></pre>