Java Code Examples for org.eclipse.swt.widgets.Label#setSize()
The following examples show how to use
org.eclipse.swt.widgets.Label#setSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MechanicStatusControlContribution.java From workspacemechanic with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createControl(Composite parent) { parent.getParent().setRedraw(true); initImageCache(); label = new Label(parent, SWT.CENTER); label.setSize(22, 22); label.setEnabled(false); setMechanicStatus(MechanicStatus.STOPPED); // observe mouse events registerClickHandlers(); createContextMenu(label); // observe TaskService status changes service.addTaskStatusChangeListener(statusListener); // TODO(smckay): figure out why updateDisplay must be called here and now // or else, the widget contents (label) will *never* get displayed. updateDisplay(); return label; }
Example 2
Source File: ProgressBarDemo.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
/** * Create contents of the dialog. * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new GridLayout(1, false)); completedInfo = new Label(container, SWT.NONE); completedInfo.setAlignment(SWT.CENTER); GridData gd_completedInfo = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1); gd_completedInfo.minimumWidth = 250; completedInfo.setLayoutData(gd_completedInfo); completedInfo.setSize(250, 40); completedInfo.setText("Processing Data ..."); new Label(container, SWT.NONE); progressBar = new ProgressBar(container, SWT.INDETERMINATE); GridData gd_progressBar = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1); gd_progressBar.minimumWidth = 250; progressBar.setLayoutData(gd_progressBar); progressBar.setBounds(10, 23, 400, 17); progressBar.setSelection(100); return container; }
Example 3
Source File: ProgressBarDialog.java From slr-toolkit with Eclipse Public License 1.0 | 5 votes |
/** * Create contents of the dialog. * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new GridLayout(1, false)); completedInfo = new Label(container, SWT.NONE); completedInfo.setAlignment(SWT.CENTER); GridData gd_completedInfo = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1); gd_completedInfo.minimumWidth = 250; completedInfo.setLayoutData(gd_completedInfo); completedInfo.setSize(250, 40); completedInfo.setText("Processing Data ..."); new Label(container, SWT.NONE); progressBar = new ProgressBar(container, SWT.SMOOTH); GridData gd_progressBar = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1); gd_progressBar.minimumWidth = 250; progressBar.setLayoutData(gd_progressBar); progressBar.setBounds(10, 23, 400, 17); taskLabel = new Label(container, SWT.NONE); taskLabel.setAlignment(SWT.CENTER); GridData gd_taskLabel = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1); gd_taskLabel.heightHint = 15; gd_taskLabel.minimumWidth = 250; taskLabel.setLayoutData(gd_taskLabel); taskLabel.setSize(250, 40); return container; }
Example 4
Source File: MainShell.java From RepDev with GNU General Public License v3.0 | 5 votes |
public void createStatusBar() { statusBar = new Composite(shell, SWT.BORDER | SWT.SHADOW_IN); // Layout Stuff FormLayout slayout = new FormLayout(); statusBar.setLayout(slayout); FormData statusBarData = new FormData(); statusBarData.left = new FormAttachment(0); statusBarData.right = new FormAttachment(100); statusBarData.bottom = new FormAttachment(100); statusBarData.height = 16; statusBar.setLayoutData(statusBarData); final Label verLabel = new Label(statusBar, SWT.NONE); verLabel.setText("RepDev " + RepDevMain.VERSION + " "); verLabel.setSize(100, 16); FormData data = new FormData(); data.left = new FormAttachment(0); verLabel.setLayoutData(data); Label sep1 = new Label(statusBar, SWT.SEPARATOR); data = new FormData(); data.left = new FormAttachment(verLabel); sep1.setLayoutData(data); lineColumn = new Label(statusBar, SWT.NONE); data = new FormData(); data.left = new FormAttachment(sep1); lineColumn.setLayoutData(data); setLineColumn(); }
Example 5
Source File: MultipleInputDialog.java From goclipse with Eclipse Public License 1.0 | 5 votes |
protected void createTextField(String labelText, String initialValue, boolean allowEmpty) { Label label = new Label(panel, SWT.NONE); label.setText(labelText); label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); final Text text = new Text(panel, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); text.setData(FIELD_NAME, labelText); // make sure rows are the same height on both panels. label.setSize(label.getSize().x, text.getSize().y); if (initialValue != null) { text.setText(initialValue); } if (!allowEmpty) { validators.add(new Validator() { @Override public boolean validate() { return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING); } }); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validateFields(); } }); } controlList.add(text); }
Example 6
Source File: TreeDialogBubble.java From slr-toolkit with Eclipse Public License 1.0 | 4 votes |
/** * Create contents of the dialog. */ private void createContents() { shlTerms = new Shell(getParent(), getStyle()); shlTerms.setSize(309, 441); shlTerms.setText("Terms"); shlTerms.setLayout(new GridLayout(1, false)); Composite composite = new Composite(shlTerms, SWT.NONE); composite.setLayout(new GridLayout(1, false)); Label lblPleaseSelect = new Label(composite, SWT.NONE); lblPleaseSelect.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); lblPleaseSelect.setText("Please select a term:"); Composite composite_1 = new Composite(shlTerms, SWT.NONE); GridData gd_composite_1 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); gd_composite_1.widthHint = 107; composite_1.setLayoutData(gd_composite_1); composite_1.setLayout(new GridLayout(1, false)); treeViewer = new TreeViewer(composite_1, SWT.BORDER); tree = treeViewer.getTree(); tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tree.addSelectionListener(this); buildTree(treeViewer); Composite composite_2 = new Composite(shlTerms, SWT.NONE); composite_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); composite_2.setLayout(new GridLayout(2, false)); Label lblNewLabel = new Label(composite_2, SWT.NONE); lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); lblNewLabel.setSize(92, 15); lblNewLabel.setText("Group Series Per: "); Button btnSubclasses = new Button(composite_2, SWT.NONE); btnSubclasses.setText("Subclasses"); btnSubclasses.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { shlTerms.dispose(); } }); }
Example 7
Source File: DeleteConfirmDialog.java From Rel with Apache License 2.0 | 4 votes |
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new FormLayout()); Label image = new Label(container, SWT.TRANSPARENT); FormData fd_composite = new FormData(); fd_composite.top = new FormAttachment(0, 10); fd_composite.left = new FormAttachment(0, 10); image.setLayoutData(fd_composite); Image question = IconLoader.loadIcon("question"); image.setImage(question); image.setSize(question.getBounds().width, question.getBounds().height); Label lblPrompt = new Label(container, SWT.NONE); FormData fd_lblPrompt = new FormData(); fd_lblPrompt.top = new FormAttachment(0, 10); fd_lblPrompt.left = new FormAttachment(image, 10); fd_lblPrompt.right = new FormAttachment(100, -10); lblPrompt.setLayoutData(fd_lblPrompt); if (count > 0) lblPrompt.setText("Press OK to delete " + count + " " + whatToDelete + ((count > 1) ? "s" : "") + ". Press Cancel to do nothing."); else lblPrompt.setText("No " + whatToDelete + "s selected. Press Ok to optionally confirm the checkbox below, or Cancel to do nothing."); Button btnNoAsk = new Button(container, SWT.CHECK); FormData fd_btnNoAsk = new FormData(); fd_btnNoAsk.top = new FormAttachment(lblPrompt, 10); fd_btnNoAsk.bottom = new FormAttachment(100, -10); fd_btnNoAsk.right = new FormAttachment(100, -10); btnNoAsk.setLayoutData(fd_btnNoAsk); btnNoAsk.setSelection(noAskAgain); btnNoAsk.setText("Don't ask me again."); btnNoAsk.addListener(SWT.Selection, e -> { noAskAgain = btnNoAsk.getSelection(); }); container.pack(); return container; }