how to group graphic object
===

how to turn several graphics objects in to one?
(this part of code should generate tetris figure, where generate() create a figure)

    public void paint(Graphics g){
    		Figure f = generate();
    		int length = f.getX()[0].length;
    		for(int j =0; j<f.getX().length;j++){
    			
    			int xr=xs+10;
    			ys = 0;					
    			for(int i=0;i<length;i++){						
    				
    				if (f.getX()[j][i] == 1){
    					int yr = ys+10;
    					Rectangle p = new Rectangle(xs,ys,xr,yr);
    					g.setColor(f.getY());
    					g.drawRect(p.x, p.y, p.width, p.height);	
    					g.fillRect(p.x, p.y, p.width, p.height);	
    					//g.translate(xs+40, ys+40);
    				}
    				ys+=10;
    				
    			}
    			xs+=10;
    		}
    		xs=0;
    		ys=0;
    				
    						
    	   //g.setColor(Color.white);
           //g.drawRect(45, 95, 55, 105);
            
        }