title: External JPanel classs does not show correctly in Main JFrame class
body: <p>basically I'm trying to understand Threads in Java.So I thought I'd create a main JFrame class containing two JPanels from external classes and then do something in one and control it with messages from the second panel.So far I have only created the first external panel and there the probleme starts! It does not show correctly although it appears to be "loaded".(see system.out lines)
  So here is the Main Class</p>
  
  <pre><code>package com.maybee.gui;
  
  import java.awt.*;
  import javax.swing.*;
   import javax.swing.border.LineBorder;
  
  public class Maybee extends JFrame implements Runnable 
  {
  public JFrame  maynFrame = null;
  public JPanel contentPanel = null;
  public SimPanel simPanel = null;
  
  public int screenWidth = 0;
  public int screenHeight = 0;
  
  public Maybee()
  {
  
  }
  
  
  private void init()
  {
      System.out.println("In Inint");
      maynFrame = new JFrame("Maybee");
      maynFrame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
      screenWidth = gd.getDisplayMode().getWidth();
      screenHeight = gd.getDisplayMode().getHeight();
      maynFrame.setPreferredSize(new Dimension(screenWidth,screenHeight - 100));
      maynFrame.setContentPane(getContentPanel());
      maynFrame.setVisible(true);
      maynFrame.pack();
  }
  
  public JPanel getContentPanel()
  {
      if (contentPanel == null)
      {
          contentPanel = new JPanel();
          contentPanel.setPreferredSize(new Dimension(screenWidth,screenHeight - 100));
          contentPanel.setBorder(new LineBorder(Color.BLUE));
          contentPanel.setBackground(Color.RED);
          contentPanel.setLayout(new BorderLayout());
          contentPanel.add(getSimPanel(),BorderLayout.CENTER);
  
      }
  
      return contentPanel;
  }
  
  public SimPanel getSimPanel()
  {
      if(simPanel == null)
      {
          simPanel = new SimPanel(this);
  
      }
      return simPanel;
  }
  
  
  public static void main(String[] args)
  {
  
      EventQueue.invokeLater(new Runnable() 
      {
          public void run()
          {
              System.out.println("Start");
              Maybee maybee =  new Maybee();
              maybee.run();
  
          }
  
      });
  }
  
  public void run()
  {
      init();
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and now the first external JPanel class</p>
  
  <pre><code>package com.maybee.gui;
  
  import java.awt.BorderLayout;
  import java.awt.Color;
  import java.awt.Dimension;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  import javax.swing.JButton;
  import javax.swing.JPanel;
  
  public class SimPanel extends JPanel
  {
     public Maybee localMaybee = null;
     public JPanel simPanel = null;
     private JButton btn;
  
     public SimPanel(Maybee interMaybee)
    {
      localMaybee = interMaybee;
      init();
    }
  
    public void init()
    {
      simPanel = new JPanel();
      simPanel.setLayout(new BorderLayout());
      simPanel.setPreferredSize(new Dimension(localMaybee.screenWidth/4,localMaybee.screenHeight - 100));
      simPanel.setBackground(Color.GREEN);
      simPanel.add(getBtn(),BorderLayout.CENTER);
      simPanel.setVisible(true);
  
      System.out.println("IN SIM" + localMaybee.screenWidth);
  }
  
  public JButton getBtn()
  {
      if(btn == null)
      {
          btn = new JButton("ENDE");
          btn.setSize(70, 20);
          btn.setForeground(Color.YELLOW);
          btn.addActionListener(new ActionListener()
          {
  
              @Override
              public void actionPerformed(ActionEvent e) 
              {
  
  
              }
          });
  
      }
      return btn; 
  }
  }
  </code></pre>
  
  <p>So what am I missing?</p>
  
  <p>Many thanks!</p>