private void buildLoginBox(boolean offline)
    {
        loginBox.removeAll();
        loginBox.setLayout(new BorderLayout(0, 8));
        
        final TransparentPanel titles = new TransparentPanel();
        titles.setLayout(new GridLayout(0, 1, 0, 2));
        
        titles.add(new TransparentLabel(Translater
                .getString("login.usernameLabel") + " :", 4));
        titles.add(new TransparentLabel(Translater
                .getString("login.passwordLabel") + " :", 4));
        titles.add(new TransparentLabel("", 4));
        
        titles.setInsets(0, 0, 0, 4);
        
        final TransparentPanel fields = new TransparentPanel();
        fields.setLayout(new GridLayout(0, 1, 0, 2));
        
        fields.add(userName);
        fields.add(password);
        fields.add(rememberMe);
        
        final TransparentPanel buttons = new TransparentPanel();
        buttons.setLayout(new GridLayout(0, 1, 0, 2));
        
        if (offline)
        {
            final TransparentButton optionsButton = new TransparentButton(
                    Translater.getString("login.retryButton"));
            optionsButton.addActionListener(new ActionListener() {
                
                public void actionPerformed(ActionEvent e)
                {
                    buildLoginBox(false);
                }
            });
            buttons.add(optionsButton);
            
            final TransparentButton loginButton = new TransparentButton(
                    Translater.getString("login.offlineButton"));
            loginButton.addActionListener(new ActionListener() {
                
                public void actionPerformed(ActionEvent e)
                {
                    new OptionsDialog(api).setVisible(true);
                }
            });
            buttons.add(loginButton);
        }
        else
        {
            final TransparentButton optionsButton = new TransparentButton(
                    Translater.getString("login.optionsButton"));
            optionsButton.addActionListener(new ActionListener() {
                
                public void actionPerformed(ActionEvent e)
                {
                    new OptionsDialog(api).setVisible(true);
                }
            });
            buttons.add(optionsButton);
            
            final TransparentButton loginButton = new TransparentButton(
                    Translater.getString("login.loginButton"));
            loginButton.addActionListener(new ActionListener() {
                
                public void actionPerformed(ActionEvent e)
                {
                    statusText.setText(Translater.getString("login.loginning"));
                    
                    new Thread(new Runnable() {
                        
                        public void run()
                        {
                            String result = null;
                            
                            if (!api.getConfig()
                                    .getBoolean("login.offlineMode"))
                            {
                                result = api.getLoginer().doLogin(
                                        userName.getText(),
                                        new String(password.getPassword()),
                                        rememberMe.isSelected());
                            }
                            else
                            {
                                api.getLoginer().getLastLogin()
                                        .setUsername(userName.getText());
                                api.getLoginer().getLastLogin()
                                        .setSessionId("123456");
                                api.getLoginer().getLastLogin().setTimestamp(0);
                                api.getLoginer().getLastLogin()
                                        .setDownloadTicket("12345");
                                if (rememberMe.isSelected())
                                {
                                    try
                                    {
                                        api.getLoginer().storeLogin(userName.getText(), "lolilol");
                                    }
                                    catch (Exception e)
                                    {
                                        e.printStackTrace();
                                    }
                                }
                            }
                            
                            if (result == null)
                            {
                                api.getTimeLine().next();
                            }
                            else
                            {
                                statusText.setText(result);
                                
                                if (!result.equalsIgnoreCase("Bad login"))
                                {
                                    buildLoginBox(true);
                                }
                            }
                        }
                    }).start();
                }
            });
            buttons.add(loginButton);
        }
        
        buttons.add(new TransparentPanel());
        
        buttons.setInsets(0, 10, 0, 10);
        
        loginBox.add(titles, "West");
        loginBox.add(fields, "Center");
        loginBox.add(buttons, "East");
        
        panel.validate();
    }