aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Problem with JScrollPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with JScrollPane " Watch "Problem with JScrollPane " New topic
Author

Problem with JScrollPane

Nijin puthiya purayil
Ranch Hand

Joined: Nov 09, 2011
Posts: 32
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

Joined: May 03, 2008
Posts: 4543
    
    5

... 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.

    luck, db
    There are no new questions, but there may be new answers.
    Nijin puthiya purayil
    Ranch Hand

    Joined: Nov 09, 2011
    Posts: 32
    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

    Joined: May 03, 2008
    Posts: 4543
        
        5

    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

    Joined: Nov 09, 2011
    Posts: 32
    Here is the code i used...
    When window is activated

    In the KeyReleased event
    Rob Spoor
    Sheriff

    Joined: Oct 27, 2005
    Posts: 19695
        
      20

    That's still not an SSCCE.


    SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
    How To Ask Questions How To Answer Questions
    Darryl Burke
    Bartender

    Joined: May 03, 2008
    Posts: 4543
        
        5

    Nijin puthiya purayil wrote: In the KeyReleased event

    Is my first response not visible?
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Problem with JScrollPane