Exemple #1
0
 public void drawDiagonal(int y0, int x0, int len, String direction, char ch) {
   if (yoffset != 0) y0 += yoffset;
   if (xoffset != 0) x0 += xoffset;
   int y1 = y0, x1 = x0;
   boolean from = (direction.indexOf('>') >= 0);
   Format.printf("from=%l\n", new Parameters(from));
   if (direction.indexOf('/') != -1) {
     if (from) {
       y1 = y0 - len - 1;
       x1 = x0 + len - 1;
     } else {
       y1 = y0 + len - 1;
       x1 = x0 - len - 1;
     }
   } else if (direction.indexOf('\\') != -1) {
     if (from) {
       y1 = y0 + len - 1;
       x1 = x0 + len - 1;
     } else {
       y1 = y0 - len - 1;
       x1 = x0 - len - 1;
     }
   }
   drawLine(y0, x0, y1, x1, ch);
 }
Exemple #2
0
  private static void test01() throws Exception {
    Format.printf("test01...\n");
    Parameters p = new Parameters();

    TextArea tm = new TextArea();
    tm.fill('x');
    tm.clearRow(4);
    tm.clearColumn(24);
    tm.fillColumn(9, '1');
    tm.fillColumn(19, '2');
    tm.fillColumn(29, '3');
    tm.fillColumn(39, '4');
    tm.fillColumn(49, '5');
    tm.fillColumn(59, '6');
    tm.fillColumn(69, '7');
    tm.fillColumn(79, '8');
    tm.drawLine(11, 4, 50, 22, '.');
    tm.drawDiagonal(5, 20, 15, "\\>", '\\');
    tm.drawDiagonal(6, 55, 40, "</", '/');
    Format.printf("%s", p.add(tm));
  }
Exemple #3
0
 public int put(int row, int col, String fmtstr, Parameters p) {
   return put(row, col, Format.sprintf(fmtstr, p));
 }