Example usage for javax.swing ListSelectionModel SINGLE_SELECTION

List of usage examples for javax.swing ListSelectionModel SINGLE_SELECTION

Introduction

In this page you can find the example usage for javax.swing ListSelectionModel SINGLE_SELECTION.

Prototype

int SINGLE_SELECTION

To view the source code for javax.swing ListSelectionModel SINGLE_SELECTION.

Click Source Link

Document

A value for the selectionMode property: select one list index at a time.

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingTopProjectPickerJPanel.java

public CFAsteriskSwingTopProjectPickerJPanel(ICFAsteriskSwingSchema argSchema,
        ICFInternetTopProjectObj argFocus, ICFInternetDomainBaseObj argContainer,
        Collection<ICFInternetTopProjectObj> argDataCollection, ICFAsteriskSwingTopProjectChosen whenChosen) {
    super();//from w w  w  .  ja  v a2  s.c o m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedTopProject();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsTopProject(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingSecGroupFormPickerJPanel.java

public CFAsteriskSwingSecGroupFormPickerJPanel(ICFAsteriskSwingSchema argSchema,
        ICFSecuritySecGroupFormObj argFocus, ICFSecuritySecGroupObj argContainer,
        Collection<ICFSecuritySecGroupFormObj> argDataCollection,
        ICFAsteriskSwingSecGroupFormChosen whenChosen) {
    super();/*from  w  ww  .j  a  v  a 2 s.  c o  m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedSecGroupForm();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsSecGroupForm(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingHostNodePickerJPanel.java

public CFAsteriskSwingHostNodePickerJPanel(ICFAsteriskSwingSchema argSchema, ICFSecurityHostNodeObj argFocus,
        ICFSecurityClusterObj argContainer, Collection<ICFSecurityHostNodeObj> argDataCollection,
        ICFAsteriskSwingHostNodeChosen whenChosen) {
    super();/*from  www  . java  2 s . com*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedHostNode();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsHostNode(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingMajorVersionPickerJPanel.java

public CFAsteriskSwingMajorVersionPickerJPanel(ICFAsteriskSwingSchema argSchema,
        ICFInternetMajorVersionObj argFocus, ICFInternetRealProjectObj argContainer,
        Collection<ICFInternetMajorVersionObj> argDataCollection,
        ICFAsteriskSwingMajorVersionChosen whenChosen) {
    super();//from www  . j a v  a 2s .c o  m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedMajorVersion();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsMajorVersion(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingMinorVersionPickerJPanel.java

public CFAsteriskSwingMinorVersionPickerJPanel(ICFAsteriskSwingSchema argSchema,
        ICFInternetMinorVersionObj argFocus, ICFInternetMajorVersionObj argContainer,
        Collection<ICFInternetMinorVersionObj> argDataCollection,
        ICFAsteriskSwingMinorVersionChosen whenChosen) {
    super();/*ww w .j  av a2 s  . c o  m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedMinorVersion();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsMinorVersion(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingSipConfPickerJPanel.java

public CFAsteriskSwingSipConfPickerJPanel(ICFAsteriskSwingSchema argSchema, ICFAsteriskSipConfObj argFocus,
        ICFSecurityHostNodeObj argContainer, Collection<ICFAsteriskSipConfObj> argDataCollection,
        ICFAsteriskSwingSipConfChosen whenChosen) {
    super();//from  ww w  .j  a v  a2 s .co m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedSipConf();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsSipConf(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingTagPickerJPanel.java

public CFAccSwingTagPickerJPanel(ICFAccSwingSchema argSchema, ICFAccTagObj argFocus,
        ICFAccTenantObj argContainer, Collection<ICFAccTagObj> argDataCollection,
        ICFAccSwingTagChosen whenChosen) {
    super();/*w w w  .  j  av  a 2  s.  c om*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedTag();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsTag(argFocus);
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxSwing.CFEnSyntaxSwingEnHeadPickerJPanel.java

public CFEnSyntaxSwingEnHeadPickerJPanel(ICFEnSyntaxSwingSchema argSchema, ICFEnSyntaxEnHeadObj argFocus,
        ICFLibAnyObj argContainer, Collection<ICFEnSyntaxEnHeadObj> argDataCollection,
        ICFEnSyntaxSwingEnHeadChosen whenChosen) {
    super();/*from  w  w w  . ja v  a  2  s.c om*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedEnHead();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsEnHead(argFocus);
}

From source file:edu.ku.brc.specify.conversion.SpecifyDBConverter.java

/**
 * @return//from w  w  w  . j a v a2 s . c  o m
 * @throws SQLException
 */
public Pair<String, String> chooseTable(final String title, final String subTitle, final boolean doSp5DBs)
        throws SQLException {
    MySQLDMBSUserMgr mgr = new MySQLDMBSUserMgr();

    Vector<DBNamePair> availPairs = new Vector<DBNamePair>();

    if (mgr.connectToDBMS(itUsrPwd.first, itUsrPwd.second, hostName)) {
        BasicSQLUtils.setSkipTrackExceptions(true);

        //String sql = String.format("SELECT DISTINCT `COLUMNS`.TABLE_SCHEMA FROM `COLUMNS` WHERE `COLUMNS`.TABLE_NAME = '%s'", doSp5DBs ? "collectionobjectcatalog" : "taxon");
        Connection conn = mgr.getConnection();
        Vector<Object[]> dbNames = BasicSQLUtils.query(conn, "show databases");
        for (Object[] row : dbNames) {
            String dbName = row[0].toString();

            //System.out.print("Database Found ["+dbName+"]  ");
            conn.setCatalog(dbName);

            boolean isSp5DB = false;
            Vector<Object[]> tables = BasicSQLUtils.query(conn, "show tables");
            for (Object[] tblRow : tables) {
                String tableName = tblRow[0].toString();
                if (tableName.equalsIgnoreCase("usysversion")) {
                    isSp5DB = true;
                    break;
                }
            }

            if ((!isSp5DB && doSp5DBs) || (isSp5DB && !doSp5DBs)) {
                continue;
            }

            // make all table names lowercase
            try {
                Integer count = BasicSQLUtils.getCount(conn, "select COUNT(*) FROM collection");
                if (count == null) {
                    for (Object[] tblRow : tables) {
                        String tableName = tblRow[0].toString();
                        if (!tableName.equals(tableName.toLowerCase())) {
                            BasicSQLUtils.update(conn,
                                    "RENAME TABLE " + tableName + " TO " + tableName.toLowerCase());
                        }
                    }
                }

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

            Vector<Object> tableDesc = BasicSQLUtils.querySingleCol(conn,
                    "select CollectionName FROM collection");
            if (tableDesc.size() > 0) {
                String collName = tableDesc.get(0).toString();
                availPairs.add(new DBNamePair(collName, row[0].toString()));
            }
        }

        Collections.sort(availPairs, new Comparator<Pair<String, String>>() {
            @Override
            public int compare(Pair<String, String> o1, Pair<String, String> o2) {
                return o1.second.compareTo(o2.second);
            }
        });

        mgr.close();
        BasicSQLUtils.setSkipTrackExceptions(false);

        final JList list = new JList(availPairs);
        CellConstraints cc = new CellConstraints();
        PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,4px,f:p:g"));
        pb.add(UIHelper.createLabel(subTitle), cc.xy(1, 1));
        pb.add(UIHelper.createScrollPane(list, true), cc.xy(1, 3));
        pb.setDefaultDialogBorder();

        final CustomDialog dlg = new CustomDialog(null, title, true, pb.getPanel());
        list.addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    dlg.getOkBtn().setEnabled(list.getSelectedIndex() > -1);
                }
            }
        });

        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        list.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    dlg.getOkBtn().setEnabled(list.getSelectedIndex() > -1);
                    dlg.getOkBtn().doClick();
                }
            }
        });

        dlg.createUI();
        dlg.pack();
        Dimension d = dlg.getPreferredSize();
        d.height = 700;
        dlg.setSize(d);
        UIHelper.centerAndShow(dlg);

        if (dlg.isCancelled()) {
            return null;
        }

        return namePairToConvert = (DBNamePair) list.getSelectedValue();
    }

    return null;
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingMemoPickerJPanel.java

public CFAccSwingMemoPickerJPanel(ICFAccSwingSchema argSchema, ICFAccMemoObj argFocus,
        ICFAccContactObj argContainer, Collection<ICFAccMemoObj> argDataCollection,
        ICFAccSwingMemoChosen whenChosen) {
    super();/*from   www.j av  a  2s  .c o m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    swingContainer = argContainer;
    setSwingDataCollection(argDataCollection);
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    actionCancel = new ActionCancel();
    buttonCancel = new JButton(actionCancel);
    actionChooseNone = new ActionChooseNone();
    buttonChooseNone = new JButton(actionChooseNone);
    actionChooseSelected = new ActionChooseSelectedMemo();
    buttonChooseSelected = new JButton(actionChooseSelected);
    // Do initial layout
    setSize(1024, 480);
    add(buttonChooseNone);
    add(buttonChooseSelected);
    add(buttonCancel);
    add(dataScrollPane);
    dataScrollPane.setBounds(0, 35, 1024, 455);
    doLayout();
    setSwingFocusAsMemo(argFocus);
}