本文整理汇总了Java中com.itextpdf.text.pdf.GrayColor类的典型用法代码示例。如果您正苦于以下问题:Java GrayColor类的具体用法?Java GrayColor怎么用?Java GrayColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GrayColor类属于com.itextpdf.text.pdf包,在下文中一共展示了GrayColor类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateCategoryBudgets
import com.itextpdf.text.pdf.GrayColor; //导入依赖的package包/类
private PdfPTable generateCategoryBudgets()
{
PdfPTable table = new PdfPTable(2);
table.setWidthPercentage(100);
Font font = FontFactory.getFont(FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 8, Font.NORMAL, BaseColor.BLACK);
//header cells
PdfPCell cellHeaderCategory = new PdfPCell(new Phrase(Localization.getString(Strings.TITLE_CATEGORY), font));
cellHeaderCategory.setBackgroundColor(GrayColor.LIGHT_GRAY);
cellHeaderCategory.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(cellHeaderCategory);
PdfPCell cellHeaderAmount = new PdfPCell(new Phrase(Localization.getString(Strings.TITLE_AMOUNT), font));
cellHeaderAmount.setBackgroundColor(GrayColor.LIGHT_GRAY);
cellHeaderAmount.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(cellHeaderAmount);
for(CategoryBudget budget : categoryBudgets)
{
PdfPCell cellName = new PdfPCell(new Phrase(budget.getCategory().getName(), font));
cellName.setBackgroundColor(new BaseColor(Color.WHITE));
cellName.setHorizontalAlignment(Element.ALIGN_CENTER);
cellName.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cellName);
PdfPCell cellAmount = new PdfPCell(new Phrase(Helpers.getCurrencyString(budget.getBudget() / 100.0, currency), font));
cellAmount.setBackgroundColor(new BaseColor(Color.WHITE));
cellAmount.setHorizontalAlignment(Element.ALIGN_CENTER);
cellAmount.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cellAmount);
}
return table;
}
示例2: renderText
import com.itextpdf.text.pdf.GrayColor; //导入依赖的package包/类
@Override
public void renderText(TextRenderInfo renderInfo)
{
try
{
Vector startPoint = renderInfo.getBaseline().getStartPoint();
BaseColor fillColor = renderInfo.getFillColor();
if (fillColor instanceof GrayColor && ((GrayColor)fillColor).getGray() == 0)
{
if (debug)
data.append(String.format("%4d\t%3.3f %3.3f\t%s\n", chunk, startPoint.get(I1), startPoint.get(I2), renderInfo.getText()));
for (TextRenderInfo info : renderInfo.getCharacterRenderInfos())
{
renderCharacter(info);
}
}
else
{
if (debug)
nonData.append(String.format("%4d\t%3.3f %3.3f\t%s\n", chunk, startPoint.get(I1), startPoint.get(I2), renderInfo.getText()));
if (currentField > -1)
finishEntry();
entryBuilder.append(renderInfo.getText());
}
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
chunk++;
}
}