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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:51:40+00:00 2026-05-20T01:51:40+00:00

Was wondering if it is possible to initialize a text field with printing (this

  • 0

Was wondering if it is possible to initialize a text field with printing (this part I know how to do), but then have the printing highlighted, and then disappear when the user starts typing? Even without the highlighting, how can you have the field initialize with something like,” Please enter your phone number”, and then have that disappear so the the user doesn’t have to delete the text?

  • 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-20T01:51:41+00:00Added an answer on May 20, 2026 at 1:51 am

    There is another approach, with the focusGained event.
    Just mark the initial Text:

       String initialText = "Enter your story here...";
       ...
       jTextArea1.setText(initialText); 
       ...
    
       private void focusGained(java.awt.event.FocusEvent evt) {
            if (jTextArea1.getText().equals(initialText)) {
                //jTextArea1.setSelectionStart(0);
                //jTextArea1.setSelectionEnd(jTextArea1.getText().length());
                jTextArea1.selectAll();
            }
        }
    

    This way whenever the user types something in the jTextArea1 the initial text will be substituted immediately.

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

Sidebar

Related Questions

I am wondering if its possible to have a an (||)or or (&&)and operator
I know it's not possible to define a constructor in an interface, but I'm
I have not worked so much with files: I am wondering about possible issues
I wondering if it possible to have a preprocessor OR or AND statement? I
I am wondering is it possible to have a list box that has custom
i was wondering if it's possible to initialize a constant in an interface from
I was wondering if it's possible to change and initialize variables in a function
i'm new to php and am wondering - is it possible to initialize a
I have written a simple log4net wrapper. I was wondering whether this wrapper code
I don't know if this is possible so i will try to explain as

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.