Example usage for javax.swing.event ListSelectionListener ListSelectionListener

List of usage examples for javax.swing.event ListSelectionListener ListSelectionListener

Introduction

In this page you can find the example usage for javax.swing.event ListSelectionListener ListSelectionListener.

Prototype

ListSelectionListener

Source Link

Usage

From source file:au.org.ala.delta.editor.ui.ItemEditor.java

/**
 * Adds the event handlers to the UI components.
 *//*from w  ww. j  a va2  s.  c  o m*/
private void addEventHandlers(ActionMap map) {
    spinner.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            if (_editsDisabled) {
                return;
            }

            updateItemSelection((Integer) spinner.getValue());
        }
    });

    rtfEditor.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent e) {
            itemEditPerformed();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            itemEditPerformed();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            itemEditPerformed();
        }
    });
    rtfEditor.addKeyListener(new SelectionNavigationKeyListener() {

        @Override
        protected void advanceSelection() {
            _validator.verify(rtfEditor);
        }

    });
    taxonSelectionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    taxonSelectionList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (_editsDisabled) {
                return;
            }
            _selectedItem = _dataSet.getItem(taxonSelectionList.getSelectedIndex() + 1);
            updateDisplay();
        }
    });

    btnDone.setAction(map.get("itemEditDone"));
    chckbxTreatAsVariant.setAction(map.get("itemVarianceChanged"));
    btnSelect.setAction(map.get("selectItemByName"));
    taxonSelectionList.setSelectionAction(map.get("taxonSelected"));
    _validator = new TextComponentValidator(new ItemValidator(), this);

    // Give the item description text area focus.
    addInternalFrameListener(new InternalFrameAdapter() {
        @Override
        public void internalFrameActivated(InternalFrameEvent e) {
            rtfEditor.requestFocusInWindow();
        }
    });
}

From source file:edu.ku.brc.ui.tmanfe.SearchReplacePanel.java

/**
 * detects when a table changes has been made and changes the next, previous buttons, as well as
 * clears the status label. //from   w  w w.  jav  a 2s  . c  o m
 */
public void handleTableSelections() {
    listSelectionListener = new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                nextButton.setEnabled(true);
                previousButton.setEnabled(true);
                updateStatusLabel(-1, false);
            }
        }
    };
    table.getSelectionModel().addListSelectionListener(listSelectionListener);
}

From source file:edu.ku.brc.specify.plugins.TaxonLabelFormatting.java

