Example #1
0
  /*
   * Borde inte den här ha en sheet som inparameter också?
   */
  public SlotLabels(int rows, int cols, Control c, SheetBase sheet) {
    super(rows + 1, cols);
    this.ROWS = rows;
    this.COLS = cols;
    this.sheet = sheet;

    labelList = new ArrayList<SlotLabel>(ROWS * COLS);
    for (char ch = 'A'; ch < 'A' + COLS; ch++) {
      add(new ColoredLabel(Character.toString(ch), Color.LIGHT_GRAY, SwingConstants.CENTER));
    }
    for (int row = 1; row <= ROWS; row++) {
      for (char ch = 'A'; ch < 'A' + COLS; ch++) {
        String ID = generateID(row, ch);
        SlotLabel label = new SlotLabel(ID, c);
        add(label);
        labelList.add(label);
      }
    }
    this.sheet.addObserver(this);
    updateLabels(this.sheet);
  }
Example #2
0
 private String generateID(int row, char ch) {
   return Character.toString(ch) + Integer.toString(row);
 }