This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting result in textfield using jlist

 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai friends,

i'm trying to use a jtextfiled with a jlist.....here i'm getting the values from a database to the jlist and whenever i type the name
i want, i'm getting the result in the jlist...but i can't use the arrowkeys to select these values to jtextfield...i'm able to do it with mouse
so i have to get the values in the jlist to the textfield using the arrowkeys..or enter key using the arrowkeys to traverse through the jlist
i hope you guys can help me....if my query is not clear please reply...please do help..
nijin--
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your query is not completely clear. Let me try:
So, you are able to select an item in a List, by clicking on the list with mouse. And you are asking how to do it with arrow keys.
You need to first 'tab-in' to the component by using the tab key. A border will appear around the item in the list - a dotted border without anything selected. Then you can use the down arrow/up arrow to move through the list which will select the item.
 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think you are not clear....actually the list here i'm used is associated with a textfield...this list will appear only if i type a name or something in the textfield...
the list will display the whole matching names of the word or name i entered..it is like the dropdown list....the name i typed will only be displayed.......
here is the code i used to do so...here i think there is some problem with keyrealsed event and the list actionlistener...if you can solve this it will be very help full...thanks
tf is the jtextfield, list is the jlist, sp is the scrollpane dates represents the arralist of names from database, dlm is the defaultlistmodel
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nijin puthiya purayil wrote:i think you are not clear....

oh ok...so, you post a question which is hard to understand, and you don't provide any code and when I point out that your query is not clear, you turn it back on me. fine.
Nijin puthiya purayil wrote:here i think there is some problem with keyrealsed event and the list actionlistener...

It is not possible for any of us to know what that 'some problem' is. Unless you explain the problem and post a SSCCE, its hard for us to help you.
 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm sorry dude i don't meant to turn it back on you...i thought you are confused with my question...
if you are familiar with a drop down list program, can you post it for me???because i'm working on a project in which i want details of employees ..actually when i'm typing the name of a person i'm getting the desired
list as a dropdown list in that textfield...
i'm able to do further things....the only problem is that i can't select the name using my arrowkeys...
actually i posted a small part of my code here since it is a big thing...i'm a beginner in java so i'm little bit confused...
if you are still not able to help me, i will post the SSCCE here...i hope you get me thanks for your suggestion
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nijin puthiya purayil wrote:if you are still not able to help me, i will post the SSCCE here...

Why don't you start by doing that?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> this list will appear only if i type a name or something in the textfield...
> the list will display the whole matching names of the word or name i entered..

google
JTextField autocomplete

there's 100's (1000's?) of examples out there

if the problem is just getting the selection to the textfield (after navigating via arrow keys),
have a look at the various listeners for JList
 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

finally i got the result...some times google cannot give us everything,,we have to work....
..thank you all for your valuable informations
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic