Oracle Database 11g Express Edition Release 22.214.171.124.0 - Production
PL/SQL Release 126.96.36.199.0 - Production
"CORE 188.8.131.52.0 Production"
TNS for 32-bit Windows: Version 184.108.40.206.0 - Production
NLSRTL Version 220.127.116.11.0 - Production
I have successfully connected to DB. However I have following code which runs fine. (Due to the length of the code I am posting a single Jtextfield to avoid confusion). If anyone would like to see full code. please let me know
My Requirement I want to display data from database when user enters this field which is (JTextfield f2) and presses ENTER key. and the selected data gets displayed in this Jtextfield.
Here is the DB Connection code
Please remember Jtextfield and the above DB connection code are separate classes. I am new to java any hint will be appreciated.
Please refer to the attachment to understand the requirement.
Are you saying that when the user goes to the text field and presses the enter button on the keyboard you want the information from the database to be displayed?, am i understanding correctly
posted 7 years ago
Yes exactly you got it right. For more information please refer to the attachment. I would like to have the same feature as in the attachment. User goes to the Jtextfield and presses ENTER key and the all available records from the DB are presented to the user
am not certain which textfield in the image you assign to the variable(f2) so my suggestions: JTextField would not be appropriate to display all the information in a large database because it will only display all the names in a single line so JTextArea would be more appropriate as it may display the data line by line, also to have that being done with the enter key you would then have to assign a KeyListener instead of an action Listener, so i would recommend doing a little reading up on them,
posted 7 years ago
No, f2 is not attached to any field in the image. However I want the mentioned functionality to be on the below portion of the code,
Yes I have also noted that instead of Action Listener Key Listener be used. I once again put-forth my requirement. After the JTestfield f2, there are more Jtextfields which would display other personal information for eg: User presses ENTER and a whole list pops up from the DB (student_name,student_fname,student_dob,_student_address etc..) for all available students user can select the required student, once this selection is made all the remaining JTextfield must get populated with data selected by user. for eg: student_name should go to JTextfield f2, student_fname goes to Jtextfield f3, student_DOB goes to Jtextfield f4 and finally student_address goes to Jtextfield f5.
Please remember I have the above Jtextfields in public class named Swing1 and I am connecting to DB by writing other public class named Oraclejdbc.
Could you please tell me what type of attachment are accepted on this forum (I have tried attaching .txt,.doc,.docx,.java) its not accepting it