@Override
public void initialize(Properties propertiesArg, boolean isViewModeArg) {
    super.initialize(propertiesArg, isViewModeArg);

    String plName = "TaxonLabelFormatter";
    PickListDBAdapterIFace adapter = PickListDBAdapterFactory.getInstance().create(plName, false);
    if (adapter == null || adapter.getPickList() == null) {
        throw new RuntimeException("PickList Adapter [" + plName + "] cannot be null!");
    }//from   w  w  w  .j a  v a 2  s .com
    formatCBX = new ValComboBox(adapter);
    formatCBX.getComboBox().addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doFormatting();
        }
    });
    formatCBX.getComboBox().addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            doFormatting();
        }
    });

    newAgentBtn = createButton(""); // Label set when new Resource Bundle is installed (below)
    searchPanel = new DBObjSearchPanel("Search", "AgentNameSearch", "AgentNameSearch",
            "edu.ku.brc.specify.datamodel.Agent", "agentId", SwingConstants.BOTTOM);
    searchPanel.getScrollPane().setMinimumSize(new Dimension(100, 200));
    searchPanel.getScrollPane().setPreferredSize(new Dimension(100, 150));
    ((FormViewObj) searchPanel.getForm()).getPanel().setBorder(null);

    try {
        UIRegistry.loadAndPushResourceBundle("specify_plugins");

        newAgentBtn.setText(getResourceString("NewAgent"));

        authorsList = new JList(new DefaultListModel());
        authorsList.setVisibleRowCount(10);
        authorsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    Object selObj = authorsList.getSelectedValue();
                    if (selObj != null) {

                    }
                    updateEnabledState();
                }
            }
        });
        JScrollPane scrollPane = new JScrollPane(authorsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

        mapToBtn = createIconBtn("Map", "ADD_AUTHOR_NAME_TT", new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                Object agent = searchPanel.getSelectedObject();
                ((DefaultListModel) authorsList.getModel()).addElement(agent);
                doFormatting();
            }
        });
        unmapBtn = createIconBtn("Unmap", "REMOVE_AUTHOR_NAME_TT", new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                int index = authorsList.getSelectedIndex();
                if (index > -1) {
                    DefaultListModel model = (DefaultListModel) authorsList.getModel();
                    model.remove(index);
                    updateEnabledState();
                    doFormatting();
                }
            }
        });

        upBtn = createIconBtn("ReorderUp", "MOVE_AUTHOR_NAME_UP", new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                DefaultListModel model = (DefaultListModel) authorsList.getModel();
                int index = authorsList.getSelectedIndex();
                Object item = authorsList.getSelectedValue();
                model.remove(index);
                model.insertElementAt(item, index - 1);
                authorsList.setSelectedIndex(index - 1);
                updateEnabledState();
            }
        });
        downBtn = createIconBtn("ReorderDown", "MOVE_AUTHOR_NAME_DOWN", new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                DefaultListModel model = (DefaultListModel) authorsList.getModel();
                int index = authorsList.getSelectedIndex();
                Object item = authorsList.getSelectedValue();
                model.remove(index);
                model.insertElementAt(item, index + 1);
                authorsList.setSelectedIndex(index + 1);
                updateEnabledState();
            }
        });

        PanelBuilder bldr = new PanelBuilder(new FormLayout("p, 5px, p, 5px, f:p:g, 2px, p",
                "p, 4px, p, 2px, f:p:g, 4px, p, 4px, p, 2px, p, 2px, p, 2px, p"), this);
        CellConstraints cc = new CellConstraints();

        PanelBuilder upDownPanel = new PanelBuilder(new FormLayout("p", "p, 2px, p, f:p:g"));
        upDownPanel.add(upBtn, cc.xy(1, 1));
        upDownPanel.add(downBtn, cc.xy(1, 3));

        PanelBuilder middlePanel = new PanelBuilder(new FormLayout("c:p:g", "f:p:g, p, 2px, p, f:p:g"));
        middlePanel.add(mapToBtn, cc.xy(1, 2));
        middlePanel.add(unmapBtn, cc.xy(1, 4));

        PanelBuilder rwPanel = new PanelBuilder(new FormLayout("p, 2px, f:p:g", "p"));
        refWorkLabel = createLabel(getResourceString("NONE"));
        rwPanel.add(createI18NFormLabel("REFERENCEWORK"), cc.xy(1, 1));
        rwPanel.add(refWorkLabel, cc.xy(3, 1));

        int y = 1;

        bldr.add(rwPanel.getPanel(), cc.xywh(1, y, 7, 1));
        y += 2;

        bldr.add(searchPanel, cc.xywh(1, y, 1, 3));
        bldr.addSeparator(getResourceString("Authors"), cc.xy(5, y));
        y += 2;

        bldr.add(middlePanel.getPanel(), cc.xy(3, y));
        bldr.add(scrollPane, cc.xywh(5, y, 1, 3));
        bldr.add(upDownPanel.getPanel(), cc.xy(7, y));
        y += 2;

        PanelBuilder newAgentPanel = new PanelBuilder(new FormLayout("f:p:g,p", "p"));
        newAgentPanel.add(newAgentBtn, cc.xy(2, 1));

        bldr.add(newAgentPanel.getPanel(), cc.xy(1, y));
        y += 2;

        JLabel fmtLabel = createLabel(getResourceString("LABELFORMAT"));
        bldr.add(fmtLabel, cc.xy(1, y));
        y += 2;
        bldr.add(formatCBX, cc.xywh(1, y, 7, 1));
        y += 2;

        Font plain = fmtLabel.getFont();
        specialLabel = new SpecialLabel(plain, new Font(plain.getName(), Font.ITALIC, plain.getSize()));
        specialLabel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
        bldr.add(createLabel(getResourceString("SAMPLEOUTPUT") + ":"), cc.xywh(1, y, 7, 1));
        y += 2;
        bldr.add(specialLabel, cc.xywh(1, y, 7, 1));

        searchPanel.setOKBtn(mapToBtn);
    } catch (Exception ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(TaxonLabelFormatting.class, ex);
        log.error(ex);
        ex.printStackTrace();
    }
    UIRegistry.popResourceBundle();
}

