java - using JScrollPane with JFrame, JPanel and GridLayout -
this question has answer here:
i have gridlayout (of jtextfields : 57*57) in jpanel in jframe (resolution 800*800) , result small , that's why have jscrollpane (that have 800*800 resolution , gridlayout resolution 3000*3000 example).
i've tried many things not working. can please me ?
here concerned part of code :
thanks.
gridlayout grid = new gridlayout(thumbnail.getheight(), thumbnail.getwidth(),0,0); final_frame = new jframe(); final_frame.setpreferredsize(new dimension(800, 800)); jpanel mypanel = new jpanel(); mypanel.setlayout(grid); //fill grid colors , denomination (int yy=0;yy<thumbnail.getheight();yy++){ (int xx=0;xx<thumbnail.getwidth();xx++){ (int kk=0;kk<colors.length;kk++){ if (thumbnail.getrgb(xx,yy)==colors[kk].getrgb()){ //system.out.println("color : "+colors[kk]+" libel : h"+libel[kk]); jtextfield tf = new jtextfield("h"+libel[kk]); tf.setbackground(colors[kk]); tf.setsize(10, 10); //do nothing ? mypanel.add(tf); } } } } final_frame.add(mypanel); final_frame.pack(); final_frame.setvisible(true); final_frame.setlocationrelativeto(null); final_frame.setdefaultcloseoperation(jframe.dispose_on_close);
Comments
Post a Comment