drawing - Draw a line in JAVA with Pattern - Beginner -


i want draw line in java. use these draws making triangles. can :

1*** 11** 111* 1111 

and need this:

1*** *1** **1* ***1 

ive done lot of work today , mind got confused.

can me ? lot.

edit: perfect answer should implement bresenham’s line drawing algorithm dont understand in wikipedia.

edit 2: grid code :

string [][] matrix = new string [50][50]; (int row = 0; row < 50; row++){   (int column = 0; column < 50; column++){     matrix [row][column] = "*";   } } 

public class test {      public static void main(string [] args)      {           int size=50;           string[][] matrix= new string [size][size];            (int i=0; < size; i++)           {               (int j=0; j < size; j++)               {                if (i != j)                matrix[i][j]="*";                 else                matrix[i][j]="1";               }          }           (int i=0; < size; i++)          {              (int j=0; j < size; j++)              {               system.out.print(matrix[i][j]);              }                    system.out.println();          }       } } 

edit: if it's filled * make matrix[i][j]="1"; when equals j, ie if (i==j).


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -