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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:18:23+00:00 2026-05-16T15:18:23+00:00

In our Swing application, we are using an automated testing tool in QA (Qf-Test)

  • 0

In our Swing application, we are using an automated testing tool in QA (Qf-Test) that works better when the swing components are named. (calling Component.setName). Although their automatic name assignments work reasonably well, we are introducing SwingX components into the project and that is causing some issues for the tool.

There are a lot of potential components on a screen (your typical business app data entry screens, but a lot of them – the app is on the complexity level of an ERP), what options are there for naming swing components in a reasonably unobtrusive manner?

  • 1 1 Answer
  • 1 View
  • 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-16T15:18:23+00:00Added an answer on May 16, 2026 at 3:18 pm

    I typically store the fields in a JPanel in properties on the JPanel, like this:

    private JLabel firstNameLabel;
    private JTextField firstNameTextField;
    

    At the end of the routine that instantiates and lays out these components, you could run a routine that uses java.lang.reflect to loop through each property of the panel. If a property descends from the class Component, you can call setName on it with the name of the property. So for example, it would end up calling:

    this.firstNameLabel.setName("firstNameLabel");
    this.firstNameTextField.setName("firstNameTextField");
    

    …except through java.lang.reflect

    You could also have the routine examine the bumpy case names of variables and replace it with standard case with spaces. This would make them more readable.

    This approach will ensure that no matter what components you add to a panel, they will all get friendly names.

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

Sidebar

Related Questions

I have a test that exercises a custom Swing component using java.awt.Robot. I'd like
I'm using JUnit and FEST for Swing integration testing of our app that I
In our Swing application, we show error messages using JOptionPane.showOptionDialog . However, some of
Our Swing application doesn't limit the number of application instance user opens that is
I was looking to better the framework that we had built for our Swing
Our customer is using our software (Java Swing application started using Webstart) besides other
Our Swing application performs some long-running tasks in a background thread using the excellent
We have a problem in our swing based application since we've upgraded our java
Our software has a swing panel that's used to list jdk installation paths. For
Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have

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.