dcsimg
Show a component in a middle of the screen
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ivn_Tcakov
Posted On:   Monday, October 15, 2001 11:24 AM

Hello,
when I have some component (any) and when I
call show() on it, it is displayed in the upper left corner of the
screen every time. Is there a way to have it open in the
middle of the screen?
Thanks
Ivan

Re: Show a component in a middle of the screen

Posted By:   Virgilio_Garcia  
Posted On:   Monday, October 15, 2001 05:51 PM

You can put this in eachFrame that you wants center:


setSize(int x,int y);
setResizable(false);//If you want
Dimension frameSize = getSize();
if (frameSize.height > FRAME.screenSize.height)
frameSize.height= FRAME.screenSize.height;
if (frameSize.width > FRAME.screenSize.width)
frameSize.width= FRAME.screenSize.width;
setLocation((FRAME.screenSize.width - frameSize.width)/2, (FRAME.screenSize.height-frameSize.height)/2);
About | Sitemap | Contact