Beispiel #1
0
  /** @param args */
  public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setText("CDateTime");
    shell.setLayout(new GridLayout(3, true));

    final CDateTime date = new CDateTime(shell, CDT.BORDER | CDT.DROP_DOWN);
    date.setNullText("<day>");
    date.setPattern("dd");
    date.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    final CDateTime month = new CDateTime(shell, CDT.BORDER | CDT.DROP_DOWN);
    month.setNullText("<month>");
    month.setPattern("MMMM");
    month.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    final CDateTime year = new CDateTime(shell, CDT.BORDER | CDT.DROP_DOWN);
    year.setNullText("<year>");
    year.setPattern("yyyy");
    year.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    shell.pack();
    Point size = shell.getSize();
    Rectangle screen = display.getMonitors()[0].getBounds();
    shell.setBounds((screen.width - size.x) / 2, (screen.height - size.y) / 2, size.x, size.y);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
Beispiel #2
0
  protected void createMiscellaneousGroup(Composite parent) {
    Group content = new Group(parent, SWT.NONE);
    content.setText(Messages.OrderDialog_MiscLabel);
    content.setLayout(new GridLayout(2, false));
    content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));

    Label label = new Label(content, SWT.NONE);
    label.setText(Messages.OrderDialog_TimeInForceLabel);
    validityCombo = new ComboViewer(content, SWT.BORDER | SWT.READ_ONLY | SWT.DROP_DOWN);
    validityCombo.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    validityCombo.setContentProvider(new ArrayContentProvider());
    validityCombo.setLabelProvider(new LabelProvider());

    label = new Label(content, SWT.NONE);
    label.setText(Messages.OrderDialog_ExpireLabel);
    expireDate =
        new CDateTime(content, CDT.BORDER | CDT.DATE_SHORT | CDT.DROP_DOWN | CDT.TAB_FIELDS);
    expireDate.setPattern(Util.getDateFormatPattern());
    expireDate.setSelection(new Date());
    expireDate.setEnabled(false);

    label = new Label(content, SWT.NONE);
    label.setText(Messages.OrderDialog_ReferenceLabel);
    orderReference = new Text(content, SWT.BORDER);
    orderReference.setLayoutData(new GridData(convertWidthInCharsToPixels(40), SWT.DEFAULT));
  }