From source file:com.stanley.captioner.MainFrame.java

private void initListeners() {
    videoTable.getModel().addTableModelListener(new TableModelListener() {
        @Override//from   w w  w .  j a v  a 2  s . c  o  m
        public void tableChanged(TableModelEvent e) {
            if (e.getType() == TableModelEvent.INSERT || e.getType() == TableModelEvent.DELETE) {
                if (videoTable.getRowCount() > 0) {
                    clearButton.setEnabled(true);
                    if (outputDirectoryField.getText() != null && outputDirectoryField.getText().length() > 0) {
                        convertButton.setEnabled(true);
                    } else {
                        convertButton.setEnabled(false);
                    }
                } else {
                    clearButton.setEnabled(false);
                    convertButton.setEnabled(false);
                }
            }
        }
    });

    videoTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (videoTable.getSelectedRowCount() > 0) {
                removeButton.setEnabled(true);
            } else {
                removeButton.setEnabled(false);
            }
        }
    });
}

From source file:edu.ku.brc.specify.tools.schemalocale.SchemaToolsDlg.java

@Override
public void createUI() {
    setOkLabel(getResourceString("CLOSE"));

    super.createUI();

    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

    Vector<DisplayLocale> localeDisplays = new Vector<DisplayLocale>();
    for (Locale locale : SchemaLocalizerDlg.getLocalesInUseInDB(schemaType)) {
        localeDisplays.add(new DisplayLocale(locale));
    }//from w  w  w. j  av  a  2  s  .c  o m

    localeList = new JList(localeDisplays);
    JScrollPane sp = UIHelper.createScrollPane(localeList, true);

    CellConstraints cc = new CellConstraints();

    PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,2px,p,16px,p,4px,p,8px,p,10px"));
    builder.addSeparator(getResourceString("SL_LOCALES_IN_USE"), cc.xywh(1, 1, 3, 1));
    builder.add(sp, cc.xywh(1, 3, 3, 1));

    builder.addSeparator(getResourceString("SL_TASKS"), cc.xywh(1, 5, 3, 1));
    builder.add(editSchemaBtn, cc.xy(1, 7));
    builder.add(removeLocaleBtn, cc.xy(3, 7));
    builder.add(exportSchemaLocBtn, cc.xy(1, 9));
    builder.add(importSchemaLocBtn, cc.xy(3, 9));

    builder.setDefaultDialogBorder();

    contentPanel = builder.getPanel();
    mainPanel.add(contentPanel, BorderLayout.CENTER);

    enableBtns(false);

    localeList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            localeSelected();
        }
    });
    localeList.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent me) {
            if (me.getClickCount() == 2) {
                editSchema();
            }
        }
    });

    editSchemaBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent arg0) {
            editSchema();
        }
    });

    removeLocaleBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent arg0) {
            removeSchemaLocale();
        }
    });

    exportSchemaLocBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent arg0) {
            exportSchemaLocales();
        }
    });

    importSchemaLocBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent arg0) {
            chooseImportType();
        }
    });

    pack();
}

From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowserAdvancedFilter.java

