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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:58:57+00:00 2026-05-15T08:58:57+00:00

I have a form class with a method: IText getSearchField() The IText interface is

  • 0

I have a form class with a method:

IText getSearchField()

The IText interface is something implemented by a subclass of JTextField called MyTextField.

For reasons beyond my control, I cannot get the control from the form class typed as MyTextField, as JTextField, Component, or anything else in the MyTextField type hierarchy.

I am accessing the form class object from a driver object, and would like to have the driver set the focus onto the search field retrieved by the getSearchField() call.

I could use the requestFocusInWindow() method of the Component class to do this. However, first I would need to cast the result of the getSearchField() call to something in the MyTextField type hierarchy, since the call to getSearchField() returns an IText.

My question is, should I cast to MyTextField? to Component? to something in between?

Why? And which would be fastest?

  • 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-15T08:58:58+00:00Added an answer on May 15, 2026 at 8:58 am

    Cast to the least specific you need. That is, if A is a superclass of B and you only need methods from A, cast to A. If you also need methods from B, cast to B.

    Which would be the fastest? Why do you ask this? It wouldn’t make a difference.

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

Sidebar

Related Questions

I have a base form class that contains a method that returns a DataTable:
Assume I have a form class SampleClass(forms.Form): name = forms.CharField(max_length=30) age = forms.IntegerField() django_hacker
Say I have this simple form: class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True)
Say I have a form like: class GeneralForm(forms.Form): field1 = forms.IntegerField(required=False) field2 = forms.
If I have a Django form such as: class ContactForm(forms.Form): subject = forms.CharField(max_length=100) message
I have a windows form application that uses a Shared class to house all
I have this form class public partial class Form1 : Form { public Form1()
When an instantiated class calls a method in the parent form class, VB.NET starts
Is it possible to send form data to a PHP class' method rather than
i have this form: <form action = method = get> <input type = input

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.