java - How to add a jbutton to a jpanel -
i've trying (unsuccessfully) add loop generated jbuttons jpanel. thing jpanel on jscrollpane. here code:
string categoria = this.cmbcategoria.getselecteditem().tostring(); string[] partidos = myestadio.buscarpartidos(categoria).split("/"); jbutton b; for(string p : partidos){ b = new jbutton(p); this.panelscroll.add(b, borderlayout.center); system.out.println(p); system.out.println(b.getlocationonscreen());
as can see, i'm printing label , button's location sure exists.
it exists , label doesn't show up. jpanel has borderlayout
layout , i'm using netbeans 8.0.2
in fact putting newly created button
instances same place. 1 on another. use other layout constraints (such north, south, ...), different layoutmanager
or better, nested layoutmanager
s such flowlayout
within borderlayout
. moreover, should add jpanel
.
Comments
Post a Comment