title: how to find out a java Component being displayed on screen
body: <p>I want to find out if a JPanel is on the screen or not. It doesn't mean that <code>isVisible()</code> method could be used for this situation. I mean I want to find out whether a component that has been initiated before, presently is one of components on my main panel or not.</p>
  
  <p>Edit and more explanation: I have several panels initiated before in my program and use them on my form as needed. I want to know for example <code>jpanel1</code> in now on any of panels that now are present on my form.</p>
  
  <p>Example:</p>
  
  <pre><code>public class GUI extends JFrame() {
  
      private JPanel1, jPanel2;
  
      public static void main(String[] args) {
          GUI gui = new GUI();
          jPanel1 = new JPanel();
          jPanel2 = new JPanel();
          gui.setContentpane(jPanel1);
          gui.setVisible(true);
      }
  
  }
  </code></pre>
  
  <p>now <code>jPanel1</code> is visible on screen bu <code>jPanel2</code> is not visible.
  How can I find out this?</p>