1 32 33 package it.businesslogic.ireport.gui.command; 34 35 import it.businesslogic.ireport.OperationType; 36 import java.awt.Point ; 37 38 41 public class FormatCommandCenterInBackground extends FormatCommand { 42 { 43 operationType = OperationType.CENTER_IN_BACKGROUND; 44 } 45 46 int centerx; 47 int centery; 48 49 void preparation() { 50 int insideWidth = jrf.getReport().getWidth() - jrf.getReport().getRightMargin() - jrf.getReport().getLeftMargin() ; 52 centerx = jrf.getReport().getLeftMargin() + 10+ insideWidth/2; 53 } 54 55 void modify() { 56 if (re.getBand().getName().equals("background")) 57 { 58 int centery = jrf.getReport().getBandYLocation(re.getBand()) + 10 + re.getBand().getHeight()/2 ; 59 re.setPosition(new Point (centerx-(re.getWidth()/2), centery-(re.getHeight()/2))); 60 } 61 } 62 63 } 64 | Popular Tags |