Exemple #1
0
  private void doRowData() {
    tableModel.removeAllRows();

    for (int i = 0, j = font.getStartIndex(); i < font.getCharCount(); i++, j++) {
      FontCharacter fc = font.getCharacter(i);

      String hexVal = (Integer.toHexString(j)).toUpperCase();
      if (hexVal.length() == 1) hexVal = "0" + hexVal;

      String asciiC = "";
      if (j >= 32 && j < 127) {
        asciiC = "" + (char) j;
      }

      Object[] tableData = {"" + j, "0x" + hexVal, asciiC, "" + fc.getWidth(), fc.getComment()};
      tableModel.addRow(tableData);
    }
    charTable.setRowSelectionInterval(0, 0);
  }
Exemple #2
0
 public void propertyChange(PropertyChangeEvent e) {
   // System.out.println(e);
   int row = charTable.getSelectedRow();
   if (row != -1) {
     int col = charTable.getSelectedColumn();
     if (col == 3) {
       try {
         int width = Integer.parseInt((String) charTable.getValueAt(row, col));
         FontCharacter fc = getSelectedCharacter();
         fc.changeSize(0, 0, 0, width - fc.getWidth());
         setSelectedCharacter(fc);
         parent.editingCharSizeChanged();
       } catch (NumberFormatException ex) {
         // ignore
       }
     } else if (col == 4) {
       String comment = (String) charTable.getValueAt(row, col);
       FontCharacter fc = getSelectedCharacter();
       fc.setComment(comment);
       setSelectedCharacter(fc);
     }
   }
 }