Example usage for javax.swing JScrollPane getViewport

List of usage examples for javax.swing JScrollPane getViewport

Introduction

In this page you can find the example usage for javax.swing JScrollPane getViewport.

Prototype

public JViewport getViewport() 

Source Link

Document

Returns the current JViewport.

Usage

From source file:edu.ku.brc.af.ui.forms.TableViewObj.java

/**
 * Adds a control by name so it can be looked up later.
 * @param formCell the FormCell def that describe the cell
 * @param control the control// ww  w .j av  a2 s  . c om
 */
public void registerControl(final FormCellIFace formCell, final Component control) {
    if (skipControls > 0) {
        return;
    }

    if (formCell != null) {
        String fullCompName = appendName(formCell.getName());

        JScrollPane scrollPane;
        Component comp;
        if (control instanceof JScrollPane) {
            scrollPane = (JScrollPane) control;
            comp = scrollPane.getViewport().getView();

        } else {
            scrollPane = null;
            comp = control;
        }

        String fullId = appendName(formCell.getIdent());
        ColumnInfo colInfo = controlsById.get(fullId);
        if (colInfo == null) {
            colInfo = new ColumnInfo(getParentClassName(), formCell, fullCompName, comp, scrollPane);
            controlsById.put(fullId, colInfo);

        } else {
            colInfo.setFullCompName(fullCompName);
            colInfo.setFormCell(formCell);
        }

        if (StringUtils.isEmpty(colInfo.getLabel())) {
            if (control instanceof JCheckBox) {
                String cbxLabel = ((JCheckBox) control).getText();
                if (StringUtils.isEmpty(cbxLabel)) {
                    cbxLabel = " ";
                }
                colInfo.setLabel(cbxLabel);

            } else {
                colInfo.setLabel(" ");
            }
        }
        colInfo.setComp(comp);
        colInfo.setScrollPane(scrollPane);
        columnList.add(colInfo);
        controlsByName.put(fullCompName, colInfo);
    }

    //log.info("RegControl["+formCell.getName()+"]");
}

From source file:base.BasePlayer.AddGenome.java

