• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getting result in textfield using jlist

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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--
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic