Exemplo n.º 1
0
 public static void main(String[] args) {
   Day today = new Day(2016, 2, 3); // February 15, 2010
   Day later = new Day(2016, 12, 25);
   System.out.println(later.getYear());
   System.out.println("Expected: 2010");
   System.out.println(later.getMonth());
   System.out.println("Expected: 3");
   System.out.println(later.getDate());
   System.out.println("Expected: 13");
   System.out.println(later.daysFrom(today));
   System.out.println("Expected: 30");
 }
Exemplo n.º 2
0
  public void drawU(UGraphic ug) {
    int n = 0;
    String last = null;

    double pendingX = -1;
    for (Day d = start; d.compareTo(end) <= 0; d = (Day) timeline.next(d)) {
      final String text = "" + d.getMonth().name();
      if (pendingX == -1) {
        pendingX = n * dayWidth;
        last = text;
      }
      ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
      ug = ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE));
      if (text.equals(last) == false) {
        manage(ug, 0, 0, n, last, pendingX);
        pendingX = n * dayWidth;
      }
      last = text;
      n++;
    }
    manage(ug, 0, 0, n, last, pendingX);
  }
Exemplo n.º 3
0
  public void drawU(UGraphic ug, double x, double y) {
    int n = 0;
    String last = null;

    double pendingX = -1;
    for (Day d = start; d.compareTo(end) <= 0; d = (Day) timeline.next(d)) {
      final String text = "" + d.getMonth().name();
      if (pendingX == -1) {
        pendingX = n * dayWidth;
        last = text;
      }
      ug.getParam().setColor(HtmlColorUtils.BLACK);
      ug.getParam().setBackcolor(HtmlColorUtils.WHITE);
      if (text.equals(last) == false) {
        manage(ug, x, y, n, last, pendingX);
        pendingX = n * dayWidth;
      }
      last = text;
      n++;
    }
    manage(ug, x, y, n, last, pendingX);
  }