示例#1
0
 public void setCellsData(String[] data) {
   int rowkey = Integer.parseInt(data[0]);
   if (hsmRow.get(rowkey) != null) {
     JComponent comp = null;
     ArrayList<String> alData = new ArrayList<String>();
     int nextdata = 0, enddata = 0;
     for (int i = 0; i < columnTotal; i++) {
       System.out.println("column : " + i);
       comp = hsmRow.get(rowkey)[i];
       if (comp instanceof JLabel) {
         System.out.println("   instanceof JLabel");
         ((JLabel) comp).setText(data[nextdata]);
         nextdata += 1;
       } else if (comp instanceof CellPanel) {
         System.out.println("   instanceof CellPanel");
         enddata = ((CellPanel) comp).getComponentData().length + nextdata;
         System.out.println("..enddata " + enddata);
         System.out.println("..nextdata " + nextdata);
         for (int j = nextdata; j < enddata; j++) {
           System.out.println("data (" + j + ") " + data[j]);
           alData.add(data[j]);
         }
         ((CellPanel) comp).setComponentData(alData.toArray(new String[] {}));
         nextdata = enddata;
       } else System.out.println("   other type of instance");
       alData.clear();
     }
     comp = null;
     alData = null;
   }
 }
示例#2
0
 public void setCellData(int row, int column, String[] data) {
   if (hsmRow.size() <= 0) {
     System.err.println("ERROR : no row");
     return;
   }
   JComponent comp = null;
   if (hsmRow.get(row) != null) {
     comp = hsmRow.get(row)[column];
     if (comp instanceof CellPanel) ((CellPanel) comp).setComponentData(data);
   }
 }