public void actionPerformed(ActionEvent event) {
    if (event.getSource() == download) {
        if (!downloading) {
            downloading = true;//  ww w  .  j  a va  2s . c om
            downloadGenome(genometable.getValueAt(genometable.getSelectedRow(), 0).toString());
            downloading = false;
        }
    } else if (event.getSource() == getLinks) {
        URL[] urls = AddGenome.genomeHash
                .get(genometable.getValueAt(genometable.getSelectedRow(), 0).toString());
        JPopupMenu menu = new JPopupMenu();
        JTextArea area = new JTextArea();
        JScrollPane menuscroll = new JScrollPane();
        area.setFont(Main.menuFont);
        menu.add(menuscroll);
        menu.setPreferredSize(new Dimension(
                menu.getFontMetrics(Main.menuFont).stringWidth(urls[0].toString()) + Main.defaultFontSize * 10,
                (int) menu.getFontMetrics(Main.menuFont).getHeight() * 4));
        //area.setMaximumSize(new Dimension(300, 600));
        area.setLineWrap(true);
        area.setWrapStyleWord(true);
        for (int i = 0; i < urls.length; i++) {
            area.append(urls[i].toString() + "\n");
        }

        area.setCaretPosition(0);
        area.revalidate();
        menuscroll.getViewport().add(area);
        menu.pack();
        menu.show(this, 0, 0);

    } else if (event.getSource() == checkEnsembl) {
        if (ensemblfetch) {
            menu.show(AddGenome.treescroll, 0, 0);
        } else {
            EnsemblFetch fetcher = new EnsemblFetch();
            fetcher.execute();
        }
    } else if (event.getSource() == checkUpdates) {
        URL testfile = null;
        try {
            // kattoo onko paivityksia annotaatioon
            String ref = selectedNode.toString();
            if (AddGenome.genomeHash.get(ref) != null) {
                ArrayList<String> testfiles = new ArrayList<String>();
                if (Main.drawCanvas != null) {
                    for (int i = 0; i < Main.genomehash.get(ref).size(); i++) {
                        testfiles.add(Main.genomehash.get(ref).get(i).getName().replace(".bed.gz", ""));
                    }
                }
                testfile = AddGenome.genomeHash.get(ref)[1];
                String result = Main.checkFile(testfile, testfiles);

                if (result.length() == 0) {
                    Main.showError("You have newest annotation file.", "Note");
                } else {
                    int n = JOptionPane.showConfirmDialog(Main.drawCanvas,
                            "New annotation file found: " + result + "\nDownload it now?", "Note",
                            JOptionPane.YES_NO_OPTION);
                    if (n == JOptionPane.YES_OPTION) {
                        URL fileurl = new URL(testfile.getProtocol() + "://" + testfile.getHost()
                                + testfile.getPath().substring(0, testfile.getPath().lastIndexOf("/") + 1)
                                + result);
                        OutputRunner runner = new OutputRunner(fileurl, ref);
                        runner.downloadAnnotation = true;
                        runner.execute();
                    }
                }
            } else {
                Main.showError("This genome is not from Ensembl list, could not check for updates.", "Note",
                        AddGenome.genometable);
            }
        } catch (Exception e) {
            Main.showError("Cannot connect to " + testfile.getHost() + ".\nTry again later.", "Error");
            e.printStackTrace();
        }
    } else if (event.getSource() == remove) {
        if (!selectedNode.isLeaf()) {
            String removeref = selectedNode.toString();
            //   Boolean same = false;
            try {
                if (Main.drawCanvas != null) {
                    if (removeref.equals(Main.refDropdown.getSelectedItem().toString())) {
                        Main.referenceFile.close();
                        //      same = true;
                        if (ChromDraw.exonReader != null) {
                            ChromDraw.exonReader.close();
                        }
                    }
                }
                if (Main.genomehash.containsKey(removeref)) {
                    for (int i = Main.genomehash.get(removeref).size() - 1; i >= 0; i--) {
                        Main.genomehash.get(removeref).remove(i);
                    }
                    Main.genomehash.remove(removeref);

                }
                if (Main.drawCanvas != null) {
                    Main.refModel.removeElement(removeref);
                    Main.refDropdown.removeItem(removeref);
                    Main.refDropdown.revalidate();
                }

                for (int i = 0; i < Main.genome.getItemCount(); i++) {
                    if (Main.genome.getItem(i).getName() != null) {

                        if (Main.genome.getItem(i).getName().equals(removeref)) {
                            Main.genome.remove(Main.genome.getItem(i));
                            break;
                        }
                    }
                }

                FileUtils.deleteDirectory(new File(Main.genomeDir.getCanonicalPath() + "/" + removeref));
                checkGenomes();
                Main.setAnnotationDrop("");

                if (Main.genomehash.size() == 0) {
                    Main.refDropdown.setSelectedIndex(0);
                    Main.setChromDrop("-1");
                }
            } catch (Exception e) {
                e.printStackTrace();
                try {
                    Main.showError("Could not delete genome folder.\nYou can do it manually by deleting folder "
                            + Main.genomeDir.getCanonicalPath() + "/" + removeref, "Note");
                } catch (IOException e1) {

                    e1.printStackTrace();
                }
            }
        } else {
            try {
                if (Main.drawCanvas != null) {
                    if (ChromDraw.exonReader != null) {
                        ChromDraw.exonReader.close();
                    }
                }

                Main.removeAnnotationFile(selectedNode.getParent().toString(), selectedNode.toString());

                FileUtils.deleteDirectory(new File(Main.genomeDir.getCanonicalPath() + "/"
                        + selectedNode.getParent().toString() + "/annotation/" + selectedNode.toString()));

                //   root.remove(selectedNode.getParent().getIndex(selectedNode));
                //   root.remove
                //   checkGenomes();

            } catch (Exception e) {
                e.printStackTrace();
                try {
                    Main.showError("Could not delete genome folder.\nYou can do it manually by deleting folder "
                            + Main.genomeDir.getCanonicalPath() + "/" + selectedNode.getParent().toString()
                            + "/annotation/" + selectedNode.toString(), "Note");
                } catch (IOException e1) {

                    e1.printStackTrace();
                }
            }
            treemodel.removeNodeFromParent(selectedNode);
        }

    } else if (event.getSource() == add) {

        if (genomeFile == null) {
            if (new File(genomeFileText.getText()).exists()) {
                genomeFile = new File(genomeFileText.getText());

            } else {
                genomeFileText.setText("Select reference genome fasta-file.");
                genomeFileText.setForeground(Color.red);
                return;
            }
        }

        /*if(genomeName.getText().contains("Give name") || genomeName.getText().length() == 0) {
           genomeName.setText("Give name of the genome");
           genomeName.setForeground(Color.red);
           genomeName.revalidate();
                   
        }
        else if(!annotation && new File(Main.userDir +"/genomes/"+genomeName.getText().trim().replace("\\s+", "_")).exists()) {
           genomeName.setText("This genome exists already.");
           genomeName.setForeground(Color.red);
           genomeName.revalidate();
        }
        else */

        if ((genomeFileText.getText().length() == 0
                || genomeFileText.getText().startsWith("Select reference"))) {
            genomeFileText.setText("Select reference genome fasta-file.");
            genomeFileText.setForeground(Color.red);
            genomeFileText.revalidate();
        }

        else {

            OutputRunner runner = new OutputRunner(
                    genomeFile.getName().replace(".fasta", "").replace(".gz", ""), genomeFile, annotationFile);
            runner.execute();
        }

    } else if (event.getSource() == openRef) {
        try {

            JFileChooser chooser = new JFileChooser(Main.downloadDir);
            chooser.setMultiSelectionEnabled(false);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            MyFilterFasta fastaFilter = new MyFilterFasta();

            chooser.addChoosableFileFilter(fastaFilter);
            chooser.setDialogTitle("Select reference fasta-file");
            if (Main.screenSize != null) {
                chooser.setPreferredSize(new Dimension((int) Main.screenSize.getWidth() / 3,
                        (int) Main.screenSize.getHeight() / 3));
            }

            int returnVal = chooser.showOpenDialog((Component) this.getParent());

            if (returnVal == JFileChooser.APPROVE_OPTION) {
                genomeFile = chooser.getSelectedFile();
                Main.downloadDir = genomeFile.getParent();
                Main.writeToConfig("DownloadDir=" + genomeFile.getParent());
                genomeFileText.setText(genomeFile.getName());
                genomeFileText.revalidate();
                frame.pack();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    } else if (event.getSource() == openAnno) {
        try {

            JFileChooser chooser = new JFileChooser(Main.downloadDir);
            chooser.setMultiSelectionEnabled(false);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            MyFilterGFF gffFilter = new MyFilterGFF();

            chooser.addChoosableFileFilter(gffFilter);
            chooser.setDialogTitle("Select annotation gff3-file");
            if (Main.screenSize != null) {
                chooser.setPreferredSize(new Dimension((int) Main.screenSize.getWidth() / 3,
                        (int) Main.screenSize.getHeight() / 3));
            }
            int returnVal = chooser.showOpenDialog((Component) this.getParent());

            if (returnVal == JFileChooser.APPROVE_OPTION) {
                if (genomeFile == null) {
                    genomeFile = Main.fastahash.get(Main.hoverGenome);
                }
                annotationFile = chooser.getSelectedFile();
                Main.downloadDir = annotationFile.getParent();
                Main.writeToConfig("DownloadDir=" + annotationFile.getParent());

                OutputRunner runner = new OutputRunner(
                        genomeFile.getName().replace(".fasta", "").replace(".gz", ""), genomeFile,
                        annotationFile);
                runner.execute();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

From source file:de.main.sessioncreator.DesktopApplication1View.java

public void getAreasBacgroundW(File f) {
    fileHelper.getAreas(f);/*from w w  w .  j  a v a 2 s .c  o m*/
    Iterator<Map.Entry<String, List>> it = fileHelper.areaMap.entrySet().iterator();
    while (it.hasNext()) {
        DefaultListModel dlm = new DefaultListModel();
        JList list = new JList(dlm);
        list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        JScrollPane scrollPane = new JScrollPane(list);
        scrollPane.getViewport().setView(list);
        Map.Entry en = it.next();
        wizardtabpAreas.addTab(en.getKey().toString().substring(3), scrollPane);
        for (Object o : fileHelper.areaMap.get(en.getKey().toString())) {
            dlm.addElement(o);
        }
        MouseListener mouseListener = new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent mouseEvent) {
                JList tabList = (JList) mouseEvent.getSource();
                if (mouseEvent.getClickCount() == 2) {
                    int index = tabList.locationToIndex(mouseEvent.getPoint());
                    if (index >= 0) {
                        Object o = tabList.getModel().getElementAt(index);
                        wizardtaChoosenAreas.append(o.toString() + "\n");
                    }
                }
            }
        };
        list.addMouseListener(mouseListener);
        ListSelectionListener listListener = new ListSelectionListener() {

            public void valueChanged(ListSelectionEvent e) {
                JList list = (JList) e.getSource();
                if (e.getValueIsAdjusting() == false) {

                    if (list.getSelectedIndex() == -1) {
                        //No selection, disable add button.
                        wizardbtnAddAreas.setEnabled(false);

                    } else {
                        //Selection, enable the add button.
                        wizardbtnAddAreas.setEnabled(true);
                    }
                }
            }
        };
        list.addListSelectionListener(listListener);
    }
}

From source file:edu.ku.brc.af.ui.forms.FormViewObj.java

@Override
public void registerControl(final FormCellIFace formCell, final Component control) {
    if (formCell != null) {
        boolean isThis = formCell.getName().equals("this");

        if (controlsById.get(formCell.getIdent()) != null) {
            throw new RuntimeException(
                    "Two controls have the same id [" + formCell.getIdent() + "] " + formViewDef.getName());
        }/*from  w w  w .ja va 2s.c  om*/

        if (!isThis && controlsByName.get(formCell.getName()) != null) {
            throw new RuntimeException(
                    "Two controls have the same name [" + formCell.getName() + "] " + formViewDef.getName());
        }

        if (!hasRequiredFields && formCell instanceof FormCellFieldIFace
                && ((FormCellFieldIFace) formCell).isRequired()) {
            hasRequiredFields = true;
        }

        JScrollPane scrPane;
        Component comp;
        if (control instanceof JScrollPane) {
            scrPane = (JScrollPane) control;
            comp = scrPane.getViewport().getView();
        } else {
            scrPane = null;
            comp = control;
        }

        FVOFieldInfo fieldInfo = new FVOFieldInfo(formCell, comp, scrPane, controlsById.size());
        controlsById.put(formCell.getIdent(), fieldInfo);
        if (!isThis) {
            controlsByName.put(formCell.getName(), fieldInfo);
        }
        compsList.add(fieldInfo);

        if (comp instanceof FormControlSaveable) {
            saveableList.add((FormControlSaveable) comp);
        }
    }
}

From source file:edu.ku.brc.af.ui.forms.FormViewObj.java

/**
 * Sets the component into the object/* w w  w.j a  v a  2s .co  m*/
 * @param formComp the UI component that represents this viewable
 */
public void setFormComp(final JComponent formComp) {
    // Remove existing component
    if (this.formComp != null) {
        mainComp.remove(this.formComp);
    }

    // add new component
    if (MultiView.isOptionOn(options, MultiView.NO_SCROLLBARS)) {
        if (ViewFactory.isFormTransparent()) {
            formComp.setOpaque(false);
        }
        this.mainComp.add(formComp, BorderLayout.CENTER);
        this.formComp = formComp;

    } else {
        JScrollPane scrollPane = new JScrollPane(formComp, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scrollPane.getVerticalScrollBar().setUnitIncrement(10);

        scrollPane.setBorder(null);
        this.mainComp.add(scrollPane, BorderLayout.CENTER);
        this.formComp = scrollPane;

        if (ViewFactory.isFormTransparent()) {
            scrollPane.setOpaque(false);
            scrollPane.getViewport().setOpaque(false);
        }
    }

    if (businessRules != null && !hasInitBR) {
        businessRules.initialize(this);
        hasInitBR = true;
    }

    // This is needed to make the form layout correctly
    //XXX I hate that I have to do this
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            //mainComp.invalidate();
            //mainComp.validate();
            //mainComp.doLayout();
            UIRegistry.forceTopFrameRepaint();
        }
    });
}

From source file:base.BasePlayer.FileRead.java

static void setTable(BedTrack track) {

    JScrollPane addpane = new JScrollPane();
    addpane.setPreferredSize(new Dimension(500, 400));
    BedTable add = new BedTable((int) Main.screenSize.width, (int) Main.screenSize.height, addpane, track);

    addpane.getViewport().add(add);
    addpane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
        public void adjustmentValueChanged(AdjustmentEvent event) {
            if (VariantHandler.tabs.getSelectedIndex() > 2) {
                VariantHandler.tables.get(VariantHandler.tabs.getSelectedIndex() - 3).repaint();
            }// w ww.j  a va  2s .  com

        }
    });

    VariantHandler.tables.add(add);
    VariantHandler.tablescrolls.add(addpane);
    track.setTable(add);
    add.resizeTable(VariantHandler.tableScroll.getViewport().getWidth());
    if (track.file != null) {
        /*if(track.file.getName().length() > 10) {
           VariantHandler.tabs.add(track.file.getName().substring(0, 10) +"...", addpane);
           add.setName(track.file.getName().substring(0, 10) +"...");
        }
        else {*/
        VariantHandler.tabs.add(track.file.getName().replace(".pfm", ""), addpane);
        add.setName(track.file.getName());
        // }
    } else {
        /*if(FilenameUtils.getName(track.url.getFile()).length() > 10) {
           VariantHandler.tabs.add(FilenameUtils.getName(track.url.getFile()).substring(0, 10) +"...", addpane);
           add.setName(FilenameUtils.getName(track.url.getFile()).substring(0, 10) +"...");
        }
        else {*/
        VariantHandler.tabs.add(FilenameUtils.getName(track.url.getFile()), addpane);
        add.setName(FilenameUtils.getName(track.url.getFile()));
        // }

    }
    //VariantHandler.clusterTable.addHeaderColumn(track);
    MethodLibrary.addHeaderColumns(track);
    VariantHandler.tabs.revalidate();
}

