Mega Code Archive

 
Categories / Java Tutorial / SWT
 

Introducing Text and Text Styles

SWT offers the Text class for text-entry fields. StyleDescription SWT.MULTICreates a multiple-line text field. SWT.SINGLECreates a single-line text field. This is the default. You may specifiy only one of SWT.MULTI or SWT.SINGLE. SWT.READ_ONLYCreates a text field with uneditable contents. SWT.WRAPWith multiple-line text fields, causes text to wrap. SWT.BORDERDraws a border around the text field. Note that this style isn't set by default, and your text fields will look funny without it. SWT.CENTERCenters the text in this text field. SWT.LEFTLeft-aligns the text in this text field. This is the default. SWT.RIGHTRight-aligns the text in this text field. You may specify only one of SWT.CENTER, SWT.LEFT, or SWT.RIGHT. SWT.PASSWORDCreates a text field suitable for password entry-it doesn't display the actual characters the user types, but rather it displays asterisks. SWT.H_SCROLLCreates a horizontal scrollbar to scroll this text field. SWT.V_SCROLLCreates a vertical scrollbar to scroll this text field. SWT.SINGLE | SWT.LEFT is set by default