Detect whether FocusEvent of component is lost or gained

I implementing a EventQueue and get notified when AWTEvents are send. I wait till instances of FocusEvent are send to the dispatchEvent methode.

The FocusEvent by itself does not have a methode to ask if the focus of the component is gained or lost. The methode paramString returns a String in which the information is placed, but i dont want to hack or pars the String. A contains call can give me the answer, but the returnes String is no constant, so it could change in the future.

The paramString methode of FocusEvent is like:

 switch(id) {
      case FOCUS_GAINED:
          typeStr = "FOCUS_GAINED";
          break;
      case FOCUS_LOST:
          typeStr = "FOCUS_LOST";
          break;
      default:
          typeStr = "unknown type";
    }
    return typeStr + (temporary ? ",temporary" : ",permanent") +
        ",opposite=" + getOppositeComponent();

Do you know another solution for this issue.

Answers


What's wrong with "evt.getID()"? It returns FOCUS_LOST or FOCUS_GAINED?


Need Your Help

Date comparison in Hive

hadoop hive hiveql

I'm working with Hive and I have a table structured as follows:

Use the connection string stored in web.config through a web user control

asp.net user-controls

I have created a web user control to manipulate my database actions, and I want to use the connectionstring stored in web.config .... the way I used before in a asp.net page( like deafult.aspx.cs) ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.