java - Avoid JPanel from getting over another -
i'm trying load jpanels inside can see one, others hidden behind it. code:
pnlresultados.setlayout(new java.awt.borderlayout()); (int = 0; < cantresultados; i++) { presultado pr = new presultado(modelo, resultados.get(i), padre, this); system.out.println("panel"); pnlresultados.add(pr); pr.setvisible(true); } pnlresultados.setvisible(true); pnlresultados.revalidate(); pnlresultados.repaint();
i have used system.out.printl
see how many pannels i'm creating , inserting , seems alright. problem alocated in same place, 1 on other. how can avoid behaviour? thank you
when don't specify constraint when adding component borderlayout, components go center. however, last component added visible.
the solution use different layout manager.
since adding components in loop, suggest might want @ gridlayout
.
read section swing tutorial on layout managers more information , working examples.
you can nest panels different layout manager achieve desired layout.
Comments
Post a Comment