Package com.kokakiwi.mclauncher.ui.simple.components

Examples of com.kokakiwi.mclauncher.ui.simple.components.TransparentPanel


    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");
       
View Full Code Here


        panel.validate();
    }
   
    private Component center(Component c)
    {
        final TransparentPanel tp = new TransparentPanel(new GridBagLayout());
        tp.add(c);
        return tp;
    }
View Full Code Here

TOP

Related Classes of com.kokakiwi.mclauncher.ui.simple.components.TransparentPanel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.