示例#1
0
  public void dateTextField(JFrameOperator jfo) throws Exception {
    JTextFieldOperator jtfo =
        new JTextFieldOperator(jfo, new ByClassChooser(JFormattedTextField.class));
    ContainerOperator<?> containerOperator = new ContainerOperator<>(jtfo.getParent());
    JButtonOperator jbo = new JButtonOperator(containerOperator, GO);
    JLabelOperator dowLabel = new JLabelOperator(containerOperator);
    Calendar calendar = Calendar.getInstance(Locale.ENGLISH);

    // Check default date Day of the Week
    jbo.push();
    dowLabel.waitText(calendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.ENGLISH));

    // Check Custom Day of the Week
    calendar.set(2012, 9, 11); // Represents "Oct 11, 2012"
    Date date = calendar.getTime();
    String dateString =
        jtfo.getQueueTool()
            .invokeAndWait(
                new QueueTool.QueueAction<String>(
                    "Formatting the value using JFormattedTextField formatter") {

                  @Override
                  public String launch() throws Exception {
                    return ((JFormattedTextField) jtfo.getSource())
                        .getFormatter()
                        .valueToString(date);
                  }
                });
    System.out.println("dateString = " + dateString);
    jtfo.enterText(dateString);

    jbo.push();
    dowLabel.waitText("Thursday");
  }
 /** Tests the JFontChooserDialog. */
 public void testOKButton() {
   logger_.info("Running testOKButton...");
   okButton_.clickMouse();
   assertTrue(!dialog_.getSource().isVisible());
 }
 public ComponentOperator open() {
   okButton.push();
   return null;
 }