i'm creating swt application , have been unsuccessfully searching around on net way snap window right of screen (in similar fashion way google desktop used work).
so if start menu on right hand side of screen should sit left of otherwise can snap directly right hand side of screen.
can me out way can this?
here code utilizes functions found sambi:
public static void main(string[] args) { display display = new display(); final shell shell = new shell(display); shell.setlayout(new filllayout(swt.vertical)); shell.settext("stackoverflow"); monitor primary = display.getprimarymonitor(); /* available screen size (without start menu) */ rectangle area = primary.getclientarea(); shell.pack(); /* set shell size */ shell.setbounds(area.x + area.width / 2, area.y, area.width / 2, area.height); shell.open(); while (!shell.isdisposed()) { if (!display.readanddispatch()) display.sleep(); } display.dispose(); }
tested on both linux (panel left , bottom) , windows 7 (start menu left).
Comments
Post a Comment