private void initContentSearchTable() {
    contentSearchTable/*from  w  w w  .ja  v a 2 s . co  m*/
            .setModel(new DefaultTableModel(new Object[][] {}, new String[] { "Content Type", "Contains" }) {
                public boolean isCellEditable(int rowIndex, int columnIndex) {
                    return true;
                }
            });

    contentSearchTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    contentSearchTable.setDragEnabled(false);
    contentSearchTable.setSortable(false);
    contentSearchTable.getTableHeader().setReorderingAllowed(false);

    contentSearchTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            deleteContentSearchButton.setEnabled(getSelectedRow(contentSearchTable) != -1);
        }
    });

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        contentSearchTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }

    TableColumn column = contentSearchTable.getColumnModel().getColumn(0);
    column.setCellRenderer(new MirthComboBoxTableCellRenderer(ContentType.getDisplayValues()));
    column.setCellEditor(new MirthComboBoxTableCellEditor(contentSearchTable, ContentType.getDisplayValues(), 1,
            false, null));
    column.setMinWidth(CONTENT_TYPE_COLUMN_WIDTH);
    column.setMaxWidth(CONTENT_TYPE_COLUMN_WIDTH);

    deleteContentSearchButton.setEnabled(false);
}

From source file:com.mirth.connect.client.ui.attachments.RegexAttachmentDialog.java

private void initInboundReplacementTable() {
    inboundReplacementTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    DefaultTableModel model = new DefaultTableModel(new Object[][] {},
            new String[] { "Replace All", "Replace With" }) {
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return true;
        }/*w ww.ja v  a 2s . c  o  m*/
    };

    inboundReplacementTable.setSortable(false);
    inboundReplacementTable.getTableHeader().setReorderingAllowed(false);
    inboundReplacementTable.setModel(model);

    inboundReplacementTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            inboundDeleteButton.setEnabled(inboundReplacementTable.getSelectedRow() != -1);
        }
    });

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        inboundReplacementTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }

    inboundDeleteButton.setEnabled(false);
}

From source file:logdruid.ui.mainpanel.EventRecordingSelectorPanel.java

/**
 * Create the panel.//from www .  j ava 2 s .  c  o  m
 */
public EventRecordingSelectorPanel(final Repository rep, Source src) {
    repository = rep;
    source = src;
    records = rep.getRecordings(EventRecording.class);
    // Collections.sort(records);
    Iterator it = records.iterator();
    while (it.hasNext()) {
        Recording record = (Recording) it.next();
        data.add(new Object[] { record.getName(), record.getRegexp(), record.getType(),
                src.isActiveRecordingOnSource(record) });
    }

    model = new logdruid.ui.mainpanel.EventRecordingSelectorPanel.MyTableModel(data, header);
    logger.info("source is " + ((source == null) ? "null" : src.getSourceName()));
    JPanel panel_1 = new JPanel();
    GridBagConstraints gbc_panel_1 = new GridBagConstraints();
    gbc_panel_1.fill = GridBagConstraints.BOTH;
    gbc_panel_1.insets = new Insets(5, 0, 5, 5);
    gbc_panel_1.gridx = 1;
    gbc_panel_1.gridy = 0;
    panel_1.setLayout(new BorderLayout(0, 0));

    table = new JTable(model);
    JScrollPane scrollPane = new JScrollPane(table);
    panel_1.add(scrollPane, BorderLayout.CENTER);

    table.setPreferredScrollableViewportSize(new Dimension(0, 150));
    table.setFillsViewportHeight(true);
    table.setAutoCreateRowSorter(true);

    // Set up column sizes.
    initColumnSizes(table);

    setLayout(new BorderLayout(0, 0));

    JSplitPane splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    add(splitPane);
    jPanelDetail = new JPanel();
    splitPane.setBottomComponent(jPanelDetail);
    splitPane.setTopComponent(panel_1);

    GridBagConstraints gbc_jPanelDetail = new GridBagConstraints();
    gbc_jPanelDetail.insets = new Insets(0, 0, 0, 5);
    gbc_jPanelDetail.fill = GridBagConstraints.BOTH;
    gbc_jPanelDetail.gridx = 1;
    gbc_jPanelDetail.gridy = 3;
    jPanelDetail.setLayout(new BorderLayout(0, 0));
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            int selectedRow = ((table.getSelectedRow() != -1)
                    ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1);
            logger.info("ListSelectionListener - selectedRow: " + selectedRow);
            if (selectedRow >= 0) {
                if (jPanelDetail != null) {
                    logger.debug("ListSelectionListener - valueChanged");
                    jPanelDetail.removeAll();
                    recEditor = getEditor(repository.getRecording(EventRecording.class, selectedRow));
                    if (recEditor != null) {
                        jPanelDetail.add(recEditor, BorderLayout.CENTER);
                    }
                    jPanelDetail.revalidate();
                }
            }
        }
    });
    if (repository.getRecordings(EventRecording.class).size() > 0) {
        recEditor = getEditor(repository.getRecording(EventRecording.class, 0));
        jPanelDetail.add(recEditor, BorderLayout.CENTER);
        table.setRowSelectionInterval(0, 0);
    }
    if (model.getRowCount() > 0) {
        table.getRowSorter().toggleSortOrder(0);
        table.setRowSelectionInterval(0, 0);
    }
}

