java - My buttons wont appear until i hover over it with my mouse -
i have problem , yes saw other people had problem not realy able compare there code mine , see problem way hope u can me.
i use intellij write code , use there gui desinger make gui's when added button didnt display untill hover mouse , possitions wrong , cant realy work. here classes // jpanel class public class paintmenu extends jpanel{
public jpanel menupanel; public jbutton newgamebutt; public jbutton loadgamebutt; public jbutton helpbutt; public jbutton optionsbutt; public jbutton info; public jbutton quitbutt; public paintmenu(){ add(newgamebutt); add(loadgamebutt); add(helpbutt); add(info); add(optionsbutt); add(quitbutt); setvisible(true); } //this de jframe class public class jframepainter extends jframe { paintmenu menupaint = new paintmenu(); public jframepainter(){ //main frame settings settitle("kingdom v " + reference.version); setsize(reference.width, reference.height); setresizable(false); setlocationrelativeto(null); setvisible(kingdom.vissible); setdefaultcloseoperation(jframe.exit_on_close); //draw jpnael getcontentpane().add(menupaint); }
try setting jframe visible after add jpanel it. may want call this.pack() after add jpanel.
//main frame settings settitle("kingdom v " + reference.version); setsize(reference.width, reference.height); setresizable(false); setlocationrelativeto(null); //draw jpnael getcontentpane().add(menupaint); //moved before setting visible this.pack(); // call pack before setting visible setdefaultcloseoperation(jframe.exit_on_close); setvisible(kingdom.vissible);
Comments
Post a Comment