1 23 24 29 30 package com.sun.enterprise.tools.common.properties; 31 32 import javax.swing.*; 33 import java.util.*; 34 import java.text.*; 35 36 41 public class PrincipalsRenderer extends JLabel implements javax.swing.table.TableCellRenderer { 42 43 private static java.util.ResourceBundle bundle = 44 java.util.ResourceBundle.getBundle("com.sun.enterprise.tools.common.properties.Bundle"); 46 public PrincipalsRenderer() { 47 } 48 49 public java.awt.Component getTableCellRendererComponent(javax.swing.JTable jTable, java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int column) { 50 if (value == null) { 51 setText(MessageFormat.format(bundle.getString("PLURAL_PRIN_CAPTION"), new Object [] {"0"})); } 53 else if (value instanceof Vector) { 54 if (((Vector)value).size() == 1) 55 setText(bundle.getString("SINGLE_PRIN_CAPTION")); else 57 setText(MessageFormat.format(bundle.getString("PLURAL_PRIN_CAPTION"), new Object [] {new Integer (((Vector)value).size())})); } 59 else 60 System.out.println(value); 61 return this; 62 } 63 } 64 | Popular Tags |