Why are JLabels not transparent in my JList?

Posted on 2011-10-10
Medium Priority
Last Modified: 2012-05-12
Any idea why the JLabels arent transparent?

My process:
1.Create a JPanel using GridBagLayout Manager. Add a few JLabels.
2. Add the JPanel to an object array.
3. Pass object array into JList (setListData() method)
4. Call the setCellRenderer(new JListRenderer()) method

And it displays on screen with gray bg. Where am i going wrong?

Any thoughts or suggestions are appreciated.

 Screenshot of non transparent JLabels.
Question by:Gregg
LVL 47

Accepted Solution

for_yan earned 2000 total points
ID: 36942791

check this:

you probably need to cal setOpaque(false)
or set Background color on those elemesnt which you add to your component
LVL 10

Author Closing Comment

ID: 36942818
Yeah! I had it backwards, i had setOpaque(true).  Thanks for your help!

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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 …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

864 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