Solved

Greying out a text box using java swing

Posted on 2010-08-12
6
702 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
  • 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

746 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now