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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:37:18+00:00 2026-06-19T03:37:18+00:00

Alternately display any text that is typed in the textbox // in either Capital

  • 0

Alternately display any text that is typed in the textbox

//     in either Capital or lowercase depending on the original
//     letter changed.  For example:  CoMpUtEr will convert to
//     cOmPuTeR and vice versa.
    Switch.addActionListener(new ActionListener()
    {
        public void actionPerformed(ActionEvent e )

            String characters = (SecondTextField.getText()); //String to read the user input
            int length = characters.length();  //change the string characters to length

         for(int i = 0; i < length; i++)  //to check the characters of string..
         {             
            char character = characters.charAt(i);          

            if(Character.isUpperCase(character)) 
            {
                SecondTextField.setText("" + characters.toLowerCase());

            }
            else  if(Character.isLowerCase(character))
            {
                 SecondTextField.setText("" + characters.toUpperCase()); //problem is here, how can i track the character which i already change above, means lowerCase**
                }               
         }}     
    });
  • 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-06-19T03:37:19+00:00Added an answer on June 19, 2026 at 3:37 am

    setText is changing the text content to exactly what you give it, not appending it.

    Convert the String from the field first, then apply it directly…

    String value = "This Is A Test";
    StringBuilder sb = new StringBuilder(value);
    for (int index = 0; index < sb.length(); index++) {
        char c = sb.charAt(index);
        if (Character.isLowerCase(c)) {
            sb.setCharAt(index, Character.toUpperCase(c));
        } else {
            sb.setCharAt(index, Character.toLowerCase(c));
        }
    }
    
    SecondTextField.setText(sb.toString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a table to display on a web page and that table
I want to implement dynamical text replacement (only the display is replaced, the actual
Is there an easy way to get (or simply display) the text from a
I have 2 ArrayLists that I want to display at alternate times. I have
I have some files in IsolatedStorage with HTML text. How can I display this
I have lot of png sequences that I need to loop through and display
Im writing a page that will display a video, and on playback completion, will
Is there any way to display floating point image on web form? Alternatively, I
I have a piece of PHP code that loops through to display all the
I've got lines of text inside a div that alternate background colors to make

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.