1 19 package org.lucane.applications.userprofile; 20 21 import java.awt.Component ; 22 23 import javax.swing.DefaultListCellRenderer ; 24 import javax.swing.JLabel ; 25 import javax.swing.JList ; 26 27 public class LanguageCellRenderer extends DefaultListCellRenderer 28 { 29 private UserProfilePlugin plugin; 30 31 public LanguageCellRenderer(UserProfilePlugin plugin) 32 { 33 this.plugin = plugin; 34 } 35 36 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) 37 { 38 Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 39 JLabel label = (JLabel )c; 40 String lang = (String )value; 41 42 label.setText(plugin.tr("lang." + lang)); 43 label.setIcon(plugin.getFlag(lang)); 44 45 return label; 46 } 47 } | Popular Tags |