From source file:edu.ku.brc.specify.plugins.ipadexporter.ManageDataSetsDlg.java

@SuppressWarnings({ "unchecked" })
@Override/*from ww  w.  j a v  a2 s  .c om*/
public void createUI() {
    loadAndPushResourceBundle(iPadDBExporterPlugin.RESOURCE_NAME);
    setTitle(getResourceString("MNG_DS"));
    try {
        ActionListener addUsrAction = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                addUserToDS();
            }
        };
        ActionListener delUsrAction = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                removeUserFromDS();
            }
        };
        ActionListener delDSAction = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                removeDS();
            }
        };
        CellConstraints cc = new CellConstraints();
        PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,2px,p,2px,p, 12px, p,2px,p,2px,p"));

        JLabel dsLabel = createI18NLabel("YOUR_DATASETS");
        dataSetList = new JList(dataSetModel = new DefaultListModel());
        JScrollPane dsSp = createScrollPane(dataSetList, true);
        dsEDAPanel = new EditDeleteAddPanel(null, delDSAction, null);

        JLabel usrLabel = createI18NLabel("USRS_PER_DATASETS");
        usrList = new JList(usrModel = new DefaultListModel());
        JScrollPane usrSp = createScrollPane(usrList, true);
        usrEDAPanel = new EditDeleteAddPanel(null, delUsrAction, addUsrAction);
        contentPanel = pb.getPanel();

        int y = 1;
        pb.add(dsLabel, cc.xy(1, y));
        y += 2;
        pb.add(dsSp, cc.xy(1, y));
        y += 2;
        pb.add(dsEDAPanel, cc.xy(1, y));
        y += 2;

        pb.add(usrLabel, cc.xy(1, y));
        y += 2;
        pb.add(usrSp, cc.xy(1, y));
        y += 2;
        pb.add(usrEDAPanel, cc.xy(1, y));
        y += 2;

        pb.setDefaultDialogBorder();

        loadDataSetsIntoJList();

        dataSetList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    loadUsersForDataSetsIntoJList();

                    boolean isSelected = dataSetList.getSelectedIndex() > -1;
                    if (isSelected) {
                        dsEDAPanel.getDelBtn().setEnabled(true);
                        usrEDAPanel.getAddBtn().setEnabled(true);
                    }
                    dsEDAPanel.getDelBtn().setEnabled(isSelected);
                    usrEDAPanel.getAddBtn().setEnabled(isSelected);
                }
            }
        });

        usrList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    boolean isSelected = usrList.getSelectedIndex() > -1;
                    if (isSelected) {
                        usrEDAPanel.getDelBtn().setEnabled(true);
                    }
                    usrEDAPanel.getDelBtn().setEnabled(isSelected);
                }
            }
        });

    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        popResourceBundle();
    }
    super.createUI();
}

