Fetch data from database into Jtextfield when One Jtextfield is Typed

前端 未结 4 1911
旧巷少年郎
旧巷少年郎 2020-12-22 05:16

Hi Guys I have a Swing Application that is connected to an oracle database, I want it such that Once I type a Value into the JTextField, the other JTextfields on the JFrame

4条回答
  •  时光说笑
    2020-12-22 05:36

    • Replace the KeyListener by a DocumentListener
    • The database connection on the EDT is a bad idea (too slow). Consult the concurrency in Swing guide for more information
    • You are vulnerable to SQL injection
    • Avoid empty catch statements or you have no idea that something is going wrong. If you do not opt for decent error handling, at least log the stack trace (either by just printing it, or by using a Logger).

提交回复
热议问题