DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Retrieval Augmented Generation With Spring AI 2.0, Claude, and PGvector
  • A Spring Boot App With Half the Startup Time
  • Key Takeaways From Integrating a RAG Application With LangSmith
  • Improving Java Application Reliability with Dynatrace AI Engine

Trending

  • The Tectonic AI Platform: A Framework for Taming App Sprawl and Data Fragmentation
  • Engineering Production Agentic Systems: Part 2: The Guardrails
  • Securing Loop Engineering: Six Trust Boundaries for Autonomous Agents
  • Agentic AI in 2026: How Autonomous AI Agents Are Replacing Manual Dev Work

Visual Debugging for Swing Apps

By 
Geertjan Wielenga user avatar
Geertjan Wielenga
·
Apr. 16, 08 · News
Likes (0)
Comment
Save
Tweet
Share
21.9K Views

Join the DZone community and get the full member experience.

Join For Free

Two days ago, the 1.0 release of the Swing Explorer was announced. It is a handy tool for examining an application's component hierarchies, properties, events, and threads.

Swing Explorer, yet another cool application available on dev.java.net, is handy when debugging your Swing application. In some ways, it is comparable to an AST Viewer, except that it displays component hierarchies instead of an abstract syntax tree. Just as an AST view is crucial when working with the internals of a language, so the Swing explorer is essential in understanding the relationships between components in a Swing application. Below is a case in point, the explorer view on the left showing the complete hierarchy of the application under observation:

Of course, an IDE or GUI Builder would provide a similar view. The difference is that, in this case, the above application is deployed from a JAR outside of an IDE. In other words, the application is not in development/production mode, although it could be too. The Swing Explorer starts up your application with this command:

java -javaagent:swag.jar -Xbootclasspath/a:swag.jar -cp swexpl.jar;<your_class_path> org.swingexplorer.Launcher <your_main_class>

And that's it. Your own application then starts up, as does the Swing Explorer. Then you can explore the application in the way shown above. Not only the component hierarchy of the application is then exposed, but also all its properties, such as its layout and borders. The tabs at the bottom are very useful too. The "Player" tab lets you observe the order in which the application is constructed and the content is drawn. Some questions that you can have answered by means of the Swing Explorer:

  • "I do not see a component on my JFrame. However, it should be there."
  • "My colleague developed a panel two years ago. I have no idea how it is constructed. I'd like to figure out why a component appears on this place? Why it is shifted 5 pixels to the left?"
  • "I want to debug my application in a Java debugger step by step and watch what each step produces on the screen when I add components into my JFrame."
  • "I see a small dot in the upper right corner, why it is there?"
For info on these and related usecases, see Getting Started with Swing Explorer.

The "AWT Events" and the "EDT Monitor" tabs are new, providing useful information on AWT and EDT, with further finegrained filtering planned for future releases. Here's the EDT Monitor in action:

The plan to provide plugins for Eclipse and NetBeans IDE is also an interesting one. Swing user interface debugging--seems like this tool is perfectly attuned to this need.

application

Opinions expressed by DZone contributors are their own.

Related

  • Retrieval Augmented Generation With Spring AI 2.0, Claude, and PGvector
  • A Spring Boot App With Half the Startup Time
  • Key Takeaways From Integrating a RAG Application With LangSmith
  • Improving Java Application Reliability with Dynatrace AI Engine

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook