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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:45:30+00:00 2026-06-02T08:45:30+00:00

I have a JList that will point to a selected JList depending on user.

  • 0

I have a JList that will point to a selected JList depending on user. It acts like a monitor that will monitor the selected JList. When I implements custom cell renderer and programmically do something like this.list = getSelectedList(), the cell renderer does not react to this sudden change of information. How do I notify the JList to reevaluate its list data without having to invoke add/remove function?

  • 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-02T08:45:33+00:00Added an answer on June 2, 2026 at 8:45 am

    this.list = getSelectedList() affects another JList object to the this.list field. If you set a custom renderer to this.list before executing this line, you set the renderer on another JList object, and there is no way that the renderer becomes magically attached to the new selected list.

    You’re confusing variables and objects. When you call a method on the object, you’re modifying the object the variable points to, and not the variable itself. If you want to attach the same cell renderer to the newly selected JList, you need the following code:

    ListCellRenderer renderer = this.list.getCellRenderer();
    this.list = getSelectedList();
    this.list.setCellRenderer(renderer);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JList that holds a bunch of strings . I would like
I'm making a swing based application where I have a JList that periodically get's
I have a JList, and a JButton, user can click an item in the
I have a jlist with an arbitrary number of elements. I would like to
I have a JList with items that I want to show two values. Is
We have a controller where we have a pre-declared JList and JLabel that we
I have a jlist of users. In which some user has presence 1st and
I have a Jlist like the one below. I am using the JList.HorizontalWrap to
i have a simple example of a JList that is getting it's data from
I have a JComboBox that its renderer is a JLabel with an Icon for

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.