java - Draw Line on Graph -
i want create grid of 6*6 next step put image tiles column column in each grid.a complete image composition of tiles in each grid. want draw lines on complete image formed 6*6 grid. have tried jlabel , created 6*6 grid of jlabels , image formed trying draw line on image formed , unable that. line starting end of image on right side. strucked @ point.please tell me in someway.
so... want 6*6 image tile grid? can jpanel paint method. if not using jpanel, then: main class
public class main{ public static void main(string[] args){ mywindow window = new mywindow(); } }
this mywindow class:
public class mywindow extends jframe{ public mywindow(){ super.setvisible(true); super.setsize(500,500); mypanel panel = new mypanel(); super.setcontentpane(panel); } }
this mypanel class:
public class mypanel extends jpanel{ public mypanel(){ super.setsize(500,500); super.setvisible(true); } @override public void paint(graphics g){ for(int = 0; < 6; i++){ for(int j = 0; j < 6; j++){ g.drawimage(theimage,i*10,j*10,null);// tens image's dimensions. if image 100x50 must i*100 , j*50 } } } }
if using jpanel, copy paint method. draw image 36(6*6) times, in form of grid. hope has helped.
note: haven't tested this, wrote directly on post. if have error of kind, reply me.
Comments
Post a Comment