コード例 #1
0
ファイル: DateFieldTest.java プロジェクト: XSoftBG/echopoint
  @AfterClass
  public static void finish() {
    final Component content = Application.getContent().getTestArea();
    content.removeAll();
    final Column column = new Column();
    column.add(get());
    // The following rows are used to test the Z-index behaviour
    Row d1row = new Row();
    dateField2 = new DateField();
    dateField2.setDateFormat("dd.MM.yyyy");
    dateField2.setFirstDayOfWeek(1);
    dateField2.setInputWidth(new Extent(8, Extent.EM));
    dateField2.setShowWeeks(true);
    d1row.add(dateField2);
    d1row.add(new Label("The following rows are used to test the Z-index behaviour"));
    column.add(d1row);
    Row d2row = new Row();
    dateField3 = new DateField();
    dateField3.setDate(new Date());
    d2row.add(dateField3);
    d2row.add(new Label("Field initialised with date"));
    column.add(d2row);
    column.add(new SelectField());

    Row d3row = new Row();
    PushButton pButton = new PushButton("Get Date value from second date field");
    d3row.add(pButton);
    pButton.addActionListener(
        new ActionListener() {
          private static final long serialVersionUID = 1l;

          public void actionPerformed(final ActionEvent event) {
            Date myDate = dateField2.getDate();
            if (myDate != null) {
              dateLabel.setText(myDate.toLocaleString());
            } else {
              dateLabel.setText("Date value is null");
            }
          }
        });
    dateLabel = new Label();
    d3row.add(dateLabel);

    column.add(d3row);

    content.add(column);
  }
コード例 #2
0
ファイル: DateFieldTest.java プロジェクト: XSoftBG/echopoint
  @BeforeClass
  public static void init() {

    ContainerEx containerEx = new ContainerEx();
    containerEx.setLayoutStyle(ContainerEx.COLUMN_LAYOUT);
    containerEx.setBackground(Color.GREEN);
    containerEx.setHeight(new Extent(350));
    containerEx.setWidth(new Extent(700));
    DateField dateField = new DateField();
    dateField.setBackground(Color.LIGHTGRAY);
    containerEx.add(dateField);
    DateField dateField2 = new DateField();
    dateField2.setBackground(Color.YELLOW);
    dateField2.setHeight(new Extent(300));
    dateField2.setWidth(new Extent(600));
    containerEx.add(dateField2);
    set(containerEx);
  }