java - Add buttons in Border Layout -


i add buttons in border layout 1 after . not know how . thats part of code :

setlayout(new borderlayout()); jpanel jp = new jpanel(); jp.setbackground(color.blue); jpanel jp2 = new jpanel(); jp2.setbackground(color.light_gray); jpanel jp3 = new jpanel(); jp3.setbackground(color.white);  add(jp, borderlayout.south); add(jp2, borderlayout.east); add(jp3, borderlayout.west);  jp.add(btn, borderlayout.west); jp.add(btn2, borderlayout.center); jp.add(btn3, borderlayout.east);  jp2.add(btn4, borderlayout.north); jp2.add(btn5, borderlayout.north); jp2.add(btn6, borderlayout.center); jp2.add(btn7, borderlayout.south); jp2.add(btn8, borderlayout.south); 

but add buttons side side . beginner programmer , not idea how .

borderlayout not suited want - supports 1 component each constraint (north, south...)

use layout, there lot of options, gridlayout, gridbaglayout.

i use tablelayout, it's flexible layout - see homepage address below. www.clearthought.info/sun/products/jfc/tsc/articles/tablelayout/


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -