![]() |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Jun 2008
Posts: 1
|
g.setColor (Color.red);
g.drawRect (10, 20, 100, 15); g.setColor (Color.pink); g.fillRect (240, 160, 40, 110); thats the rectangle made...in java and i have a grid made with numbers from 1-50.. setLayout (new GridLayout (5, 5)); int m = 51; for (int i = 0 ; i < 5 ; i++) { for (int j = 0 ; j < 10 ; j++) { m--; add (new Label ("" + m)); and my problem is that i want to move the rectangle i made on the number...i can add and subtract myself...but the box just goes anywher, can anyone help me how to make array, with value of i and j...so it can be something like array [i][j] and then i can move the box with it...like box.position=array[i][j]...so i can add and subtract from array, and and move box on the number.. thanks a lot anyone who helps.. i need it badly
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|