Right now, I'm stuck with this problem: I want to show the total amount of songs in my database inside the GUI (through the jtextfield).
This is what I got so far:
txtTotalSongs = new JTextField();
txtTotalSongs.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
String q = "select count (title) from songs";
PreparedStatement ps=conn.prepareStatement(q);
ps.setInt(1, 20);
ResultSet rs = ps.executeQuery();
while(rs.next())
{
txtTotalSongs.setText(String.valueOf("title"));
}
} catch (Exception e) {
// TODO: handle exception
}
}
});
txtTotalSongs.setBounds(591, 458, 86, 20);
contentPane.add(txtTotalSongs);