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?