Solved

Greying out a text box using java swing

Posted on 2010-08-12
6
710 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to add new optional parameter to JSP 1 49
use lov values 2 61
Which non-HTML GUI front end to use with Java? 3 24
collection output issue 9 36
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
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…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

839 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