The Artima Developer Community
Sponsored Link

Java Buzz Forum
Customizing Cell Rendering

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
News Manager

Posts: 47623
Nickname: newsman
Registered: Apr, 2003

News Manager is the force behind the news at Artima.com.
Customizing Cell Rendering Posted: Nov 2, 2014 8:26 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by News Manager.
Original Post: Customizing Cell Rendering
Feed Title: JavaWorld
Feed URL: http://www.javaworld.com/index.rss
Feed Description: JavaWorld.com: Fueling Innovation
Latest Java Buzz Posts
Latest Java Buzz Posts by News Manager
Latest Posts From JavaWorld

Advertisement

Swing's javax.swing.JList component and JavaFX's javafx.scene.control.ListView control let you customize how their various cells are rendered. In this post, I show you how to accomplish these tasks.

Customizing Cell Rendering in Swing JLists

Q: How do I customize how a JList instance's cells are rendered?

A: Swing provides the javax.swing.ListCellRenderer<E> interface to identify components that can be used as "rubber stamps" to render a JList instance's cells. This interface declares the following method:

Component getListCellRendererComponent(JList<? extends E> list,
                                       E value,
                                       int index,
                                       boolean isSelected,
                                       boolean cellHasFocus)

According to ListCellRenderer's Javadoc, getListCellRendererComponent() returns a java.awt.Component that's configured to display the specified value. The Component's paint() method is then called to render the cell.

To read this article in full or to leave a comment, please click here

Read: Customizing Cell Rendering

Topic: Factory Method Design Pattern Previous Topic   Next Topic Topic: Kotlin versus Java Puzzlers

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use