public void setPanelWmarkFrom(JPanel newPanelWmark) {	
	this.panelWmark.setSize((int)(newPanelWmark.getWidth()/this.stretchKoeffBigImage),
			(int)(newPanelWmark.getHeight()/this.stretchKoeffBigImage)) ;
	ShapeDrawComponent shapeComp=null;
	ImageComponent imageComp=null;
	Component comps[]=newPanelWmark.getComponents();	
	int fop=0;
	while((shapeComp==null || imageComp==null) && fop<comps.length )
	{	
		if(comps[fop] instanceof ShapeDrawComponent){
			shapeComp = (ShapeDrawComponent)comps[fop];			
		}
		if(comps[fop] instanceof ImageComponent){
			imageComp = (ImageComponent)comps[fop];			
		}		
		fop++;		
	}
	this.setShapeWmarkFrom(shapeComp);
	this.setImageWmarkFrom(imageComp);
	
	/*truncating the panel as small as possible*/
	int leftSpare=Math.min(this.imageWmark.getX(),this.shapeWmark.getX());
	int widthRequed=Math.max(this.imageWmark.getX()+this.imageWmark.getWidth(),this.shapeWmark.getX()+this.shapeWmark.getWidth());
	int topSpare=Math.min(this.imageWmark.getY(),this.shapeWmark.getY());
	int heightRequed=Math.max(this.imageWmark.getY()+this.imageWmark.getHeight(),this.shapeWmark.getY()+this.shapeWmark.getHeight());
	widthRequed-=leftSpare;
	heightRequed-=topSpare;
	this.imageWmark.setLocation(this.imageWmark.getX()-leftSpare ,this.imageWmark.getY()-topSpare);
	this.shapeWmark.setLocation(this.shapeWmark.getX()-leftSpare ,this.shapeWmark.getY()-topSpare);
	this.panelWmark.setSize(widthRequed, heightRequed);	 
	
	/*Cjatie watermarki*/
	
	
//	System.out.println("stratchFactor is set to "+stratchWaterMarkFactor);
	
	
	this.panelWmark.setSize(	
			(int)(this.panelWmark.getWidth()*stratchWaterMarkFactor),
			(int)(this.panelWmark.getHeight()*stratchWaterMarkFactor)
			);
	
	this.imageWmark.setSize(	
			(int)(this.imageWmark.getWidth()*stratchWaterMarkFactor),
			(int)(this.imageWmark.getHeight()*stratchWaterMarkFactor)
			);	
	
  	this.imageWmark.setAppearanceImg(
  			ImageManager.resizeImage( (BufferedImage)this.imageWmark.getAppearanceImg(),
  						(int)(this.imageWmark.getAppearanceImg().getWidth(null)*stratchWaterMarkFactor),
  						(int)(this.imageWmark.getAppearanceImg().getHeight(null)*stratchWaterMarkFactor) 
  					)
  			);
  	
	this.imageWmark.setLocation(	
			(int)(this.imageWmark.getX() *stratchWaterMarkFactor),
			(int)(this.imageWmark.getY()*stratchWaterMarkFactor)
			);
	
	this.shapeWmark.setSize(	
			(int)(this.shapeWmark.getWidth()*stratchWaterMarkFactor),
			(int)(this.shapeWmark.getHeight()*stratchWaterMarkFactor)
			);
	this.shapeWmark.getShape().setFrame (	shapeWmark.getShape().getX(),
			shapeWmark.getShape().getY(),
			(int)(this.shapeWmark.getShape().getWidth()*stratchWaterMarkFactor),
			(int)(this.shapeWmark.getShape().getHeight()*stratchWaterMarkFactor)
			);
	
	this.shapeWmark.setLocation(	
			(int)(this.shapeWmark.getX() *stratchWaterMarkFactor),
			(int)(this.shapeWmark.getY()*stratchWaterMarkFactor)
			);
	
	//limitXBigImageSizeForWMResize
//	System.out.println("isCompressXDistanceFromLeft "+WaterMarkModel.isCompressXDistanceFromLeft());
//	System.out.println("isCompressYDistanceFromTop "+WaterMarkModel.isCompressYDistanceFromTop());
//	
//	System.out.println("WaterMarkModel.getCompressXDistance() "+WaterMarkModel.getCompressXDistance());
//	System.out.println("WaterMarkModel.getCompressYDistance() "+WaterMarkModel.getCompressYDistance());
//	
//	
	
	
	
	int left=0,top=0;
	if(WaterMarkModel.isCompressXDistanceFromLeft()){
		left=(int)(WaterMarkModel.getCompressXDistance()*panelFullscreenView.getWidth());				
	}else{
		left=panelFullscreenView.getWidth()-panelWmark.getWidth()-(int)(WaterMarkModel.getCompressXDistance()*panelFullscreenView.getWidth());	
	}
	
	if(WaterMarkModel.isCompressYDistanceFromTop()){
		top=(int)(WaterMarkModel.getCompressYDistance()*panelFullscreenView.getHeight());				
	}else{
		top=panelFullscreenView.getHeight()-panelWmark.getHeight()-(int)(WaterMarkModel.getCompressYDistance()*panelFullscreenView.getHeight());	
	}
	/*Point centerOfpanelWmark= new Point(0,0);	
	centerOfpanelWmark.x=(int) (WaterMarkModel.getCompressXDistance()*this.panelFullscreenView.getWidth());
	centerOfpanelWmark.y=(int) (WaterMarkModel.getCompressYDistance()*this.panelFullscreenView.getHeight());
	
	int left = centerOfpanelWmark.x-this.panelWmark.getWidth()/2;
	int top = centerOfpanelWmark.y-this.panelWmark.getHeight()/2;	
	*/

//	System.out.println("widthRequed, heightRequed "+widthRequed+" "+heightRequed );
//	System.out.println("panelFullscreenView.getWidth() "+panelFullscreenView.getWidth());
//	System.out.println("panelWmark.getWidth() "+panelWmark.getWidth());
//	System.out.println("left "+left);
//	System.out.println("top "+top);
	
//	this.setPanelWmarkLocation(left,top);
	this.panelWmark.setLocation(left,top);
	labelWMCoorsRefresh();
}