List of usage examples for org.eclipse.swt.widgets Label getParent
public Composite getParent()
Composite
or null when the receiver is a shell that was created with null or a display for a parent. From source file:ShowInputDialog.java
private void createContents(final Shell parent) { parent.setLayout(new FillLayout(SWT.VERTICAL)); final Label label = new Label(parent, SWT.NONE); Button button = new Button(parent, SWT.PUSH); button.setText("Push Me"); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create and display the InputDialog InputDialog dlg = new InputDialog(parent); String input = dlg.open(); if (input != null) { // User clicked OK; set the text into the label label.setText(input);//w ww. j a v a 2 s . co m label.getParent().pack(); } } }); }