简体   繁体   中英

It's possible to increase/decrease Frame's width/height from left to right/down to up?

Shortly, I couldn't do it, however I tried several ways but the frame still increases from start point and goes back to it.
That's happening with the height as it's only moving up to down not down to up.
Here I add a code that decreases the width:

for(int i = getWidth();i>0;i-=8){
    setSize(i,getHeight());
     try{
    Thread.sleep(sleep);
    }catch(Exception ex){}
}

Is there a way that the frame could have a mid point and the both sides goes to it?

Each time you enlarge the frame, pack and re-center it on the display:

pack();
setLocationRelativeTo(null);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM