import [Link].*; import [Link].*; import [Link].
*; class DrawingPanelTest2{ public static void main(String[] args) { Scanner input = new Scanner([Link]); double pw = [Link](); myPan panel = new myPan(pw); JFrame application = new JFrame(); [Link](JFrame.EXIT_ON_CLOSE); [Link](panel); [Link](400, 400); [Link](true); } } class myPan extends JPanel{ public double pow; public tri play[]; public background back; public myPan(double p){ pow = p; back = new background(p); play = new tri[10]; //this is where you create all of your triominoes //you can do it a different way, but this is an //example } public void paintComponent(Graphics g){ [Link](g); [Link](g); for(int i = 0; i < [Link]; i++){ //paint all of the triominos play[i].paintTri(g); } } } class background{ public double pow; public boolean filled[][]; public background(double p){ pow = p; filled = new boolean[up][across]; //this is if it is filled with a tri //you'll need to figure out a way to set //the filled ones to "true" } public paintBackground(Graphics g){ public void paintComponent(Graphics g){
[Link](g); double num = [Link](2,pow); double across; double up; if(pow % 2 == 0){ //is a square across = [Link](num,0.5); up = across; } else{ double x = [Link](pow/2); double y = x + 1; across = [Link](2,x); up = [Link](2,y); } [Link](across); [Link](up); // // double wid = 400/across; //width of one double hi = 400/up; //height of one double nowX = 0; double nowY = 0; for(int i = 0; i < up; i++){ //top to bottom nowX = 0; for(int j = 0; j < across; j++){ [Link]([Link]); [Link]((int)nowX, (int)nowY, (int)wid, (int)hi); if(...the square is OK...){ //<--you'll need a way to check this using the "filled" array [Link]([Link]); [Link]((int)nowX, (int)nowY, (int)wid, (int)hi); } else{//the square is not ok [Link]([Link]); [Link]((int)nowX, (int)nowY, (int)wid, (int)hi); } nowX = nowX + wid; } nowY = nowY + hi; } } } } class tri{ public tri(int x, int y, int width, int height){ //initialize all of your values } public paintTri(Graphics g){
[Link](g); //draw it here } }