• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Problem with JScrollPane

 
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,

In my application i'm using a JTextField associated with a JList and a JScrollPane is given to the JList...when i type a name in the JTextField the matched names are displayed in the JList within the JScrollPane...Actually in my application i made the list and pane to be invisible when the window is activted by using a formWindowActivated listener..it will become visible only when i type a name in the JTextField...but whenever i type the name the JScrollPane and the JList are still invisible...but if i click somewhere in the GUI window after entering the first letter of the name the list is becoming visible what can be the problem? Is there any other method to make it visible? is the JList visible already and i can't see it?? There is no MouseListener in my application..... I'm pasting the code below what i used...



and the ActionListener for JList is...



any help will be appreciated..thanks in advance...
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

... using a formWindowActivated listener.


Since there's no such class in core Java, any questions regarding it should either be accompanied by the code or asked wherever you got the class.

Other comments:
  • To listen to changes in the content of any text component, you should use a DocumentListener added to the component's Document. Not a KeyListener.
  • Database queries should normally not be performed on the EDT


  • To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem. And remember that the first 'S' stands for Short.
     
    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

    Darryl Burke wrote:

    ... using a formWindowActivated listener.


    Since there's no such class in core Java, any questions regarding it should either be accompanied by the code or asked wherever you got the class.



    I'm sorry if i confused you... actually i meant to say WindowListener and the windowActivated(WindowEvent) event in my code...here the form was my JFrame form...
    here in this case i just want to display the JList...i'm not bothered about the contents...even if i'm not storing any database values in the JList and i try to make it visible by
    typing some values in the JTextField the same problem arises...
     
    Darryl Burke
    Bartender
    Posts: 5167
    11
    Netbeans IDE Opera Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    i just want to display the JList...i'm not bothered about the contents...even if i'm not storing any database values in the JList and i try to make it visible by
    typing some values in the JTextField the same problem arises...


    So where's that SSCCE?
     
    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
    Here is the code i used...
    When window is activated

    In the KeyReleased event
     
    Sheriff
    Posts: 22656
    126
    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
    That's still not an SSCCE.
     
    Darryl Burke
    Bartender
    Posts: 5167
    11
    Netbeans IDE Opera Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Nijin puthiya purayil wrote: In the KeyReleased event


    Is my first response not visible?
     
    pie. tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic