else{ nickJTextField1.setText(""); } if (nickname2 != null){ nickJTextField2.setText(nickname2); } else{ nickJTextField2.setText(""); } if (nickname3 != null){ nickJTextField3.setText(nickname3); } else{ nickJTextField3.setText("");
else { Random random = new Random(); nickJTextField1.setText("ajPluginUser" + Integer.toString(random.nextInt(99999))); connectButton.setEnabled(true);
    private void makeConnectionInfo() {        dialog = new JDialog(AppleJuiceDialog.getApp(), connectionInfo, true);        Container dialogContentPane = dialog.getContentPane();        // Ok, let's make the UserInfo        JPanel userInfo = new JPanel();        userInfo.setBorder(makeBorder(" User Info "));        JLabel label1 = new JLabel("Nickname1: ");        JLabel label2 = new JLabel("Nickname2: ");        JLabel label3 = new JLabel("Nickname3: ");        nickJTextField1 = new JTextField(25);        nickJTextField1.addKeyListener(new KeyAdapter() {            public void keyPressed(KeyEvent ke) {                if (nickJTextField1.getText().length() != 0)                {                    connectButton.setEnabled(true);                }                else                {                    connectButton.setEnabled(false);                }            }        });        nickJTextField2 = new JTextField(25);        nickJTextField3 = new JTextField(25);        Box box1 = Box.createHorizontalBox();        box1.add(label1);        box1.add(nickJTextField1);        Box box2 = Box.createHorizontalBox();        box2.add(label2);        box2.add(nickJTextField2);        Box box3 = Box.createHorizontalBox();        box3.add(label3);        box3.add(nickJTextField3);        Box box4 = Box.createVerticalBox();        box4.add(box1);        box4.add(box2);        box4.add(box3);        if (nickname != null){            nickJTextField1.setText(nickname);        }        else{            nickJTextField1.setText("");        }        if (nickname2 != null){            nickJTextField2.setText(nickname2);        }        else{            nickJTextField2.setText("");        }        if (nickname3 != null){            nickJTextField3.setText(nickname3);        }        else{            nickJTextField3.setText("");        }        userInfo.add("Center", box4);        JPanel buttonPanel = new JPanel();        buttonPanel.setBorder(BorderFactory.createCompoundBorder(                BorderFactory.createLineBorder(Color.black, 1),                BorderFactory.createRaisedBevelBorder()        ));        connectButton.setBorder(makeButtonBorder());        connectButton.setEnabled(false);        cancelButton.setBorder(makeButtonBorder());        // Action Listener        connectButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                // OK, let's set the nickname if user has mentioned it                if (nickJTextField1.getText().length() == 0)                {                    dialog.dispose();                    return;                }                if (nickJTextField1.getText() != null)                {                    setNickname(nickJTextField1.getText());                }                if (nickJTextField1.getText() == null)                {                    Random random = new Random();                    setNickname("XDCC" + Integer.toString(random.nextInt(99999)));                }                if (nickJTextField2.getText() != null)                {                    nickname2 = nickJTextField2.getText();                }                if (nickJTextField3.getText() != null)                {                    nickname3 = nickJTextField3.getText();                }                host = "irc.bongster.de";                tabUpdate("Init Window", " Connecting to: irc.bongster.de");                connectStartRegister();                dialog.dispose();            }        });        cancelButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                dialog.dispose();                dialog = null;            }        });        buttonPanel.add(connectButton);        buttonPanel.add(cancelButton);        dialogContentPane.add("North", userInfo);        dialogContentPane.add("South", buttonPanel);        dialog.pack();        dialog.setLocationRelativeTo(this);        dialog.show();    }