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

  • Home
  • SEARCH
  • 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 8800583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:37:41+00:00 2026-06-14T00:37:41+00:00

I wrote my own ListCellRenderer (code below) which gets my cells transparent. Now if

  • 0

I wrote my own ListCellRenderer (code below) which gets my cells transparent.
Now if I run this, every single time I click on a listitem, it becomes more whiter than before. Could it be, that the JList always add’s this new JLabel – that I created – and overlays the last one?

    jListPriority.setOpaque(true);
        jListPriority.setBackground(new Color(255, 255, 255, 10));
        jListPriority.setBorder(BorderFactory.createLineBorder(new Color(250, 250, 250)));

        jListPriority.setCellRenderer(new ListCellRenderer() {

                private JLabel label = new JLabel();

                public Component getListCellRendererComponent(JList list, Object value,   
                                 int index, boolean isSelected, boolean cellHasFocus) {

                    label.setOpaque(true);
                    label.setText(value.toString());
                    label.setForeground(new Color(250, 250, 250));
                    label.setFont(new Font("Lucida Grande", Font.PLAIN, 13));
                    label.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(250, 250, 250, 50)));
                    label.setPreferredSize(new Dimension(label.getPreferredSize().width, label.getPreferredSize().height + 3));

                    if (isSelected) {
                        label.setBackground(new Color(255, 255, 255, 20));
                    } else {
                        label.setBackground(new Color(255, 255, 255, 10));
                    }

                    return label;
                }
            });
  • 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-06-14T00:37:42+00:00Added an answer on June 14, 2026 at 12:37 am

    The default composite for Graphics2D uses the AlphaComposite.SRC_OVER rule, so the result is expected. You’ll need to specify a suitable mode for your desired effect. You may get some ideas from this example.

    image

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

Sidebar

Related Questions

i wrote a own Security Manager and my problem is, that i run code
For this assignment I had to create my own string class. I initially wrote
I wrote my own context by reading this article and many others, but none
I wrote my own little PHP MVC Framework, and now Im exploring caching strategies
I wrote my own PageStatePersister class based on SessionPageStatePersister which writes the most recent
I wrote my own Magento function which calculates the percentage relation of orders to
in php i wrote my own debug function which have two arguments: text and
I wrote my own custom page template for my Wordpress page, now I want
I wrote my own LSP which is working fine. However, I can not catch
I used this answer and wrote my own program, but I have a specific

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.