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
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
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

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • MuleSoft: Tactical and Strategical Role of an Application Template
  • A Better Web3 Experience: Account Abstraction From Flow (Part 1)
  • Common Problems in React Native Apps on iOS Platform: Solutions and Tips
  • How To Verify Database Connection From a Spring Boot Application

Trending

  • Implementing Stronger RBAC and Multitenancy in Kubernetes Using Istio
  • Breaking Down Silos: The Importance of Collaboration in Solution Architecture
  • TypeScript: Useful Features
  • Hugging Face Is the New GitHub for LLMs

Visual Debugging for Swing Apps

Geertjan Wielenga user avatar by
Geertjan Wielenga
·
Apr. 16, 08 · News
Like (0)
Save
Tweet
Share
20.84K 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

  • MuleSoft: Tactical and Strategical Role of an Application Template
  • A Better Web3 Experience: Account Abstraction From Flow (Part 1)
  • Common Problems in React Native Apps on iOS Platform: Solutions and Tips
  • How To Verify Database Connection From a Spring Boot Application

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • 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: