java - Only Half of the new Jpanel is showing after logging in -


i have log in system , logs in fine shows half of new jpanel when user signs in using java , netbeans

this code:

 if(loggedin){                 main_menu panel= new main_menu();                 controlpanel.setvisible(false);                 mainframe.remove(controlpanel);                 mainframe.add(controlpanel2);                 controlpanel2.add(panel);                   controlpanel2.setvisible(true);             }         }catch(sqlexception ex){             joptionpane.showmessagedialog(null, "problem executing sql query."); 

the old panel removed , new panel added when log in half of jpanel visible, why be?

only half of jpanel visible, why be?

the size of second panel larger need pack() frame components displayed @ preferred size.

or option use card layout , let layout manager handle swapping of panels. manage size properly.

read section swing tutorial on how use cardlayout more information , working examples.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -