1 package org
.argeo
.eclipse
.ui
;
3 import org
.eclipse
.swt
.SWT
;
4 import org
.eclipse
.swt
.events
.ModifyListener
;
5 import org
.eclipse
.swt
.layout
.GridData
;
6 import org
.eclipse
.swt
.widgets
.Composite
;
7 import org
.eclipse
.swt
.widgets
.Label
;
8 import org
.eclipse
.swt
.widgets
.Text
;
10 /** Utilities to simplify UI development. */
11 public class EclipseUiUtils
{
13 * Create a label and a text field for a grid layout, the text field grabing
17 * the parent composite
19 * the lable to display
20 * @param modifyListener
21 * a {@link ModifyListener} to listen on events on the text, can
23 * @return the created text
25 public static Text
createGridLT(Composite parent
, String label
,
26 ModifyListener modifyListener
) {
27 Label lbl
= new Label(parent
, SWT
.LEAD
);
29 lbl
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
30 Text txt
= new Text(parent
, SWT
.LEAD
| SWT
.BORDER
);
31 txt
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
33 txt
.addModifyListener(modifyListener
);
37 public static Text
createGridLP(Composite parent
, String label
,
38 ModifyListener modifyListener
) {
39 Label lbl
= new Label(parent
, SWT
.LEAD
);
41 lbl
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
42 Text txt
= new Text(parent
, SWT
.LEAD
| SWT
.BORDER
| SWT
.PASSWORD
);
43 txt
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
45 txt
.addModifyListener(modifyListener
);