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

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • DGS GraphQL and Spring Boot
  • Auto-Instrumentation in Azure Application Insights With AKS
  • Deploying a Scala Play Application to Heroku: A Step-by-Step Guide
  • Why Mocking Sucks

Trending

  • How to Configure and Customize the Go SDK for Azure Cosmos DB
  • A Modern Stack for Building Scalable Systems
  • Performance Optimization Techniques for Snowflake on AWS
  • Contextual AI Integration for Agile Product Teams

Visual Debugging for Swing Apps

By 
Geertjan Wielenga user avatar
Geertjan Wielenga
·
Apr. 16, 08 · News
Likes (0)
Comment
Save
Tweet
Share
21.5K 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

  • DGS GraphQL and Spring Boot
  • Auto-Instrumentation in Azure Application Insights With AKS
  • Deploying a Scala Play Application to Heroku: A Step-by-Step Guide
  • Why Mocking Sucks

Partner Resources

×

Comments

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

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: