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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:20:27+00:00 2026-05-28T22:20:27+00:00

I created a method to validate a JTextField. When I am typing any alphabet

  • 0

I created a method to validate a JTextField. When I am typing any alphabet character it should automatically convert into uppercase character, but I am not getting an uppercase.

How to solve this problem, when using evt.consume()?

Code snippet:

public void PRJ_TEXT_VALIDATION(JTextField PTxt, int PTxtLen, String POptnStr, KeyEvent Pevt){
               String TmpStr=PTxt.getText();
               char TmpChar=Pevt.getKeyChar();
               //TmpChar=Character.toUpperCase(TmpChar);
               if ((TmpStr.trim().length() + 1) <= PTxtLen){
                   if (POptnStr == "INTEGER") {
                      if (!((TmpChar>='0') && (TmpChar<='9'))){
                          Pevt.consume();
                      }
                   } else if (POptnStr == "NUMERIC"){
                          if(!((TmpChar>= '0' && TmpChar <= '9') || (TmpChar == '.'))){
                                Pevt.consume();
                          }
                  } else if (POptnStr == "ALPHABET"){
                         if(!(TmpChar>= 'a' && TmpChar <= 'z' || TmpChar >= 'A' && TmpChar <='Z')){
                             Pevt.consume();
                          }
                 } else if (POptnStr == "PHONE"){
                        if (!((TmpChar>= '0' && TmpChar <= '9') || (TmpChar == '-')||
                           (TmpChar == '+')||(TmpChar == '(')||(TmpChar == ')'))){
                            Pevt.consume();
                         }
                }
            }else{
                 Pevt.consume();
             }
         }
  • 2 2 Answers
  • 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

2 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T22:21:35+00:00Added an answer on May 28, 2026 at 10:21 pm

    Use document filter to achieve this.
    You can find usage in DocumentFilter that maps lowercase letters to uppercase.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Editorial Team
    Editorial Team
    2026-05-28T22:22:52+00:00Added an answer on May 28, 2026 at 10:22 pm

    Use document filter to achieve this.
    You can find usage in DocumentFilter that maps lowercase letters to uppercase.

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

Sidebar

Related Questions

I've created a method that generates a new class and adds some methods into
How I can call a validate method created with jQuery.validator? Example: jQuery.validator.addMethod(functionA, function(value, element)
I have created a add email method (jquery) to validate a multiple emails for
I have Dropdownlist on my page and its selectedindexchanged method created in code behind
I'm trying to learn about Expression trees, and I've created a method that takes
Given a DataSet, I'm left joining DataTables[1-n] onto DataTable[0]. I have created a method
I created the following method for retrieving stored settings from the database: public String
I created an extension method called HasContentPermission on the System.Security.Principal.IIdentity : namespace System.Security.Principal {
We've created a generic method like so: public TReturnType GetValue(string key) { var configurationParameter
I have created a new method in one of the project's controllers that it

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.