0

I want to make an autocomplete program (just like when you search in the Google). When you start to type in the textfield, a list of suggestions appear below. Its hard for me to download swingX in the net thats why I come up for this option to use a JWindow.

Is it possible to have this option?

Thanks...

papski
  • 1,241
  • 5
  • 28
  • 52
  • How is this not a duplicate of [Is it possible to have an autocomplete using jtextfield and a Jlist?](http://stackoverflow.com/questions/7255636/is-it-possible-to-have-an-autocomplete-using-jtextfield-and-a-jlist) – trashgod Sep 01 '11 at 04:17
  • 1
    java.net DNS has been down (and with it all project areas, including SwingX) - current status (via @sonyabarry, the community manager) Java.net update - "DNS has been updated, but it will take up to 48 hours for cache to expire worldwide. Some have access now". – kleopatra Sep 01 '11 at 08:26
  • 1
    Mikel (no offense meant, just caring) - looks to me you start building the house in 5nd floor ;-) It's not trivial to get auto-complete correct, without a halfway sound knowledge of Swing it'll be a path of pain – kleopatra Sep 01 '11 at 08:31
  • @kleopatra - yeah, your right. Now i feel my head is going to explode. – papski Sep 01 '11 at 09:39

1 Answers1

2

You can use tf.getLocationOnScreen() to identify the location of your text field in absolute screen coordinates. Then calculate the location where to put your JWindow.

AlexR
  • 114,158
  • 16
  • 130
  • 208
  • Do you have a sample for that? Because it was just suggested to me to use JWindow and I'm very much new for that stuff in java. – papski Sep 01 '11 at 07:35