From source file:base.BasePlayer.Main.java

void setMenuBar() {
    //filemenu.addMouseListener(this);

    //toolmenu.addMouseListener(this);
    filemenu = new JMenu("File");
    toolmenu = new JMenu("Tools");
    help = new JMenu("Help");
    about = new JMenu("About");
    menubar = new JMenuBar();
    //help.addMouseListener(this);
    exit = new JMenuItem("Exit");
    manual = new JButton("Online manual");
    manual.addActionListener(new ActionListener() {

        @Override//from w  w w  .j av  a 2s .c  o m
        public void actionPerformed(ActionEvent arg0) {
            Main.gotoURL("https://baseplayer.fi/BPmanual");
        }

    });
    //   opensamples = new JMenuItem("Add samples");
    zoomout = new JButton("Zoom out");
    back = new JButton("<<");
    forward = new JButton(">>");
    manage = new JButton("Variant Manager");
    openvcfs = new JMenuItem("Add VCFs", open);
    openbams = new JMenuItem("Add BAMs", open);
    average = new JMenuItem("Coverage calculator");
    update = new JMenuItem("Update");
    update.setVisible(false);
    errorlog = new JMenuItem("View log");
    //helpLabel = new JLabel("This is pre-release version of BasePlayer\nContact: help@baseplayer.fi\n\nUniversity of Helsinki");

    addURL = new JMenu("Add from URL");
    urlField = new JTextField("Enter URL");
    addtracks = new JMenuItem("Add tracks");
    fromURL = new JMenuItem("Add track from URL");
    addcontrols = new JMenuItem("Add controls");
    pleiadesButton = new JMenuItem("PLEIADES");
    saveProject = new JMenuItem("Save project");
    saveProjectAs = new JMenuItem("Save project as...");
    openProject = new JMenuItem("Open project");
    clear = new JMenuItem("Clear data");
    clearMemory = new JMenuItem("Clean memory");
    //   welcome = new JMenuItem("Welcome screen");
    filemenu.add(openvcfs);
    filemenu.add(openbams);
    variantCaller = new JMenuItem("Variant Caller");
    tbrowser = new JMenuItem("Table Browser");
    bconvert = new JMenuItem("BED converter");
    peakCaller = new JMenuItem("Peak Caller");
    addtracks = new JMenuItem("Add tracks", open);
    filemenu.add(addtracks);
    addcontrols = new JMenuItem("Add controls", open);
    filemenu.add(addcontrols);
    filemenu.add(fromURL);
    if (pleiades) {
        pleiadesButton.setPreferredSize(buttonDimension);
        pleiadesButton.addActionListener(this);

        filemenu.add(pleiadesButton);
    }

    filemenu.add(new JSeparator());
    openProject = new JMenuItem("Open project", open);
    filemenu.add(openProject);
    saveProject = new JMenuItem("Save project", save);
    filemenu.add(saveProject);
    saveProjectAs = new JMenuItem("Save project as...", save);
    filemenu.add(saveProjectAs);
    filemenu.add(new JSeparator());
    filemenu.add(genome);
    filemenu.add(update);
    filemenu.add(clear);
    filemenu.add(new JSeparator());
    filemenu.add(exit);
    exit.addActionListener(this);
    menubar.add(filemenu);
    manage.addActionListener(this);
    manage.addMouseListener(this);
    update.addActionListener(this);
    average.addActionListener(this);
    average.setEnabled(false);
    average.setToolTipText("No bam/cram files opened");
    tbrowser.addActionListener(this);
    bconvert.addActionListener(this);
    toolmenu.add(tbrowser);
    toolmenu.add(average);
    toolmenu.add(variantCaller);
    toolmenu.add(bconvert);
    fromURL.addMouseListener(this);
    fromURL.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

            final JPopupMenu menu = new JPopupMenu();
            final JTextField area = new JTextField();
            JButton add = new JButton("Fetch");
            JLabel label = new JLabel("Paste track URL below");
            JScrollPane menuscroll = new JScrollPane();
            add.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        String urltext = area.getText().trim();
                        Boolean size = true;
                        if (urltext.contains("pleiades")) {
                            openPleiades(urltext);
                            return;
                        }
                        if (!FileRead.isTrackFile(urltext)) {
                            showError("The file format is not supported.\n"
                                    + "Supported formats: bed, bigwig, bigbed, gff, bedgraph", "Error");
                            return;

                        }
                        if (!urltext.toLowerCase().endsWith(".bw") && !urltext.toLowerCase().endsWith(".bigwig")
                                && !urltext.toLowerCase().endsWith(".bb")
                                && !urltext.toLowerCase().endsWith(".bigbed")) {
                            URL url = null;
                            try {
                                url = new URL(urltext);
                            } catch (Exception ex) {
                                menu.setVisible(false);
                                Main.showError("Please paste whole url (protocol included)", "Error");
                                return;
                            }
                            URL testurl = url;
                            HttpURLConnection huc = (HttpURLConnection) testurl.openConnection();
                            huc.setRequestMethod("HEAD");
                            int responseCode = huc.getResponseCode();

                            if (responseCode != 404) {

                                SeekableStream stream = SeekableStreamFactory.getInstance().getStreamFor(url);
                                TabixReader tabixReader = null;
                                String index = null;

                                try {
                                    if (stream.length() / (double) 1048576 >= Settings.settings
                                            .get("bigFile")) {
                                        size = false;
                                    }
                                    tabixReader = new TabixReader(urltext, urltext + ".tbi", stream);

                                    index = urltext + ".tbi";
                                    testurl = new URL(index);
                                    huc = (HttpURLConnection) testurl.openConnection();
                                    huc.setRequestMethod("HEAD");
                                    responseCode = huc.getResponseCode();

                                    if (responseCode == 404) {
                                        menu.setVisible(false);
                                        Main.showError("Index file (.tbi) not found in the URL.", "Error");

                                        return;
                                    }

                                } catch (Exception ex) {
                                    try {
                                        tabixReader = new TabixReader(urltext,
                                                urltext.substring(0, urltext.indexOf(".gz")) + ".tbi", stream);
                                        index = urltext.substring(0, urltext.indexOf(".gz")) + ".tbi";
                                    } catch (Exception exc) {
                                        menu.setVisible(false);
                                        Main.showError("Could not read tabix file.", "Error");
                                    }
                                }
                                if (tabixReader != null && index != null) {
                                    stream.close();
                                    tabixReader.close();
                                    menu.setVisible(false);
                                    FileRead filereader = new FileRead();
                                    filereader.readBED(urltext, index, size);

                                }

                            } else {
                                menu.setVisible(false);
                                Main.showError("Not a valid URL", "Error");
                            }

                        } else {
                            URL url = null;
                            try {
                                url = new URL(urltext);
                            } catch (Exception ex) {
                                Main.showError("Please paste whole url (protocol included)", "Error");
                                return;
                            }
                            final URL testurl = url;
                            HttpURLConnection huc = (HttpURLConnection) testurl.openConnection();
                            huc.setRequestMethod("HEAD");
                            int responseCode = huc.getResponseCode();

                            if (responseCode != 404) {
                                menu.setVisible(false);
                                FileRead filereader = new FileRead();

                                filereader.readBED(urltext, "nan", true);

                            } else {
                                menu.setVisible(false);
                                Main.showError("Not a valid URL", "Error");
                            }

                        }
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }

                }

            });
            area.setFont(Main.menuFont);
            //area.setText("https://baseplayer.fi/tracks/Mappability_1000Genomes_pilot_mask.bed.gz");
            menu.add(label);
            menu.add(menuscroll);
            menu.add(add);
            area.setPreferredSize(new Dimension(300, Main.defaultFontSize + 8));

            area.setCaretPosition(0);
            area.revalidate();
            menuscroll.getViewport().add(area);
            area.requestFocus();
            menu.pack();

            menu.show(frame, mouseX + 20, fromURL.getY());
        }

    });
    //toolmenu.add(peakCaller);
    variantCaller.setToolTipText("No bam/cram files opened");
    variantCaller.addActionListener(this);
    variantCaller.setEnabled(false);
    peakCaller.setEnabled(true);
    peakCaller.addActionListener(this);
    settings.addActionListener(this);
    clearMemory.addActionListener(this);
    errorlog.addActionListener(this);
    toolmenu.add(clearMemory);
    toolmenu.add(errorlog);
    toolmenu.add(new JSeparator());
    toolmenu.add(settings);
    menubar.add(toolmenu);
    menubar.add(manage);
    area = new JEditorPane();

    String infotext = "<html><h2>BasePlayer</h2>This is a version " + version
            + " of BasePlayer (<a href=https://baseplayer.fi>https://baseplayer.fi</a>)<br/> Author: Riku Katainen <br/> University of Helsinki<br/>"
            + "Tumor Genomics Group (<a href=http://research.med.helsinki.fi/gsb/aaltonen/>http://research.med.helsinki.fi/gsb/aaltonen/</a>) <br/> "
            + "Contact: help@baseplayer.fi <br/> <br/>"

            + "Supported filetype for variants is VCF and VCF.gz (index file will be created if missing)<br/> "
            + "Supported filetypes for reads are BAM and CRAM. Index files required (.bai or .crai). <br/> "
            + "Supported filetypes for additional tracks are BED(.gz), GFF.gz, BedGraph, BigWig, BigBed.<br/> (tabix index required for bgzipped files). <br/><br/> "

            + "For optimal usage, you should have vcf.gz and bam -files for each sample. <br/> "
            + "e.g. in case you have a sample named as sample1, name all files similarly and <br/>"
            + "place in the same folder:<br/>" + "sample1.vcf.gz<br/>" + "sample1.vcf.gz.tbi<br/>"
            + "sample1.bam<br/>" + "sample1.bam.bai<br/><br/>"
            + "When you open sample1.vcf.gz, sample1.bam is recognized and opened<br/>"
            + "on the same track.<br/><br/>"
            + "Instructional videos can be viewed at our <a href=https://www.youtube.com/channel/UCywq-T7W0YPzACyB4LT7Q3g> Youtube channel</a>";
    area = new JEditorPane();
    area.setEditable(false);
    area.setEditorKit(JEditorPane.createEditorKitForContentType("text/html"));
    area.setText(infotext);
    area.setFont(Main.menuFont);
    area.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
            HyperlinkEvent.EventType type = hyperlinkEvent.getEventType();
            final URL url = hyperlinkEvent.getURL();
            if (type == HyperlinkEvent.EventType.ACTIVATED) {
                Main.gotoURL(url.toString());
            }
        }
    });

    about.add(area);
    about.addMouseListener(this);
    help.add(about);
    help.add(manual);
    menubar.add(help);
    JLabel emptylab = new JLabel("  ");
    emptylab.setEnabled(false);
    emptylab.setOpaque(false);
    menubar.add(emptylab);

    chromosomeDropdown.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.lightGray));
    chromosomeDropdown.setBorder(BorderFactory.createCompoundBorder(chromosomeDropdown.getBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));

    chromlabel.setToolTipText("Current chromosome");
    chromlabel.setFocusable(false);
    chromlabel.addMouseListener(this);
    chromlabel.setBackground(Color.white);
    chromlabel.setEditable(false);
    chromlabel.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 0, Color.lightGray));
    chromlabel.setBorder(BorderFactory.createCompoundBorder(chromlabel.getBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));
    menubar.add(chromlabel);
    chromosomeDropdown.setBackground(Color.white);
    chromosomeDropdown.setToolTipText("Current chromosome");
    menubar.add(chromosomeDropdown);
    JLabel empty3 = new JLabel("  ");
    empty3.setEnabled(false);
    empty3.setOpaque(false);
    menubar.add(empty3);
    menubar.add(back);
    menubar.add(searchField);
    searchField.setForeground(Color.gray);
    searchField.setBorder(BorderFactory.createCompoundBorder(searchField.getBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));

    searchField.addMouseListener(this);
    menubar.add(back);
    menubar.add(searchField);
    searchField.setForeground(Color.gray);

    back.addMouseListener(this);
    back.setToolTipText("Back");
    forward.addMouseListener(this);
    forward.setToolTipText("Forward");
    back.setEnabled(false);
    forward.setEnabled(false);

    searchField.addMouseListener(this);

    menubar.add(back);
    menubar.add(searchField);
    searchField.setForeground(Color.gray);
    back.addMouseListener(this);
    forward.addMouseListener(this);
    back.setEnabled(false);
    forward.setEnabled(false);
    forward.setMargin(new Insets(0, 2, 0, 2));
    back.setMargin(new Insets(0, 2, 0, 2));
    menubar.add(forward);
    JLabel empty4 = new JLabel("  ");
    empty4.setOpaque(false);
    empty4.setEnabled(false);
    menubar.add(empty4);
    menubar.add(zoomout);
    JLabel empty5 = new JLabel("  ");
    empty5.setEnabled(false);
    empty5.setOpaque(false);
    menubar.add(empty5);
    positionField.setEditable(false);
    positionField.setBackground(new Color(250, 250, 250));

    positionField.setMargin(new Insets(0, 2, 0, 0));
    positionField.setBorder(BorderFactory.createCompoundBorder(widthLabel.getBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));
    menubar.add(positionField);
    widthLabel.setEditable(false);
    widthLabel.setBackground(new Color(250, 250, 250));
    widthLabel.setMargin(new Insets(0, 2, 0, 0));
    widthLabel.setBorder(BorderFactory.createCompoundBorder(widthLabel.getBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));
    JLabel empty6 = new JLabel("  ");
    empty6.setEnabled(false);
    empty6.setOpaque(false);
    menubar.add(empty6);
    menubar.add(widthLabel);
    JLabel empty7 = new JLabel("  ");
    empty7.setOpaque(false);
    empty7.setEnabled(false);
    menubar.add(empty7);
}

From source file:net.sourceforge.pmd.util.designer.Designer.java

private JComponent createXPathResultPanel() {
    xpathResults.addElement("No XPath results yet, run an XPath Query first.");
    xpathResultList.setBorder(BorderFactory.createLineBorder(Color.black));
    xpathResultList.setFixedCellWidth(300);
    xpathResultList.setCellRenderer(new ASTListCellRenderer());
    xpathResultList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    xpathResultList.getSelectionModel().addListSelectionListener(new ASTSelectionListener());
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.getViewport().setView(xpathResultList);
    return scrollPane;
}

From source file:ome.formats.importer.gui.GuiImporter.java

/**
 * Main entry class for the application/*from ww  w . j  a  v a  2  s .c o m*/
 * 
 * @param config - ImportConfig file
 */
public GuiImporter(ImportConfig config) {
    //super(TITLE);

    //javax.swing.ToolTipManager.sharedInstance().setDismissDelay(0);

    this.setConfig(config);
    this.bounds = config.getUIBounds();

    Level level = org.apache.log4j.Level.toLevel(config.getDebugLevel());
    LogAppender.setLoggingLevel(level);

    historyHandler = new HistoryHandler(this);
    setHistoryTable(historyHandler.table);

    // Add a shutdown hook for when app closes
    Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
            log.debug("Running shutdown hook.");
            shutdown();
        }
    });

    // Set app defaults
    setTitle(config.getAppTitle());
    setIconImage(GuiCommonElements.getImageIcon(GuiImporter.ICON).getImage());
    setPreferredSize(new Dimension(bounds.width, bounds.height));
    setSize(bounds.width, bounds.height);
    setLocation(bounds.x, bounds.y);
    setLayout(new BorderLayout());
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    pack();

    addWindowListener(this);

    // capture move info
    addComponentListener(new ComponentAdapter() {
        public void componentMoved(ComponentEvent evt) {
            bounds = getBounds();
        }
    });

    // capture resize info
    addComponentListener(new ComponentAdapter() {
        public void componentResized(ComponentEvent evt) {
            bounds = getBounds();
        }
    });

    // menu bar
    menubar = new JMenuBar();
    fileMenu = new JMenu("File");
    menubar.add(fileMenu);

    login = new JMenuItem("Login to the server...", GuiCommonElements.getImageIcon(LOGIN_ICON));
    login.setActionCommand("login");
    login.addActionListener(this);
    fileMenu.add(login);
    options = new JMenuItem("Options...", GuiCommonElements.getImageIcon(CONFIG_ICON));
    options.setActionCommand("options");
    options.addActionListener(this);
    fileMenu.add(options);
    fileQuit = new JMenuItem("Quit", GuiCommonElements.getImageIcon(QUIT_ICON));
    fileQuit.setActionCommand("quit");
    fileQuit.addActionListener(this);
    fileMenu.add(fileQuit);
    helpMenu = new JMenu("Help");
    menubar.add(helpMenu);
    helpComment = new JMenuItem("Send a Comment...", GuiCommonElements.getImageIcon(COMMENT_ICON));
    helpComment.setActionCommand("comment");
    helpComment.addActionListener(this);
    helpHome = new JMenuItem("Visit Importer Homepage...", GuiCommonElements.getImageIcon(HOME_ICON));
    helpHome.setActionCommand("home");
    helpHome.addActionListener(this);
    helpForums = new JMenuItem("Visit the OMERO Forums...", GuiCommonElements.getImageIcon(FORUM_ICON));
    helpForums.setActionCommand("forums");
    helpForums.addActionListener(this);
    helpAbout = new JMenuItem("About the Importer...", GuiCommonElements.getImageIcon(ABOUT_ICON));
    helpAbout.setActionCommand("about");
    helpAbout.addActionListener(this);
    helpMenu.add(helpComment);
    helpMenu.add(helpHome);
    helpMenu.add(helpForums);
    // Help --> Show log file location...
    JMenuItem helpShowLog = new JMenuItem("Show log file location...",
            GuiCommonElements.getImageIcon(LOGFILE_ICON));
    helpShowLog.setActionCommand(show_log_file);
    helpShowLog.addActionListener(this);
    helpMenu.add(helpShowLog);
    helpMenu.add(helpAbout);
    // Help --> About
    setJMenuBar(menubar);

    // tabbed panes
    tPane = new JTabbedPane();
    tPane.setOpaque(false); // content panes must be opaque

    // file chooser pane
    JPanel filePanel = new JPanel(new BorderLayout());

    setStatusBar(new StatusBar());
    getStatusBar().setStatusIcon("gfx/server_disconn16.png", "Server disconnected.");
    getStatusBar().setProgress(false, 0, "");
    this.getContentPane().add(getStatusBar(), BorderLayout.SOUTH);

    // The file chooser sub-pane
    setFileQueueHandler(new FileQueueHandler(scanEx, importEx, this, config));
    //splitPane.setResizeWeight(0.5);

    filePanel.add(getFileQueueHandler(), BorderLayout.CENTER);
    tPane.addTab("File Chooser", GuiCommonElements.getImageIcon(CHOOSER_ICON), filePanel,
            "Add and delete images here to the import queue.");
    tPane.setMnemonicAt(0, KeyEvent.VK_1);

    // history pane
    historyPanel = new JPanel();
    historyPanel.setOpaque(false);
    historyPanel.setLayout(new BorderLayout());

    tPane.addTab("Import History", GuiCommonElements.getImageIcon(HISTORY_ICON), historyPanel,
            "Import history is displayed here.");
    tPane.setMnemonicAt(0, KeyEvent.VK_4);

    // output text pane
    JPanel outputPanel = new JPanel();
    outputPanel.setLayout(new BorderLayout());
    outputTextPane = new JTextPane();
    outputTextPane.setEditable(false);

    JScrollPane outputScrollPane = new JScrollPane();
    outputScrollPane.getViewport().add(outputTextPane);

    outputScrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
        public void adjustmentValueChanged(AdjustmentEvent e) {
            try {
                outputTextPane.setCaretPosition(outputTextPane.getDocument().getLength());
            } catch (IllegalArgumentException e1) {
                log.error("Error setting cursor:" + e1);
            }
        }
    });

    outputPanel.add(outputScrollPane, BorderLayout.CENTER);

    tPane.addTab("Output Text", GuiCommonElements.getImageIcon(OUTPUT_ICON), outputPanel,
            "Standard output text goes here.");
    tPane.setMnemonicAt(0, KeyEvent.VK_2);

    // debug pane
    JPanel debugPanel = new JPanel();
    debugPanel.setLayout(new BorderLayout());
    debugTextPane = new JTextPane();
    debugTextPane.setEditable(false);

    JScrollPane debugScrollPane = new JScrollPane();
    debugScrollPane.getViewport().add(debugTextPane);

    debugScrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
        public void adjustmentValueChanged(AdjustmentEvent e) {
            try {
                debugTextPane.setCaretPosition(debugTextPane.getDocument().getLength());
            } catch (IllegalArgumentException e1) {
                log.error("Error setting cursor:" + e1);
            }
        }
    });

    debugPanel.add(debugScrollPane, BorderLayout.CENTER);

    tPane.addTab("Debug Text", GuiCommonElements.getImageIcon(BUG_ICON), debugPanel,
            "Debug messages are displayed here.");
    tPane.setMnemonicAt(0, KeyEvent.VK_3);

    // Error Pane
    errorPanel = new JPanel();
    errorPanel.setOpaque(false);
    errorPanel.setLayout(new BorderLayout());

    tPane.addTab("Import Errors", GuiCommonElements.getImageIcon(ERROR_ICON), errorPanel,
            "Import errors are displayed here.");
    tPane.setMnemonicAt(0, KeyEvent.VK_5);

    tPane.setSelectedIndex(0);

    if (getHistoryTable().db.historyEnabled == false)
        tPane.setEnabledAt(historyTabIndex, false);

    // Add the tabbed pane to this panel.
    add(tPane);

    this.setVisible(false);

    historyPanel.add(historyHandler, BorderLayout.CENTER);
    tPane.setEnabledAt(historyTabIndex, false);

    setLoginHandler(new LoginHandler(this, getHistoryTable()));

    LogAppender.getInstance().setTextArea(debugTextPane);
    appendToOutputLn("> Starting the importer (revision " + getPrintableKeyword(Version.revision) + ").");
    appendToOutputLn("> Build date: " + getPrintableKeyword(Version.revisionDate));
    appendToOutputLn("> Release date: " + Version.releaseDate);

    // TODO : should this be a third executor?
    setErrorHandler(new ErrorHandler(importEx, config));
    getErrorHandler().addObserver(this);
    errorPanel.add(getErrorHandler(), BorderLayout.CENTER);

    macMenuFix();

    //displayLoginDialog(this, true);
}

From source file:org.apache.uima.tools.docanalyzer.DBAnnotationViewerDialog.java

/**
 * Create an AnnotationViewer Dialog/*w  ww  . j av  a 2  s .  c  o m*/
 * 
 * @param aParentFrame
 *          frame containing this panel
 * @param aTitle
 *          title to display for the dialog
 * @param aInputDir
 *          directory containing input files (in XCAS foramt) to read
 * @param aStyleMapFile
 *          filename of style map to be used to view files in HTML
 * @param aPerformanceStats
 *          string representaiton of performance statistics, optional.
 * @param aTypeSystem
 *          the CAS Type System to which the XCAS files must conform.
 * @param aTypesToDisplay
 *          array of types that should be highlighted in the viewer. This can be set to the output
 *          types of the Analysis Engine. A value of null means to display all types.
 */
/*public DBAnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, DBPrefsMediator med,
  File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem,
  final String[] aTypesToDisplay, String interactiveTempFN, boolean javaViewerRBisSelected,
  boolean javaViewerUCRBisSelected, boolean xmlRBisSelected, CAS cas) {
  super(aParentFrame, aDialogTitle);
  // create the AnnotationViewGenerator (for HTML view generation)
  this.med1 = med;
  this.cas = cas;
  annotationViewGenerator = new AnnotationViewGenerator(tempDir);
        
  launchThatViewer(med.getOutputDir(), interactiveTempFN, aTypeSystem, aTypesToDisplay,
    javaViewerRBisSelected, javaViewerUCRBisSelected, xmlRBisSelected, aStyleMapFile,
    tempDir);
}*/

public DBAnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, DBPrefsMediator med,
        File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem, final String[] aTypesToDisplay,
        boolean generatedStyleMap, CAS cas) {

    super(aParentFrame, aDialogTitle);

    this.xmiDAO = med.getXmiDAO();

    this.med1 = med;
    this.cas = cas;

    styleMapFile = aStyleMapFile;
    final String performanceStats = aPerformanceStats;
    typeSystem = aTypeSystem;
    typesToDisplay = aTypesToDisplay;

    // create the AnnotationViewGenerator (for HTML view generation)
    annotationViewGenerator = new AnnotationViewGenerator(tempDir);

    // create StyleMapEditor dialog
    styleMapEditor = new StyleMapEditor(aParentFrame, cas);
    JPanel resultsTitlePanel = new JPanel();
    resultsTitlePanel.setLayout(new BoxLayout(resultsTitlePanel, BoxLayout.Y_AXIS));

    resultsTitlePanel.add(new JLabel("These are the Analyzed Documents."));
    resultsTitlePanel.add(new JLabel("Select viewer type and double-click file to open."));

    try {

        String[] documents = this.xmiDAO.getXMIList();
        analyzedResultsList = new JList(documents);
    } catch (DAOException e) {

        displayError(e.getMessage());
    }

    /*
     * File[] documents = dir.listFiles(); Vector docVector = new Vector(); for (int i = 0; i <
     * documents.length; i++) { if (documents[i].isFile()) { docVector.add(documents[i].getName()); } }
     * final JList analyzedResultsList = new JList(docVector);
     */
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.getViewport().add(analyzedResultsList, null);

    JPanel southernPanel = new JPanel();
    southernPanel.setLayout(new BoxLayout(southernPanel, BoxLayout.Y_AXIS));

    JPanel controlsPanel = new JPanel();
    controlsPanel.setLayout(new SpringLayout());

    Caption displayFormatLabel = new Caption("Results Display Format:");
    controlsPanel.add(displayFormatLabel);

    JPanel displayFormatPanel = new JPanel();
    displayFormatPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    displayFormatPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    javaViewerRB = new JRadioButton("Java Viewer");
    javaViewerUCRB = new JRadioButton("JV user colors");
    htmlRB = new JRadioButton("HTML");
    xmlRB = new JRadioButton("XML");

    ButtonGroup displayFormatButtonGroup = new ButtonGroup();
    displayFormatButtonGroup.add(javaViewerRB);
    displayFormatButtonGroup.add(javaViewerUCRB);
    displayFormatButtonGroup.add(htmlRB);
    displayFormatButtonGroup.add(xmlRB);

    // select the appropraite viewer button according to user's prefs
    javaViewerRB.setSelected(true); // default, overriden below
    if ("Java Viewer".equals(med.getViewType())) {
        javaViewerRB.setSelected(true);
    } else if ("JV User Colors".equals(med.getViewType())) {
        javaViewerUCRB.setSelected(true);
    } else if ("HTML".equals(med.getViewType())) {
        htmlRB.setSelected(true);
    } else if ("XML".equals(med.getViewType())) {
        xmlRB.setSelected(true);
    }

    displayFormatPanel.add(javaViewerRB);
    displayFormatPanel.add(javaViewerUCRB);
    displayFormatPanel.add(htmlRB);
    displayFormatPanel.add(xmlRB);

    controlsPanel.add(displayFormatPanel);

    SpringUtilities.makeCompactGrid(controlsPanel, 1, 2, // rows, cols
            4, 4, // initX, initY
            0, 0); // xPad, yPad

    JButton editStyleMapButton = new JButton("Edit Style Map");

    // event for the editStyleMapButton button
    editStyleMapButton.addActionListener(this);

    southernPanel.add(controlsPanel);

    // southernPanel.add( new JSeparator() );

    JPanel buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    // APL: edit style map feature disabled for SDK
    buttonsPanel.add(editStyleMapButton);

    if (performanceStats != null) {
        JButton perfStatsButton = new JButton("Performance Stats");
        perfStatsButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                JOptionPane.showMessageDialog((Component) ae.getSource(), performanceStats, null,
                        JOptionPane.PLAIN_MESSAGE);
            }
        });
        buttonsPanel.add(perfStatsButton);
    }

    JButton closeButton = new JButton("Close");
    buttonsPanel.add(closeButton);

    southernPanel.add(buttonsPanel);

    // add jlist and panel container to Dialog
    getContentPane().add(resultsTitlePanel, BorderLayout.NORTH);
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    getContentPane().add(southernPanel, BorderLayout.SOUTH);

    // event for the closeButton button
    closeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            DBAnnotationViewerDialog.this.setVisible(false);
        }
    });

    // event for analyzedResultsDialog window closing
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setLF(); // set default look and feel
    analyzedResultsList.setCellRenderer(new MyListCellRenderer());

    // doubleclicking on document shows the annotated result
    MouseListener mouseListener = new ListMouseAdapter();
    // styleMapFile, analyzedResultsList,
    // inputDirPath,typeSystem , typesToDisplay ,
    // javaViewerRB , javaViewerUCRB ,xmlRB ,
    // viewerDirectory , this);

    // add mouse Listener to the list
    analyzedResultsList.addMouseListener(mouseListener);
}