• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JScrollPane

 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • 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...
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • 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
    • 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: 5148
    11
    Java Netbeans IDE Opera
    • Mark post as helpful
    • send pies
    • 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
    • Quote
    • Report post to moderator
    Here is the code i used...
    When window is activated

    In the KeyReleased event
     
    Rob Spoor
    Sheriff
    Pie
    Posts: 20611
    63
    Chrome Eclipse IDE Java Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    That's still not an SSCCE.
     
    Darryl Burke
    Bartender
    Posts: 5148
    11
    Java Netbeans IDE Opera
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Nijin puthiya purayil wrote: In the KeyReleased event

    Is my first response not visible?
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic