當前位置: 首頁>>代碼示例>>Java>>正文


Java GrayColor類代碼示例

本文整理匯總了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;
}
 
開發者ID:deadlocker8,項目名稱:BudgetMaster,代碼行數:34,代碼來源:ReportGenerator.java

示例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++;
    }
}
 
開發者ID:mkl-public,項目名稱:testarea-itext5,代碼行數:35,代碼來源:CertifiedSchoolListExtractionStrategy.java


注:本文中的com.itextpdf.text.pdf.GrayColor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。