org.drjekyll.fontchooser.panes.ToolTipCellRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fontchooser Show documentation
Show all versions of fontchooser Show documentation
A Java Swing Component to choose a font according to the list of available font families, styles and sizes.
package org.drjekyll.fontchooser.panes;
import javax.swing.*;
import java.awt.*;
public class ToolTipCellRenderer extends DefaultListCellRenderer {
@Override
public Component getListCellRendererComponent(JList> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JComponent listCellRendererComponent = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
listCellRendererComponent.setToolTipText(value.toString());
return listCellRendererComponent;
}
}