If I have a text field with SWT, how can I get the field to fill to 100% or some specified width.
For example, this text field will only reach for so much horizontally.
public class Tmp { public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell (display); GridLayout gridLayout = new GridLayout (); shell.setLayout (gridLayout); Button button0 = new Button(shell, SWT.PUSH); button0.setText ('button0'); Text text = new Text(shell, SWT.BORDER | SWT.FILL); text.setText ('Text Field'); shell.setSize(500, 400); //shell.pack(); shell.open(); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }
Make something like this:
/: Since this is the accepted answer I remove the errors. Thx for correcting me.