popup.add(item4); popup.add(item5);
    private void init() throws Exception {        setLayout(new BorderLayout());        JPanel topPanel = new JPanel();        topPanel.setLayout(new GridBagLayout());        JPanel bottomPanel = new JPanel();        bottomPanel.setLayout(new BorderLayout());        item1 = new JMenuItem("Abbrechen");        item2 = new JMenuItem("Pause/Fortsetzen");        item4 = new JMenuItem("Umbenennen");        item5 = new JMenuItem("Zielordner ndern");        item6 = new JMenuItem("Fertige bertragungen entfernen");        item7 = new JMenuItem("Download verstecken");        item8 = new JCheckBoxMenuItem("Versteckte Downloads anzeigen");        //todo        item4.setEnabled(false);        item5.setEnabled(false);        //        popup.add(item1);        popup.add(item2);        popup.add(item4);        popup.add(item5);        popup.add(item6);/*        popup.add(new JPopupMenu.Separator());        popup.add(item7);        popup.add(item8);*/        item1.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                Object[] selectedItems = getSelectedDownloadItems();                if (selectedItems != null && selectedItems.length != 0) {                    int result = JOptionPane.showConfirmDialog(null, "Wollen Sie wirklich diese Downloads abbrechen", "Besttigung",                            JOptionPane.YES_NO_OPTION);                    if (result == JOptionPane.YES_OPTION) {                        ArrayList indizesAbbrechen = new ArrayList();                        for (int i = 0; i < selectedItems.length; i++) {                            if (selectedItems[i].getClass() == DownloadMainNode.class) {                                DownloadDO downloadDO = ((DownloadMainNode) selectedItems[i]).getDownloadDO();                                indizesAbbrechen.add(new Integer(downloadDO.getId()));                            }                        }                        int size = indizesAbbrechen.size();                        if (size > 0) {                            int[] abbrechen = new int[size];                            for (int i = 0; i < size; i++) {                                abbrechen[i] = ((Integer) indizesAbbrechen.get(i)).intValue();                            }                            ApplejuiceFassade.getInstance().cancelDownload(abbrechen);                        }                    }                }            }        });        item2.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                Object[] selectedItems = getSelectedDownloadItems();                if (selectedItems != null && selectedItems.length != 0) {                    ArrayList indizesPausieren = new ArrayList();                    ArrayList indizesFortsetzen = new ArrayList();                    for (int i = 0; i < selectedItems.length; i++) {                        if (selectedItems[i].getClass() == DownloadMainNode.class) {                            DownloadDO downloadDO = ((DownloadMainNode) selectedItems[i]).getDownloadDO();                            if (downloadDO.getStatus() == DownloadDO.PAUSIERT) {                                indizesFortsetzen.add(new Integer(downloadDO.getId()));                            }                            else {                                indizesPausieren.add(new Integer(downloadDO.getId()));                            }                        }                    }                    int size = indizesPausieren.size();                    if (size > 0) {                        int[] pausieren = new int[size];                        for (int i = 0; i < size; i++) {                            pausieren[i] = ((Integer) indizesPausieren.get(i)).intValue();                        }                        ApplejuiceFassade.getInstance().pauseDownload(pausieren);                    }                    size = indizesFortsetzen.size();                    if (size > 0) {                        int[] fortsetzen = new int[size];                        for (int i = 0; i < size; i++) {                            fortsetzen[i] = ((Integer) indizesFortsetzen.get(i)).intValue();                        }                        ApplejuiceFassade.getInstance().resumeDownload(fortsetzen);                    }                }            }        });        item6.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                ApplejuiceFassade.getInstance().cleanDownloadList();            }        });/*        item7.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                Object[] selectedItems = getSelectedDownloadItems();                if (selectedItems != null && selectedItems.length != 0) {                    DownloadRootNode root = (DownloadRootNode) downloadModel.getRoot();                    for (int i = 0; i < selectedItems.length; i++) {                        if (selectedItems[i].getClass() == DownloadMainNode.class) {                            root.alterVerstecke((DownloadMainNode) selectedItems[i]);                        }                    }                    downloadTable.updateUI();                }            }        });        item8.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                DownloadRootNode root = (DownloadRootNode) downloadModel.getRoot();                root.enableVerstecke(!item8.isSelected());                downloadTable.updateUI();            }        });     */        GridBagConstraints constraints = new GridBagConstraints();        constraints.anchor = GridBagConstraints.NORTH;        constraints.fill = GridBagConstraints.BOTH;        constraints.gridx = 0;        constraints.gridy = 0;        constraints.gridwidth = 3;        constraints.gridheight = 1;        JPanel tempPanel = new JPanel();        tempPanel.setLayout(new BorderLayout());        tempPanel.add(linkLabel, BorderLayout.WEST);        tempPanel.add(downloadLink, BorderLayout.CENTER);        tempPanel.add(btnStartDownload, BorderLayout.EAST);        topPanel.add(tempPanel, constraints);        constraints.gridwidth = 3;        constraints.gridx = 0;        constraints.gridy = 1;        constraints.weighty = 1;        constraints.weightx = 1;        downloadLink.addKeyListener(new KeyAdapter() {            public void keyPressed(KeyEvent ke) {                if (ke.getKeyCode() == KeyEvent.VK_ENTER) {                    btnStartDownload.doClick();                }            }        });        downloadModel = new DownloadModel();        downloadTable = new JTreeTable(downloadModel);        DownloadTableCellRenderer renderer = new DownloadTableCellRenderer();        for (int i = 1; i < downloadTable.getColumnModel().getColumnCount(); i++) {            downloadTable.getColumnModel().getColumn(i).setCellRenderer(renderer);        }        btnStartDownload.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ae) {                startDownload();            }        });        aScrollPane = new JScrollPane(downloadTable);        downloadTable.addMouseListener(new MouseAdapter() {            public void mouseClicked(MouseEvent e) {                super.mouseClicked(e);                Point p = e.getPoint();                int selectedRow = downloadTable.rowAtPoint(p);                Object node = ((TreeTableModelAdapter) downloadTable.getModel()).nodeForRow(selectedRow);                if (downloadTable.columnAtPoint(p) != 0) {                    if (e.getClickCount() == 2) {                        ((TreeTableModelAdapter) downloadTable.getModel()).expandOrCollapseRow(selectedRow);                    }                }                if (node.getClass() == DownloadMainNode.class                        && ((DownloadMainNode) node).getType() == DownloadMainNode.ROOT_NODE) {                    powerDownloadPanel.btnPdl.setEnabled(true);                    downloadDOOverviewPanel.setDownloadDO(((DownloadMainNode) node).getDownloadDO());                }                else if (node.getClass() == DownloadSourceDO.class) {                    powerDownloadPanel.btnPdl.setEnabled(true);                    if (((DownloadSourceDO) node).getQueuePosition() <= 20) {                        downloadDOOverviewPanel.setDownloadSourceDO((DownloadSourceDO) node);                    }                }                else {                    powerDownloadPanel.btnPdl.setEnabled(false);                }            }            public void mousePressed(MouseEvent me) {                super.mousePressed(me);                maybeShowPopup(me);            }            public void mouseReleased(MouseEvent e) {                super.mouseReleased(e);                maybeShowPopup(e);            }            private void maybeShowPopup(MouseEvent e) {                if (e.isPopupTrigger()) {                    /*DownloadRootNode root = (DownloadRootNode) downloadModel.getRoot();                    item8.setSelected(!root.isVerstecktEnabled());*/                    popup.show(downloadTable, e.getX(), e.getY());                }            }        });        topPanel.add(aScrollPane, constraints);        bottomPanel.add(powerDownloadPanel, BorderLayout.WEST);        bottomPanel.add(downloadDOOverviewPanel, BorderLayout.CENTER);        add(topPanel, BorderLayout.CENTER);        add(bottomPanel, BorderLayout.SOUTH);        SortButtonRenderer renderer2 = new SortButtonRenderer();        TableColumnModel model = downloadTable.getColumnModel();        int n = model.getColumnCount();        for (int i = 0; i < n; i++) {            model.getColumn(i).setHeaderRenderer(renderer2);        }        JTableHeader header = downloadTable.getTableHeader();        header.addMouseListener(new SortMouseAdapter(header, renderer2));        downloadTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);        ApplejuiceFassade.getInstance().addDataUpdateListener(this, DataUpdateListener.DOWNLOAD_CHANGED);    }