I have a program which searches for price and Description by scanning the barcode. I need the program(txt_barcode TextField) to hold the user results(searched results) for only 3 seconds and automatically clear up for the next user request. For example, if i scan a barcode, the results should show for only 3 seconds and automativally clear up for the next scan or request.the request seasion should only be for 3 seconds Can you help me to insert this code for me?. I am using Netbeans and here is my code.
private void txt_barcodeKeyReleased(java.awt.event.KeyEvent evt) {
try{
String sql="select * from item_mast where barcode=?" ;
pst=conn.prepareStatement(sql);
pst.setString(1,txt_barcode.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1 = rs.getString("descr");
txt_description.setText(add1);
String add2 = rs.getString("retail1");
txt_price.setText(add2);
}
}catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
}
}