title: Set border of a jasper subreport having a title and a detail band
body: <p>I am working on a grails project that use jasper plugin for downloading a document in pdf and doc format.</p>
  
  <p>I have several jasper subreports and using these subreports in dynamic jasper to download the document in pdf and docx format. I am using dynamic jasper report because the positions of jasper subreport may vary. </p>
  
  <p>My jasper sub report have a title and a detail band.</p>
  
  <p><img src="https://i.stack.imgur.com/OzCAw.png" alt="enter image description here"></p>
  
  <p>output is </p>
  
  <p><img src="https://i.stack.imgur.com/DFkrV.png" alt="enter image description here"></p>
  
  <p>Now my problem is a border. A border is required like:</p>
  
  <p><img src="https://i.stack.imgur.com/Ip77b.png" alt="enter image description here"></p>
  
  <p>I tried to set rectangle, frame but all failed because two bands did not share one palate(component).</p>
  
  <p><strong>My requirement is a border via jasper report or via dynamic jasper.</strong> I have no idea how to set the border. </p>
  
  <p><strong>EDIT........................................................................</strong></p>
  
  <p>I also tried to set the border using a frame and rectangle via dynamic jasper code and the output is:</p>
  
  <p><img src="https://i.stack.imgur.com/yhjsH.png" alt="enter image description here"></p>
  
  <p>frame and rectangle not covering whole subreport. Here is my code:</p>
  
  <pre><code>JRDesignRectangle rectangle = new JRDesignRectangle();
  //JRDesignFrame rectangle = new JRDesignFrame();
  rectangle.setX(subReport.getX());
  rectangle.setY(subReport.getY());
  rectangle.setHeight(subReport.getHeight());
  rectangle.setWidth(subReport.getWidth());
  rectangle.setPositionType(PositionTypeEnum.FLOAT);
  band.addElement(rectangle);
  </code></pre>