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 790043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:37:19+00:00 2026-05-14T21:37:19+00:00

Looking for how to traverse a JTree (can do that) and check to see

  • 0

Looking for how to traverse a JTree (can do that) and check to see each node to see if it’s displayed (to the user) or not visible. Can’t believe JTree doesn’t have this function, maybe I’m missing something?

  • 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-05-14T21:37:20+00:00Added an answer on May 14, 2026 at 9:37 pm

    You must consider two different things:

    1. A node can become hidden by closing one of its parents. Even though the parent is visible on the screen, the child isn’t. Use JTree.isVisible() for this.

    2. If the node is expanded, it can become hidden because it is scrolled out of the current viewport. This isn’t handled in the JTree but in the JScrollPane which wraps the tree. To find out if a node is in the visible area of the viewport.

    To find out if #2 is true, you must get the rectangle where the node is using JTree.getPathBounds(). Then, you must intersect this rectangle with the viewport (use scrollPane.getViewport().getViewRect(). If nodeRect.intersects (viewRect) returns true, the node is visible.

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

Sidebar

Related Questions

I'm looking to convert PHPDocumentor output to a format I can traverse through in
We are looking for a script that will traverse in recursive mode all subfolders
Looking for a build-time CSS combiner/minifier that respects relative URL references. That is, if
Looking around the web, I've seen this simple pattern that implements a (thread-safe) singleton
Looking for an example that: Launches an EXE Waits for the EXE to finish.
Looking for a Linux application (or Firefox extension) that will allow me to scrape
Looking at the C# project templates in VS2008 and the offerings are WPF User
I am looking to traverse a NxN area, given the starting points X,Y and
I am looking for standard libraries in C++ that would allow me to do
I'm looking for any implementation of a pure Tree data structure for Java (that

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.