In a Java SWT shell window, how do I set its inner size than its whole window frame size?
For instance, if I use shell.setSize(300, 250) this would make the whole window appearing as exactly 300×250. This 300×250 includes the size of the window frame.
How can I set the inner size, that is the content display region of the shell window to 300×250 instead? That’s this 300×250 excludes the width of the window frame.
I tried to minus some offset values but the thing is different Operating Systems have different window frame sizes. So having a constant offset would not be accurate.
Thanks.
From your question what I understood is that you want to set the dimension of the
Client Area. And in SWT lingo it is defined asa rectangle which describes the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings").You cannot directly set the dimension of
Client Areabecause there is no API for it. Although you can achieve this by a little hack. In the below sample code I want my client area to be300 by 250. To achieve this I have used theshell.addShellListener()event listener. When the shell is completely active (see thepublic void shellActivated(ShellEvent e)) then I calculate the different margins and again set the size of my shell. The calculation and resetting of the shell size gives me the desired shell size.>>Code: