I'm trying to create a GUI with java. My gui will be simple. You can see what I want from here : http://sketchtoy.com/64839370
In order to do that, I have decided to use BorderLayout as suggested on the web. I have two Jpanel object and I have put them into jFrame whose layout is borderlayout. You can see my simplified code below :
private Display display= new Display(); // Display extends JPanel 
public Simulation()
    {
        super();
        // frame settings 
        setTitle("Label of JFrame ");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setBounds(100,100,1094,560);    
        contentPane=this.getContentPane();
        setResizable(false);
        contentPane.setLayout(new BorderLayout());
        try {
            LeftPanelLogo=ImageIO.read(new File("logo.png"));
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        // generate left panel (information panel)
        leftPanel=new JPanel(){
            @Override
            public void paintComponent(Graphics g)
            {
                super.paintComponent(g);
                Graphics2D g2d=(Graphics2D)g;
                g2d.drawImage(LeftPanelLogo, 10, 250, null);
            }
        };
        //leftPanel.setLayout(null);
        // add panels to contentPane 
        leftPanel.setBackground(Color.WHITE);
        display.setBackground(Color.BLACK);
        contentPane.add(leftPanel,BorderLayout.WEST);
        contentPane.add(display,BorderLayout.CENTER);
}
In Display class constructor I have only the following code:
try 
        {
            bgPicture = ImageIO.read(new File("bg.jpg"));
        } 
        catch (IOException e) 
        {
            e.printStackTrace();
        }
When I run the code, I saw that almost all the screen is fulfilled with the panel which is on the center, and I could not see the leftPanel, (in other words, all screen was black since I set the background of display panel to black)
So, how could I fix it ?
 
     
    