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

  • Home
  • SEARCH
  • 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 6354377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:33:59+00:00 2026-05-24T22:33:59+00:00

I have a frame with some JTextFields on it. When the user tabs out

  • 0

I have a frame with some JTextFields on it. When the user tabs out from a JTextField, I execute custom logic in the FocusTraversalPolicy, which sets some properties and based on them the FocusTraversalPolicy decides where should the focus go next. So far so good.

But I want this custom logic to execute everytime the JTextField loses focus(in an InputVerifier, because there is also validation in it).

Now the problem and the question: If the user leaves the field with the mouse the InputVerifier will be triggered and everything will be fine. But if the user presses TAB, both the FocusTraversalPolicy and the InputVerifier will be triggered and the custom logic will be executed twice, which I don’t want. How can I detect in the InputVerifier that TAB was already pressed and don’t execute anything? I want to execute the custom logic in the InputVerifier only when the field is left with the mouse. Or is there a better solution?

Hope my question is clear.

Regards, Petar

  • 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-24T22:33:59+00:00Added an answer on May 24, 2026 at 10:33 pm

    I ended up setting a boolean flag from the FocusTraversalPolicy if the custom logic is executed. Then in the InputVerifier if it is already executed I don’t execute it again. Then I reset the flag.

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

Sidebar

Related Questions

I have a data frame in R that has come about from running some
We have some web pages which have two frames, with one frame in the
In my java-swing project. I have one frame in which user can drop the
So I have a wx.Frame to which I add a GLCanvas and some buttons.
I have created frame in JSP which takes some site in source which has
I have data frame with some numerical variables and some categorical factor variables. The
I have a data frame where some of the columns contain NA values. How
I have a large data.frame displaying some weird properties when plotted. I'd like to
In a frame I have two columns. In the first column I display some
I have a data frame and some columns have NA values. How do I

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.