ApplejuiceFassade.getInstance().processLink(newServerDialog. getLink());
final String link = newServerDialog. getLink(); new Thread(){ public void run(){ ApplejuiceFassade.getInstance().processLink(link); } }.start();
    private void init() throws Exception {        setLayout(new BorderLayout());        LanguageSelector.getInstance().addLanguageListener(this);        sucheServer.setForeground(Color.BLUE);        IconManager im = IconManager.getInstance();        item1 = new JMenuItem("Verbinden");        item1.setIcon(im.getIcon("serververbinden"));        item5 = new JMenuItem("Hinzufgen");        item5.setIcon(im.getIcon("serverneu"));        item2 = new JMenuItem("Lschen");        item2.setIcon(im.getIcon("serverloeschen"));        item3 = new JMenuItem("Hinzufgen");        item3.setIcon(im.getIcon("serverneu"));        item4 = new JMenuItem("Hinzufgen");        item4.setIcon(im.getIcon("serverneu"));        item6 = new JMenuItem("Lschen");        item6.setIcon(im.getIcon("serverloeschen"));        itemCopyToClipboard = new JMenuItem("Link in Ablage kopieren");        itemCopyToClipboard.setIcon(im.getIcon("clipboard"));        popup.add(item1);        popup.add(item4);        popup.add(itemCopyToClipboard);        popup.add(item2);        popup2.add(item3);        popup3.add(item5);        popup3.add(item6);        item1.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                int selected = serverTable.getSelectedRow();                ServerDO server = (ServerDO) ( (ServerTableModel) serverTable.                                              getModel()).                    getRow(selected);                if (ApplejuiceFassade.getInstance().getInformation().                    getVerbindungsStatus() == Information.VERBUNDEN) {                    int result = JOptionPane.showConfirmDialog(AppleJuiceDialog.                        getApp(), warnungNachricht, warnungTitel,                        JOptionPane.YES_NO_OPTION);                    if (result != JOptionPane.YES_OPTION) {                        return;                    }                }                ApplejuiceFassade.getInstance().connectToServer(server.                    getID());                SoundPlayer.getInstance().playSound(SoundPlayer.VERBINDEN);            }        });        ActionListener loescheServerListener = new ActionListener() {            public void actionPerformed(ActionEvent ae) {                int selected[] = serverTable.getSelectedRows();                if (selected.length > 0) {                    ServerDO server = null;                    for (int i = 0; i < selected.length; i++) {                        server = (ServerDO) ( (ServerTableModel) serverTable.                                             getModel()).                            getRow(selected[i]);                        if (server != null) {                            ApplejuiceFassade.getInstance().entferneServer(                                server.getID());                        }                    }                }            }        };        ActionListener clipboardListener = new ActionListener() {            public void actionPerformed(ActionEvent ae) {                int[] selectedItems = serverTable.getSelectedRows();                if (selectedItems.length == 1) {                    Clipboard cb = Toolkit.getDefaultToolkit().                        getSystemClipboard();                    StringBuffer toCopy = new StringBuffer();                    toCopy.append("ajfsp://server|");                    ServerDO serverDO = (ServerDO) ( (ServerTableModel)                        serverTable.                        getModel()).getRow(selectedItems[0]);                    toCopy.append(serverDO.getHost());                    toCopy.append("|");                    toCopy.append(serverDO.getPort());                    toCopy.append("/");                    StringSelection contents = new StringSelection(                        toCopy.toString());                    cb.setContents(contents, null);                }            }        };        itemCopyToClipboard.addActionListener(clipboardListener);        item2.addActionListener(loescheServerListener);        item6.addActionListener(loescheServerListener);        ActionListener newServerListener = new ActionListener() {            public void actionPerformed(ActionEvent ae) {                NewServerDialog newServerDialog = new NewServerDialog(                    AppleJuiceDialog.getApp(), true);                Dimension appDimension = newServerDialog.getSize();                Dimension screenSize = Toolkit.getDefaultToolkit().                    getScreenSize();                newServerDialog.setLocation( (screenSize.width -                                              appDimension.width) / 2,                                            (screenSize.height -                                             appDimension.height) / 2);                newServerDialog.show();                if (newServerDialog.isLegal()) {                    ApplejuiceFassade.getInstance().processLink(newServerDialog.                        getLink());                }            }        };        item3.addActionListener(newServerListener);        item4.addActionListener(newServerListener);        item5.addActionListener(newServerListener);        JPanel panel1 = new JPanel();        panel1.setLayout(new GridBagLayout());        GridBagConstraints constraints = new GridBagConstraints();        constraints.anchor = GridBagConstraints.NORTH;        constraints.fill = GridBagConstraints.BOTH;        constraints.gridx = 0;        constraints.gridy = 0;        sucheServer.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                Thread worker = new Thread() {                    public void run() {                        ApplejuiceFassade af = ApplejuiceFassade.getInstance();                        String[] server = af.getNetworkKnownServers();                        if (server == null || server.length == 0) {                            return;                        }                        for (int i = 0; i < server.length; i++) {                            af.processLink(server[i]);                        }                    }                };                worker.start();            }        });        panel1.add(sucheServer, constraints);        constraints.gridx = 1;        constraints.weightx = 1;        panel1.add(new JLabel(), constraints);        add(panel1, BorderLayout.NORTH);        serverTable = new JTable();        serverTable.setModel(new ServerTableModel());        serverTable.setShowGrid(false);        serverTable.setSelectionMode(ListSelectionModel.                                     MULTIPLE_INTERVAL_SELECTION);        SortButtonRenderer renderer = new SortButtonRenderer();        TableColumnModel model = serverTable.getColumnModel();        int n = model.getColumnCount();        for (int i = 0; i < n; i++) {            model.getColumn(i).setHeaderRenderer(renderer);            model.getColumn(i).setPreferredWidth(model.getColumn(i).getWidth());        }        JTableHeader header = serverTable.getTableHeader();        header.addMouseListener(new HeaderListener(header, renderer));        TableColumn tc = serverTable.getColumnModel().getColumn(0);        tc.setCellRenderer(new ServerTableCellRenderer());        final JScrollPane aScrollPane = new JScrollPane(serverTable);        aScrollPane.setBackground(serverTable.getBackground());        serverTable.getTableHeader().setBackground(serverTable.getBackground());        aScrollPane.getViewport().setOpaque(false);        MouseAdapter popupMouseAdapter = new MouseAdapter() {            public void mousePressed(MouseEvent me) {                super.mouseReleased(me);                maybeShowPopup(me);            }            public void mouseReleased(MouseEvent e) {                super.mouseReleased(e);                maybeShowPopup(e);            }            private void maybeShowPopup(MouseEvent e) {                if (e.isPopupTrigger()) {                    int selectedRow = serverTable.rowAtPoint(e.getPoint());                    if (selectedRow != -1) {                        if (serverTable.getSelectedRowCount() == 0) {                            serverTable.setRowSelectionInterval(selectedRow,                                selectedRow);                        }                        else {                            int[] currentSelectedRows = serverTable.                                getSelectedRows();                            for (int i = 0; i < currentSelectedRows.length; i++) {                                if (currentSelectedRows[i] == selectedRow) {                                    selectedRow = -1;                                    break;                                }                            }                            if (selectedRow != -1) {                                serverTable.setRowSelectionInterval(selectedRow,                                    selectedRow);                            }                        }                    }                    if (serverTable.getSelectedRowCount() == 1) {                        popup.show(aScrollPane, e.getX(), e.getY());                    }                    else if (serverTable.getSelectedRowCount() > 1) {                        popup3.show(aScrollPane, e.getX(), e.getY());                    }                    else {                        popup2.show(aScrollPane, e.getX(), e.getY());                    }                }            }        };        aScrollPane.addMouseListener(popupMouseAdapter);        serverTable.addMouseListener(popupMouseAdapter);        add(aScrollPane, BorderLayout.CENTER);        JPanel legende = new JPanel(new FlowLayout());        ImageIcon icon1 = im.getIcon("serververbunden");        ImageIcon icon2 = im.getIcon("serverversuche");        ImageIcon icon3 = im.getIcon("aelter24h");        ImageIcon icon4 = im.getIcon("juenger24h");        JLabel label1 = new JLabel(icon1);        JLabel label2 = new JLabel(icon2);        JLabel label3 = new JLabel(icon3);        JLabel label4 = new JLabel(icon4);        legende.add(label1);        legende.add(verbunden);        legende.add(label2);        legende.add(versucheZuVerbinden);        legende.add(label3);        legende.add(aelter24h);        legende.add(label4);        legende.add(juenger24h);        add(legende, BorderLayout.SOUTH);        ApplejuiceFassade.getInstance().addDataUpdateListener(this,            DataUpdateListener.SERVER_CHANGED);    }