?
Solved

setCellRenderer

Posted on 2006-11-06
2
Medium Priority
?
314 Views
Last Modified: 2011-09-20
Hi,

I have a superclass Maxi that setCellRender(RendererC) for it's List A (a JList). This is the RendererC is declared as a inner class for Maxi

I have extended this superclass Maxi to Class Mini, and wish to retain the functionality of List A, but I would like to change the renderering for List A for Class Mini, so I also declared an inner RendererC for Class Mini, and super.initComponents(), setCellRender for List A to RendererC of Class Mini. But List A continue to retain the outlook of the RendererC in Maxi...

Can I know why this is so, and how can I change it to respond to the class in Mini instead?

0
Comment
Question by:amai
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17882547
After calling super.initComponents() change the cell renderer


list.setCellRenderer(rendererC);
0
 
LVL 92

Accepted Solution

by:
objects earned 280 total points
ID: 17885211
> Can I know why this is so, and how can I change it to respond to the class in Mini instead?

because you are still creating an instance of Maxi's inner class.

add a createRenderer() method that creates your cell renderer and call that from initComponents().
then override createRenderer() in your subclass.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

762 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