Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.Component;

import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;

import javax.swing.ListCellRenderer;

public class Main {
    /**
     * Used to get a cell renderer for JLists that shows no visible selection
     * 
     * @return
     */
    public static ListCellRenderer<?> createInvisibleCellRenderer() {
        return new DefaultListCellRenderer() {
            public Component getListCellRendererComponent(JList<?> list, Object value, int index,
                    boolean isSelected, boolean cellHasFocus) {
                super.getListCellRendererComponent(list, value, index, false, false);

                return this;
            }
        };
    }
}