From source file:au.org.ala.delta.intkey.ui.OpenDataSetDialog.java

public OpenDataSetDialog(Frame owner, List<Pair<String, String>> datasetIndexData, File startBrowseDirectory) {
    super(owner, true);
    setPreferredSize(new Dimension(450, 300));

    ActionMap actionMap = Application.getInstance().getContext().getActionMap(this);
    ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(OpenDataSetDialog.class);
    resourceMap.injectFields(this);

    setTitle(title);//from w  w  w .  j  av a2  s .c  om

    _selectedDatasetPath = null;

    _pnlList = new JPanel();
    _pnlList.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(_pnlList, BorderLayout.CENTER);
    _pnlList.setLayout(new BorderLayout(0, 0));

    _lblSelectByTitle = new JLabel(selectByTitleCaption);
    _pnlList.add(_lblSelectByTitle, BorderLayout.NORTH);

    _sclPnList = new JScrollPane();
    _pnlList.add(_sclPnList, BorderLayout.CENTER);

    _listDatasetIndex = new JList();
    _sclPnList.setViewportView(_listDatasetIndex);

    _pnlBottom = new JPanel();
    _pnlBottom.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(_pnlBottom, BorderLayout.SOUTH);
    _pnlBottom.setLayout(new BorderLayout(0, 0));

    _lblSelectByFileName = new JLabel(selectByFileCaption);
    _pnlBottom.add(_lblSelectByFileName, BorderLayout.NORTH);

    _pnlButtons = new JPanel();
    _pnlButtons.setBorder(new EmptyBorder(10, 0, 0, 0));
    _pnlBottom.add(_pnlButtons, BorderLayout.SOUTH);

    _btnOK = new JButton();
    _btnOK.setAction(actionMap.get("OpenDataSetDialog_OK"));
    _pnlButtons.add(_btnOK);

    _btnCancel = new JButton();
    _btnCancel.setAction(actionMap.get("OpenDataSetDialog_Cancel"));
    _pnlButtons.add(_btnCancel);

    _btnHelp = new JButton();
    _btnHelp.setAction(actionMap.get("OpenDataSetDialog_Help"));
    _pnlButtons.add(_btnHelp);

    _pnlFile = new JPanel();
    _pnlBottom.add(_pnlFile, BorderLayout.CENTER);
    _pnlFile.setLayout(new BorderLayout(0, 0));

    _txtFldFileName = new JTextField();
    _pnlFile.add(_txtFldFileName, BorderLayout.CENTER);
    _txtFldFileName.setColumns(10);
    _txtFldFileName.addKeyListener(new KeyListener() {

        @Override
        public void keyTyped(KeyEvent e) {
            // Clear any selected item in the list of the text field is
            // modified.
            _listDatasetIndex.clearSelection();
        }

        @Override
        public void keyReleased(KeyEvent e) {
            // do nothing
        }

        @Override
        public void keyPressed(KeyEvent e) {
            // do nothing

        }
    });

    _btnBrowse = new JButton();
    _btnBrowse.setAction(actionMap.get("OpenDataSetDialog_Browse"));
    _pnlFile.add(_btnBrowse, BorderLayout.EAST);

    DefaultListModel model = new DefaultListModel();

    for (Pair<String, String> datasetInfo : datasetIndexData) {
        model.addElement(datasetInfo);
    }

    _listDatasetIndex.setModel(model);
    _listDatasetIndex.setCellRenderer(new DatasetIndexCellRenderer());

    _listDatasetIndex.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            // Clear any filename in the text field if an item is selected
            // from the text box.
            _txtFldFileName.setText(null);
        }
    });

    _startBrowseDirectory = startBrowseDirectory;
}