Java Eclipse GUI Tutorial 18 # How to link JList with Sqlite database in Java
Вставка
- Опубліковано 19 вер 2024
- Donate to ProgrammingKnowledge -- (www.paypal.com...)
A simple JList example
An example of JList with a DefaultListModel
JList basic tutorial and examples
How to use jList and link it to Database
Verwandte Suchanfragen zu how to use jlist
java jlist tutorial
jlist single selection
jlist getselectedindex
swing table
java sortable table
swing tablemodel
swing border
jtable model
When i put jlist, its not visible and doesn't work... How solve?
try {
String sql = "SELECT * FROM PMS";
PreparedStatement pst = con.prepareStatement(sql);
DefaultListModel model = new DefaultListModel();
while (rst.next()) {
String namelist = rst.getString("FIRSTNAME");
model.addElement(namelist);
}
listtxt.setModel(model);
pst.close();
rst.close();
} catch (SQLException e) {
}
}
why am i not getting nothing? i already added the method name to the constructor.
how do you avoid duplicates on the list?
answered: change your query to "select DISTINCT column_name from table_name"