title: JLabel Not Showing When resetting JFrame to setVisible(true)
body: <p>I have created an Abstract Class for common things to be useful in my entire program</p>
  <pre><code>public interface Global {
  
  static final String regexdate=&quot;^(((0[1-9]|[12][0-9]|3[01])[- /.](0[13578]|1[02])|(0[1-9]|[12][0-9]|30)[- /.](0[469]|11)|(0[1-9]|1\\d|2[0-8])[- /.]02)[- /.]\\d{4}|29[- /.]02[- /.](\\d{2}(0[48]|[2468][048]|[13579][26])|([02468][048]|[1359][26])00))$&quot;;
  static final String regexemail=&quot;\\b[\\w\\.-]+@[\\w\\.-]+\\.\\w{2,4}+\\b$&quot;;
  static final String regexalpha=&quot;\\b[a-zA-Z .]+\\b$&quot;;
  static final String regexnumbersonly=&quot;\\b[^a-zA-Z ,.+-]*\\d\\b$&quot;;
  static final String regexalphaonly=&quot;\\b[a-zA-Z]+\\b$&quot;;
  //address would allow any character case insensitive and numbers (for house number) &quot;-&quot;  space &quot;,&quot; and &quot;/&quot;
  static final String regexaddress=&quot;\\b[a-zA-Z\\s 0-9-,/\\n]*\\b$&quot;;
  static final String regexalphanumeric=&quot;\\b[a-zA-Z0-9 .]+\\b$&quot;;
  static final String regexisbn=&quot;\\b[0-9-]+\\b$&quot;;
  static final String regexdecimals=&quot;\\b[^a-zA-Z ,+-]*\\d\\b$&quot;;
  // single character datatype validation regex
  static final String regexchar=&quot;^[.a-zA-Z\s]+$&quot;;
  
  static LocalDate localDate = LocalDate.now();
  static DayOfWeek dayofweek=localDate.getDayOfWeek();
  static int dayofmonth=localDate.getDayOfMonth();
  static Month  monthofyear=localDate.getMonth();
  static int year=localDate.getYear();
  static String properday=dayofweek.toString().substring(0,1)+dayofweek.toString().substring(1,3).toLowerCase();
  static String propermonth=monthofyear.toString().substring(0, 1)+monthofyear.toString().substring(1, 3).toLowerCase();
  static String dayfull=properday+&quot; &quot;+Integer.valueOf(dayofmonth)+&quot;-&quot;+propermonth+&quot;-&quot;+Integer.valueOf(year).toString().substring(2,4);
  
  static final Font myfont=new Font(&quot;Serg UI&quot;,Font.PLAIN,16);
  static final Font myfontheader=new Font(&quot;Serg UI&quot;,Font.BOLD,20);
  static final Font myfonttoget=new Font(&quot;serg UI&quot;,Font.CENTER_BASELINE,16);
  static final Color mybackground= new Color(231, 231, 231);
  public JLabel title=new JLabel(&quot;Library Management System&quot;,SwingConstants.LEFT);
  public JLabel welcome=new JLabel (&quot;Welcome :-&quot;,SwingConstants.LEFT);
  public JLabel ctandd=new JLabel(dayfull);
  </code></pre>
  <p>}</p>
  <p>Now I have two separate classes where i am using all of above as required</p>
  <pre><code>    admintitle.setBounds(0,0,900,49);
      title.setBounds(310, 10, 335,20);
      welcome.setBounds(1, 0, 130, 20);
      ctandd.setBounds(790, 5,225, 20);
      totalmem.setBounds(1, 25,100, 20);
      
      
      adminpanel.setBackground(new Color(1,3,45));
      
      JLabel addvalue=new JLabel(&quot;10&quot;);
      addvalue.setFont(myfont);
      addvalue.setForeground(Color.WHITE);
      addvalue.setSize(20, 20);
      today.add(addvalue);
  
      lmember.setAlignmentX(Component.LEFT_ALIGNMENT);
      separator.setAlignmentX(Component.LEFT_ALIGNMENT);
      addmem.setAlignmentX(Component.CENTER_ALIGNMENT);
      modifymem.setAlignmentX(Component.CENTER_ALIGNMENT);
      delmem.setAlignmentX(Component.CENTER_ALIGNMENT);
      admintitle.add(title);
      admintitle.add(welcome);
      admintitle.add(ctandd);
      admintitle.add(totalmem);
      
      adminpanel.add(lmember);
      adminpanel.add(separator);
      adminpanel.add(addmem);
      adminpanel.add(modifymem);
      adminpanel.add(delmem);
      adminpanel.add(separator1);
      adminpanel.add(lbook);
      adminpanel.add(separator2);
      adminpanel.add(addbook);
      adminpanel.add(modifyinven);
      adminpanel.add(delbook);
      adminpanel.add(separator3);
      adminpanel.add(lrepo);
      adminpanel.add(penaltyrepo);
      adminpanel.add(separator4);
      adminpanel.add(newrequest);
      adminpanel.add(exit);
      
      
      
  
      admindisplay.add(totaldue);
      admindisplay.add(totalpenalty);
      admindisplay.add(penaltyamt);
      admindisplay.add(memadded);
      admindisplay.add(booksadded);
      admindisplay.add(bookslost);
      admindisplay.add(booksoverdue);
      admindisplay.add(memdiscontinued);
      admindisplay.add(newbookrequest);
      admindisplay.add(memhead);
      admindisplay.add(separator5);
      admindisplay.add(bookhead);
      admindisplay.add(separator6);
      admindisplay.add(summary);
      admindisplay.add(today);
      admindisplay.add(weekly);
      admindisplay.add(monthly);
      admindisplay.add(yearly);
  
      admin.add(admintitle);
      admin.add(adminpanel);
      admin.add(admindisplay);
      admin.setVisible(true);
      System.out.println(admin.getComponentCount());
      System.out.println(admin.getComponentZOrder(title));
      System.out.println(admindisplay.getComponentCount());
      System.out.println(adminpanel.getComponentCount());
      System.out.println(admintitle.getComponentCount());
      
      
  } // end of admin ui
  </code></pre>
  <p>from this class when I click on a button I navigate to another class</p>
  <pre><code>    addmem.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
          // do login code
          
          admin.setVisible(false);
          uiaddmem.caddmemUI(admin);
      }});
      
  </code></pre>
  <p>In another class I do something and upon user clicking back button I come back to this JFrame</p>
  <pre><code>            back.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e) {
      
            modmember.setVisible(false);
            admin.setVisible(true);
            admin.toFront();
            admin.validate();
              System.out.println(admin.getComponentCount());
              System.out.println(admin.getComponentZOrder(title));
              System.out.println(admintitle.getComponentCount());
              
          }});
  </code></pre>
  <p>Eveything works fine except that my title, welcome, total and ctandd just disappear from the first JFrame when I make admin.setVisible(true) as above.
  As you can see I have done componentcount the numbers show that the three labels should be there also I individually tried sysout title.isDisplayable() title.isVisible()
  title.isShowing() all of these are true but still the title, welcome, ctandd is not displayed when I return to my admin JFrame</p>