• 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

How can a TextField get focus?

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I let a text field get focus on it whenever it display?
How can I let this text field add a key strok ActionListener (Enter key) that mean when I type "Enter" key in this text field and some action will happen?
Please teach me. Thanks!
 
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
to get the focus to the textfield. use textfield.requestFocus();
and to respond to the enter key
- add keyListener to ur text field.
- in the keyReleased() method of ur key listener. just check
if(keyevnt.getKeyCode()==KeyEvent.VK_ENTER)
{
///enter key pressed do ......
}
else
{
///do nothing
}

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi deekasha gunwant:
Thank you very much! Moreover do you know How can I determine a database is empty or not, if it is not empty, how can I print out the names of all the tables currently existing in the database.
Thank you for your teach!
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
u can quey the database by querying the system table "tabs" (i'm taking wrt Oracle) if result set is null then u can say that database was empty, and far as the problem of displaying column name is concerned u can query the same tabe for table_name column and display the result in either text area or table or whatever u wan't to use. but u see it depends a lot on the database u r using. i have written it wrt Oracle only. i don't know whether it will be helpful for u or not.
Naima Muzammal
NETSOL Intl.
Pakistan
 
So I left, I came home, and I ate some pie. And then I read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic