Is it possible to specify a fixed height for a widget - say, a canvas - in SWT? I'm looking into possibly porting an app of mine from LispWorks CAPI to Clojure with开发者_开发问答 SWT, and it's crucial that I have this facility. Many thanks for any help, Chris.
SWT uses layout managers and 'hints' for widget sizes. In your case I'd say that AbsoluteLayout is the correct choice. But, be aware, SWT is backed by the native OS' widgets, so setting height on a native widgets may have no effect. There are quite a few custom-drawn widgets that come with SWT that you could use instead, e.g. CCombo.
You could use:
Object mywidget=new Object();
mywidget.size();
You could use griddata and set size relative to screen pixels so the size maintains in ratio With the screen size the user useses.
精彩评论