Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:30:17+00:00 2026-06-05T15:30:17+00:00

I have created an on the fly search field in Java Swing. I have

  • 0

I have created an on the fly search field in Java Swing. I have a JTextField where you enter what to search for, and a JList inside a JScrollPane that contains the matches on your input. When you write in the JTextField, it controls the JScrollPane: The contents of it, and if it should be visible or not.

It works fine when I create a sample window using it, but not in my big GUI. I can’t explain the GUI, so I don’t expect you to solve this entirely, but maybe answer a question about it.

The thing is, that when the JTextField is empty or we find no hits, the list is hidden (setVisible(false)). When you start typing, and it found at least one item, it’s shown (setVisible(true)). When I start up my GUI, and I start typing in the search field, the list isn’t shown as it should. It simply doesn’t appear. I have debugged the code, and the scrollpane IS set to visible = true. It is visible according to the running code, but I can’t see it and I can’t interact with it. It’s not hidden behind something else.

Now to the funny thing. If I type something that should generate a hit, and then hover over the JTextField, activating its’ tooltip, the JScrollBar appears! After that has happened, the search field acts normally, until I close the window. The visible flag is not changed, but somehow it decided that now we can paint it.

Now I want to know, what happens when a tooltip is shown? Is there some special painting going on that I could call myself?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:30:20+00:00Added an answer on June 5, 2026 at 3:30 pm

    You should call revalidate() on the component that contains the scroll pane and the text field after you call setVisible. The general rule is that if you change the layout of a container component after the container has been laid out and displayed to the user, you should call revalidate on it.

    Let me know if that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET assembly DLL that is created on-the-fly from pre-compiled code in
I have created a CSS fly out menu . Seems to fly out the
I have created custom listview in that have list of textview & list of
I have created a custom JTree. That tree could be filtered to show only
I have a search page that is used in multiple places with multiple 'themes'
I have created an AJAX function that is used with pagination links to load
I have successfully created an email that sends on creation of a Kase, but
I have a bunch of fields like so created on the fly <input type=text
So I am attempting to create a search field that will filter contacts on
I have created a class that I've been using as the storage for all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.