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 layoutmanagers such flowlayout within borderlayout. moreover, should add jpanel.


Comments

Popular posts from this blog

methods - python can't use function in submodule -

Java 3D LWJGL collision -

c# - ErrorThe type or namespace name 'AxWMPLib' could not be found (are you missing a using directive or an assembly reference?) -