示例#1
0
 private void createIconStyleGroup(final Composite parent) {
   Group group = new Group(parent, SWT.NONE);
   group.setLayout(new GridLayout());
   GridData iconGroupData = new GridData(SWT.FILL, SWT.FILL, false, false);
   group.setLayoutData(iconGroupData);
   group.setText("SWT MessageBox Icon Styles");
   iconErrorButton = new Button(group, SWT.RADIO);
   iconErrorButton.setText("SWT.ICON_ERROR");
   iconInformationButton = new Button(group, SWT.RADIO);
   iconInformationButton.setText("SWT.ICON_INFORMATION");
   iconQuestionButton = new Button(group, SWT.RADIO);
   iconQuestionButton.setText("SWT.ICON_QUESTION");
   iconWarningButton = new Button(group, SWT.RADIO);
   iconWarningButton.setText("SWT.ICON_WARNING");
   iconWorkingButton = new Button(group, SWT.RADIO);
   iconWorkingButton.setText("SWT.ICON_WORKING");
   noIconButton = new Button(group, SWT.RADIO);
   noIconButton.setText("No Icon");
   noIconButton.setSelection(true);
 }
示例#2
0
 private void createButtonStyleGroup(final Composite parent) {
   Group group = new Group(parent, SWT.NONE);
   group.setLayout(new GridLayout());
   GridData layoutData = new GridData(SWT.FILL, SWT.FILL, false, false);
   group.setLayoutData(layoutData);
   group.setText("SWT MessageBox Styles");
   okButton = new Button(group, SWT.CHECK);
   okButton.setText("SWT.OK");
   cancelButton = new Button(group, SWT.CHECK);
   cancelButton.setText("SWT.CANCEL");
   yesButton = new Button(group, SWT.CHECK);
   yesButton.setText("SWT.YES");
   noButton = new Button(group, SWT.CHECK);
   noButton.setText("SWT.NO");
   retryButton = new Button(group, SWT.CHECK);
   retryButton.setText("SWT.RETRY");
   abortButton = new Button(group, SWT.CHECK);
   abortButton.setText("SWT.ABORT");
   ignoreButton = new Button(group, SWT.CHECK);
   ignoreButton.setText("SWT.IGNORE");
 }
示例#3
0
  protected void createExampleControls(final Composite parent) {
    parent.setLayout(new GridLayout());
    Group group1 = new Group(parent, SWT.NONE);
    group1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group1.setText("JFace Dialogs");
    group1.setLayout(new GridLayout(3, true));

    // JFace input dialog
    Button showInputDlgButton = new Button(group1, SWT.PUSH);
    showInputDlgButton.setText("Input Dialog");
    showInputDlgButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            showInputDialog();
          }
        });
    showInputDlgButton.setLayoutData(createGridDataFillBoth());
    Button showProgressDlgButton = new Button(group1, SWT.PUSH);
    showProgressDlgButton.setText("ProgressDialog");
    showProgressDlgButton.setLayoutData(createGridDataFillBoth());
    showProgressDlgButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent e) {
            showProgressDialog();
          }
        });
    insertSpaceLabels(group1, 1);

    inputDlgResLabel = new Label(group1, SWT.WRAP);
    inputDlgResLabel.setText("Result:");
    GridData gdInputDlgResLabel = new GridData();
    gdInputDlgResLabel.horizontalSpan = 3;
    inputDlgResLabel.setLayoutData(gdInputDlgResLabel);

    Button showMessageInfoDlgButton = new Button(group1, SWT.PUSH);
    showMessageInfoDlgButton.setLayoutData(createGridDataFillBoth());
    showMessageInfoDlgButton.setText("Info Message");
    showMessageInfoDlgButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            showMessageDialogInfo();
          }
        });

    Button showMessageWarningDlgButton = new Button(group1, SWT.PUSH);
    showMessageWarningDlgButton.setLayoutData(createGridDataFillBoth());
    showMessageWarningDlgButton.setText("Warning Dialog");
    showMessageWarningDlgButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            showMessageDialogWarning();
          }
        });
    Button showMessageErrorDlgButton = new Button(group1, SWT.PUSH);
    showMessageErrorDlgButton.setLayoutData(createGridDataFillBoth());
    showMessageErrorDlgButton.setText("Error Message");
    showMessageErrorDlgButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            showMessageDialogError();
          }
        });

    Button showMessageQuestionDlgButton = new Button(group1, SWT.PUSH);
    showMessageQuestionDlgButton.setLayoutData(createGridDataFillBoth());
    showMessageQuestionDlgButton.setText("Question Dialog");
    showMessageQuestionDlgButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            showMessageDialogQuestion();
          }
        });

    Button showMessageConfirmDlgButton = new Button(group1, SWT.PUSH);
    showMessageConfirmDlgButton.setLayoutData(createGridDataFillBoth());
    showMessageConfirmDlgButton.setText("Confirm Message");
    showMessageConfirmDlgButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            showMessageDialogConfirm();
          }
        });
    insertSpaceLabels(group1, 1);

    messageDlgResLabel = new Label(group1, SWT.WRAP);
    messageDlgResLabel.setText("Result:");
    insertSpaceLabels(group1, 2);

    Button showErrorDlgButton = new Button(group1, SWT.PUSH);
    showErrorDlgButton.setLayoutData(createGridDataFillBoth());
    showErrorDlgButton.setText("Error Dialog");
    showErrorDlgButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            showErrorDialog();
          }
        });
    insertSpaceLabels(group1, 2);

    errorDlgResLabel = new Label(group1, SWT.WRAP);
    errorDlgResLabel.setText("Result:");
    insertSpaceLabels(group1, 2);

    Group group2 = new Group(parent, SWT.NONE);
    group2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group2.setText("Custom Dialogs");
    group2.setLayout(new GridLayout(3, true));

    Button showLoginDlgButton = new Button(group2, SWT.PUSH);
    showLoginDlgButton.setText("Login Dialog");
    showLoginDlgButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            showLoginDialog();
          }
        });
    showLoginDlgButton.setLayoutData(createGridDataFillBoth());
    insertSpaceLabels(group2, 2);

    loginDlgResLabel = new Label(group2, SWT.WRAP);
    loginDlgResLabel.setText("Result:");

    Group swtDialogsGroup = new Group(parent, SWT.NONE);
    swtDialogsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    swtDialogsGroup.setText("SWT Dialogs");
    swtDialogsGroup.setLayout(new GridLayout(3, true));

    showMessageBoxDlgButton = new Button(swtDialogsGroup, SWT.PUSH);
    showMessageBoxDlgButton.setText("MessageBox Dialog");
    showMessageBoxDlgButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            showMessageBoxDialog();
          }
        });
    showMessageBoxDlgButton.setLayoutData(createGridDataFillBoth());

    showColorDialogButton = new Button(swtDialogsGroup, SWT.PUSH);
    showColorDialogButton.setText("ColorDialog");
    showColorDialogButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent e) {
            showColorDialog();
          }
        });
    showColorDialogButton.setLayoutData(createGridDataFillBoth());
    showFontDialogButton = new Button(swtDialogsGroup, SWT.PUSH);
    showFontDialogButton.setText("FontDialog");
    showFontDialogButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent e) {
            showFontDialog();
          }
        });
    showFontDialogButton.setLayoutData(createGridDataFillBoth());

    messageBoxDlgResLabel = new Label(swtDialogsGroup, SWT.WRAP);
    messageBoxDlgResLabel.setText("Result:");
    GridData gdMessageBoxDlgResLabel = new GridData();
    gdMessageBoxDlgResLabel.horizontalSpan = 3;
    messageBoxDlgResLabel.setLayoutData(gdMessageBoxDlgResLabel);
  }