Saturday 15 September 2012

java - White, read-only Text field in SWT -


I am trying to create a large white box in a SWT window to display information. I want to look different from this one label, but I also want to be non-editable.

So far, I'm able to create a noon-editable text box with only gray back (top). I am aiming to meet with a list (under text ).

Enter image details here

(with List This can only display text on a row per list item. I need to display the paragraph text.)

If you actually use to a white background, then you can use a normal text and Can stop it from editing.

However , as previously mentioned by Ezine, you should stay in UI conferences, because for other reasons users can not be confused ...

Here is some code that reads the text with the "normal" background:

  public static zero main (string [] args) { Display display = new display (); Last Shell Shell = New Shell (Display); Shell.setText ("StackOverflow"); Shell.setLayout (new FillLayout ()); Text text = new text (shell, SWT.BORDER); Text.setText ("Read Only"); Text.addListener (SWT.Verify, new listener) {@Override public void handleEvent (event e) {e.doit = ​​false;}}); Shell.pack (); Shell.setSize (600, 60); Shell.open (); While (! Shell.isDisposed ()) {if (! Display.readAndDispatch ()) display.sleep (); } Display.dispose (); }    

No comments:

Post a Comment