/** Creates the "Control" group. */ void createControlGroup() { /* * Create the "Control" group. This is the group on the * right half of each example tab. It consists of the * style group, the display group and the size group. */ controlGroup = new Group(tabFolderPage, SWT.NONE); GridLayout gridLayout = new GridLayout(); controlGroup.setLayout(gridLayout); gridLayout.numColumns = 2; gridLayout.makeColumnsEqualWidth = true; controlGroup.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); controlGroup.setText(ControlExample.getResourceString("Parameters")); /* * Create a group to hold the dialog style combo box and * create dialog button. */ dialogStyleGroup = new Group(controlGroup, SWT.NONE); dialogStyleGroup.setLayout(new GridLayout()); GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER); gridData.horizontalSpan = 2; dialogStyleGroup.setLayoutData(gridData); dialogStyleGroup.setText(ControlExample.getResourceString("Dialog_Type")); }
private void createRight(final Composite parent) { parent.setLayout(new FillLayout()); Group styleGroup = new Group(parent, SWT.NONE); styleGroup.setText("Styles and Parameters"); styleGroup.setLayout(new FillLayout()); styleComp = new Composite(styleGroup, SWT.NONE); styleComp.setLayout(new RowLayout(SWT.VERTICAL)); }
/** Creates a text that controls whether a border radius is set on the registered controls. */ protected void cteateRoundedBorderGroup() { Group group = new Group(styleComp, SWT.NONE); group.setText("Rounded Border"); group.setLayout(new GridLayout(2, false)); new Label(group, SWT.NONE).setText("Width"); final Text textWidth = new Text(group, SWT.SINGLE | SWT.BORDER); textWidth.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(group, SWT.NONE).setText("Color"); final Button buttonColor = new Button(group, SWT.PUSH); buttonColor.setLayoutData(new GridData(20, 20)); buttonColor.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { rbIndex = (rbIndex + 1) % bgColors.length; if (bgColors[rbIndex] == null) { buttonColor.setText(""); } else { buttonColor.setText("\u2588"); } buttonColor.setForeground(bgColors[rbIndex]); } }); new Label(group, SWT.NONE).setText("Radius "); Composite radiusGroup = new Composite(group, SWT.NONE); radiusGroup.setLayout(new GridLayout(4, false)); new Label(radiusGroup, SWT.NONE).setText("T-L"); final Text textTopLeft = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textTopLeft.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(radiusGroup, SWT.NONE).setText("T-R"); final Text textTopRight = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textTopRight.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(radiusGroup, SWT.NONE).setText("B-L"); final Text textBottomLeft = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textBottomLeft.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(radiusGroup, SWT.NONE).setText("B-R"); final Text textBottomRight = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textBottomRight.setLayoutData(new GridData(20, SWT.DEFAULT)); Button button = new Button(group, SWT.PUSH); button.setText("Set"); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { int width = parseInt(textWidth.getText()); Color color = buttonColor.getBackground(); int topLeft = parseInt(textTopLeft.getText()); int topRight = parseInt(textTopRight.getText()); int bottomRight = parseInt(textBottomRight.getText()); int bottomLeft = parseInt(textBottomLeft.getText()); updateRoundedBorder(width, color, topLeft, topRight, bottomRight, bottomLeft); } }); }
/** Creates the "Example" group. */ void createExampleGroup() { super.createExampleGroup(); /* Create a group for the canvas widget */ canvasGroup = new Group(exampleGroup, SWT.NONE); canvasGroup.setLayout(new GridLayout()); canvasGroup.setLayoutData( new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); canvasGroup.setText("Canvas"); }
/** Creates the "Example" group. */ void createExampleGroup() { super.createExampleGroup(); exampleGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); /* * Create a group for the text widget to display * the results returned by the example dialogs. */ resultGroup = new Group(exampleGroup, SWT.NONE); resultGroup.setLayout(new GridLayout()); resultGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); resultGroup.setText(ControlExample.getResourceString("Dialog_Result")); }
public static Group createControlGroup( Composite parent, String label, int columns, int layoutStyle, int widthHint) { Group group = new Group(parent, SWT.NONE); group.setText(label); GridData gd = new GridData(layoutStyle); if (widthHint > 0) { gd.widthHint = widthHint; } group.setLayoutData(gd); GridLayout gl = new GridLayout(columns, false); group.setLayout(gl); return group; }
public Shell open(Display display) { clipboard = new Clipboard(display); shell = new Shell(display); shell.setText("SWT Clipboard"); shell.setLayout(new FillLayout()); ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL); Composite parent = new Composite(sc, SWT.NONE); sc.setContent(parent); parent.setLayout(new GridLayout(2, true)); Group copyGroup = new Group(parent, SWT.NONE); copyGroup.setText("Copy From:"); GridData data = new GridData(GridData.FILL_BOTH); copyGroup.setLayoutData(data); copyGroup.setLayout(new GridLayout(3, false)); Group pasteGroup = new Group(parent, SWT.NONE); pasteGroup.setText("Paste To:"); data = new GridData(GridData.FILL_BOTH); pasteGroup.setLayoutData(data); pasteGroup.setLayout(new GridLayout(3, false)); Group controlGroup = new Group(parent, SWT.NONE); controlGroup.setText("Control API:"); data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; controlGroup.setLayoutData(data); controlGroup.setLayout(new GridLayout(5, false)); Group typesGroup = new Group(parent, SWT.NONE); typesGroup.setText("Available Types"); data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; typesGroup.setLayoutData(data); typesGroup.setLayout(new GridLayout(2, false)); status = new Label(parent, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; data.heightHint = 60; status.setLayoutData(data); createTextTransfer(copyGroup, pasteGroup); createRTFTransfer(copyGroup, pasteGroup); createHTMLTransfer(copyGroup, pasteGroup); createFileTransfer(copyGroup, pasteGroup); createMyTransfer(copyGroup, pasteGroup); createControlTransfer(controlGroup); createAvailableTypes(typesGroup); sc.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); sc.setExpandHorizontal(true); sc.setExpandVertical(true); Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle monitorArea = shell.getMonitor().getClientArea(); shell.setSize( Math.min(size.x, monitorArea.width - 20), Math.min(size.y, monitorArea.height - 20)); shell.open(); return shell; }
/** Creates the "Control" widget children. */ void createControlWidgets() { /* Create the combo */ String[] strings = { ControlExample.getResourceString("ColorDialog"), ControlExample.getResourceString("DirectoryDialog"), ControlExample.getResourceString("FileDialog"), ControlExample.getResourceString("FontDialog"), ControlExample.getResourceString("PrintDialog"), ControlExample.getResourceString("MessageBox"), }; dialogCombo = new Combo(dialogStyleGroup, SWT.READ_ONLY); dialogCombo.setItems(strings); dialogCombo.setText(strings[0]); dialogCombo.setVisibleItemCount(strings.length); /* Create the create dialog button */ createButton = new Button(dialogStyleGroup, SWT.NONE); createButton.setText(ControlExample.getResourceString("Create_Dialog")); createButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); /* Create a group for the various dialog button style controls */ Group buttonStyleGroup = new Group(controlGroup, SWT.NONE); buttonStyleGroup.setLayout(new GridLayout()); buttonStyleGroup.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); buttonStyleGroup.setText(ControlExample.getResourceString("Button_Styles")); /* Create the button style buttons */ okButton = new Button(buttonStyleGroup, SWT.CHECK); okButton.setText("SWT.OK"); cancelButton = new Button(buttonStyleGroup, SWT.CHECK); cancelButton.setText("SWT.CANCEL"); yesButton = new Button(buttonStyleGroup, SWT.CHECK); yesButton.setText("SWT.YES"); noButton = new Button(buttonStyleGroup, SWT.CHECK); noButton.setText("SWT.NO"); retryButton = new Button(buttonStyleGroup, SWT.CHECK); retryButton.setText("SWT.RETRY"); abortButton = new Button(buttonStyleGroup, SWT.CHECK); abortButton.setText("SWT.ABORT"); ignoreButton = new Button(buttonStyleGroup, SWT.CHECK); ignoreButton.setText("SWT.IGNORE"); /* Create a group for the icon style controls */ Group iconStyleGroup = new Group(controlGroup, SWT.NONE); iconStyleGroup.setLayout(new GridLayout()); iconStyleGroup.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); iconStyleGroup.setText(ControlExample.getResourceString("Icon_Styles")); /* Create the icon style buttons */ iconErrorButton = new Button(iconStyleGroup, SWT.RADIO); iconErrorButton.setText("SWT.ICON_ERROR"); iconInformationButton = new Button(iconStyleGroup, SWT.RADIO); iconInformationButton.setText("SWT.ICON_INFORMATION"); iconQuestionButton = new Button(iconStyleGroup, SWT.RADIO); iconQuestionButton.setText("SWT.ICON_QUESTION"); iconWarningButton = new Button(iconStyleGroup, SWT.RADIO); iconWarningButton.setText("SWT.ICON_WARNING"); iconWorkingButton = new Button(iconStyleGroup, SWT.RADIO); iconWorkingButton.setText("SWT.ICON_WORKING"); noIconButton = new Button(iconStyleGroup, SWT.RADIO); noIconButton.setText(ControlExample.getResourceString("No_Icon")); /* Create a group for the modal style controls */ Group modalStyleGroup = new Group(controlGroup, SWT.NONE); modalStyleGroup.setLayout(new GridLayout()); modalStyleGroup.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); modalStyleGroup.setText(ControlExample.getResourceString("Modal_Styles")); /* Create the modal style buttons */ primaryModalButton = new Button(modalStyleGroup, SWT.RADIO); primaryModalButton.setText("SWT.PRIMARY_MODAL"); applicationModalButton = new Button(modalStyleGroup, SWT.RADIO); applicationModalButton.setText("SWT.APPLICATION_MODAL"); systemModalButton = new Button(modalStyleGroup, SWT.RADIO); systemModalButton.setText("SWT.SYSTEM_MODAL"); /* Create a group for the file dialog style controls */ Group fileDialogStyleGroup = new Group(controlGroup, SWT.NONE); fileDialogStyleGroup.setLayout(new GridLayout()); fileDialogStyleGroup.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); fileDialogStyleGroup.setText(ControlExample.getResourceString("File_Dialog_Styles")); /* Create the file dialog style buttons */ openButton = new Button(fileDialogStyleGroup, SWT.RADIO); openButton.setText("SWT.OPEN"); saveButton = new Button(fileDialogStyleGroup, SWT.RADIO); saveButton.setText("SWT.SAVE"); multiButton = new Button(fileDialogStyleGroup, SWT.CHECK); multiButton.setText("SWT.MULTI"); /* Create the orientation group */ if (RTL_SUPPORT_ENABLE) { createOrientationGroup(); } /* Add the listeners */ dialogCombo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { dialogSelected(event); } }); createButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { createButtonSelected(event); } }); SelectionListener buttonStyleListener = new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { buttonStyleSelected(event); } }; okButton.addSelectionListener(buttonStyleListener); cancelButton.addSelectionListener(buttonStyleListener); yesButton.addSelectionListener(buttonStyleListener); noButton.addSelectionListener(buttonStyleListener); retryButton.addSelectionListener(buttonStyleListener); abortButton.addSelectionListener(buttonStyleListener); ignoreButton.addSelectionListener(buttonStyleListener); /* Set default values for style buttons */ okButton.setEnabled(false); cancelButton.setEnabled(false); yesButton.setEnabled(false); noButton.setEnabled(false); retryButton.setEnabled(false); abortButton.setEnabled(false); ignoreButton.setEnabled(false); iconErrorButton.setEnabled(false); iconInformationButton.setEnabled(false); iconQuestionButton.setEnabled(false); iconWarningButton.setEnabled(false); iconWorkingButton.setEnabled(false); noIconButton.setEnabled(false); saveButton.setEnabled(false); openButton.setEnabled(false); openButton.setSelection(true); multiButton.setEnabled(false); noIconButton.setSelection(true); }
private void createLeft(final Composite parent) { parent.setLayout(new FillLayout()); Group exmplGroup = new Group(parent, SWT.NONE); exmplGroup.setLayout(new FillLayout()); exmplComp = new Composite(exmplGroup, SWT.NONE); }