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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -