Thursday, 15 May 2014

java - JFrame doesn't re-maximize after Minimization -



java - JFrame doesn't re-maximize after Minimization -

i'm having problem getting custom jframe maximize correctly after beingness minimized. here's process i've gone through: open frame, maximize (code below), minimize it, , re-open programme dock. however, when re-open frame original size, not maximized size in before minimized it.

these methods called when maximize , minimize buttons pushed. custom jframe, , undecorated, made buttons these actions.

private void maximizeaction(){ setextendedstate(getextendedstate() | frame.maximized_both); }//================================= private void minimizeaction(){ setextendedstate(frame.iconified); }//=================================

i tried adding setpreferredsize(new dimension(screenwidth, screenheight)); line maximize function, didn't alter behavior of frame when re-opened it.

other possible contributing factors might be:

the frame has transparency , unique frame shape, have overridden paint() command. however, utilize inherited variables, should accurate. it's frame has forgotten how big was.

you need maintain previous extended state.

private void minimizeaction(){ setextendedstate(getextendedstate() | frame.iconified); }//=================================

java swing jframe minimize maximize

No comments:

Post a Comment