Solved

Greying out a text box using java swing

Posted on 2010-08-12
6
715 Views
Last Modified: 2013-11-23
Hello All,

How the heck do I grey out my a text field in my application that is written using java-swing?
I just want to indicate to the user that this field is a read only text box.

Thanks in advance!
0
Comment
Question by:expertintraining
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 2

Expert Comment

by:gtagliani
ID: 33423134
hi!

try this:

JTextField textboxReadonly = new JTextField("A read-only text field", 20);
textboxReadonly.setEditable(false);

0
 

Author Comment

by:expertintraining
ID: 33423283
BTW, I am using nimbus look and feel
0
 

Author Comment

by:expertintraining
ID: 33423293
gtagliani: I tried that before posting the question...but no luck.
0
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 

Author Comment

by:expertintraining
ID: 33423299
Wondering if it is a nimbus look and feel limitation.
0
 
LVL 2

Accepted Solution

by:
gtagliani earned 250 total points
ID: 33423354
"Wondering if it is a nimbus look and feel limitation."
yes it is.

here is your answer
http://weblogs.java.net/blog/2008/07/31/nimbus-and-opacity
0
 

Author Comment

by:expertintraining
ID: 33425692
Thanks qtagliani, that was it.
:o)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question