title: Java return Component
body: <p>I have a problem with my program.
  I'm working on the gui, and I can't get it to change the view with this line in the class MenuController:</p>
  
  <pre><code>currentComponent = timeRegController.getView().userRegisterTime(user);
  </code></pre>
  
  <p>But I have similar lines, that works just fine. currentComponent an Component that is the current view that the program is showing.</p>
  
  <p>timeRegController.getView() returns a TimeRegistrationPanel called view.</p>
  
  <p>In the class TimeRegistrationPanel I have the following method:</p>
  
  <pre><code>public Component userRegisterTime(User user) {
          JPanel window = new JPanel(new BorderLayout());
          return window;
      }
  </code></pre>
  
  <p>My program says that the problem lies in the line:  </p>
  
  <pre><code>currentComponent = timeRegController.getView().userRegisterTime(user);
  </code></pre>
  
  <p>because userRegisterTime() is undefined for the type Component.</p>