1 19 package org.netbeans.modules.editor.hints.options; 20 21 import java.awt.Component ; 22 import javax.swing.JList ; 23 import javax.swing.JTable ; 24 import javax.swing.ListCellRenderer ; 25 import javax.swing.table.TableCellRenderer ; 26 import org.netbeans.spi.editor.hints.Severity; 27 import org.openide.awt.HtmlRenderer; 28 import org.openide.awt.HtmlRenderer.Renderer; 29 30 public final class SeverityComboRenderer implements ListCellRenderer , TableCellRenderer { 31 32 private Renderer delegateTo; 33 34 public SeverityComboRenderer() { 35 delegateTo = HtmlRenderer.createRenderer(); 36 } 37 38 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { 39 return delegateTo.getListCellRendererComponent(list, AdvancedPanelImpl.SEVERITIES.get(((Severity) value).ordinal()), index, isSelected, cellHasFocus); 40 } 41 42 public Component getTableCellRendererComponent(JTable table, 43 Object value, 44 boolean isSelected, 45 boolean hasFocus, 46 int row, 47 int column) { 48 return delegateTo.getTableCellRendererComponent(table, AdvancedPanelImpl.SEVERITIES.get(((Severity) value).ordinal()), isSelected, hasFocus, row, column); 49 } 50 51 } | Popular Tags |