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


Java Font.setStyle方法代碼示例

本文整理匯總了Java中com.lowagie.text.Font.setStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java Font.setStyle方法的具體用法?Java Font.setStyle怎麽用?Java Font.setStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.lowagie.text.Font的用法示例。


在下文中一共展示了Font.setStyle方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createFont

import com.lowagie.text.Font; //導入方法依賴的package包/類
private Font createFont( int fontType )
{
    Font font = new Font();
    font.setFamily( FONTFAMILY );

    switch ( fontType )
    {
    case FONTTYPE_BODY:
        font.setSize( FONTSIZE_BODY );
        font.setColor( Color.BLACK );
        break;
    case FONTTYPE_TITLE:
        font.setSize( FONTSIZE_TITLE );
        font.setStyle( java.awt.Font.BOLD );
        font.setColor( new Color( 0, 0, 128 ) ); // Navy Color
        break;
    case FONTTYPE_DESCRIPTION:
        font.setSize( FONTSIZE_DESCRIPTION );
        font.setColor( Color.DARK_GRAY );
        break;
    case FONTTYPE_SECTIONHEADER:
        font.setSize( FONTSIZE_SECTIONHEADER );
        font.setStyle( java.awt.Font.BOLD );
        font.setColor( new Color( 70, 130, 180 ) ); // Steel Blue Color
        break;
    case FONTTYPE_FOOTER:
        font.setSize( FONTSIZE_FOOTER );
        break;
    default:
        font.setSize( FONTSIZE_BODY );
        break;
    }

    return font;
}
 
開發者ID:dhis2,項目名稱:dhis2-core,代碼行數:36,代碼來源:PdfFormFontSettings.java

示例2: getFont

import com.lowagie.text.Font; //導入方法依賴的package包/類
public static Font getFont(boolean bold, boolean italic, boolean underline, Color color) {
	Font font = getFont(bold, italic);
	if (underline) font.setStyle(font.getStyle() + Font.UNDERLINE);
	if (color != null) font.setColor(color);
	return font;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:7,代碼來源:PdfFont.java

示例3: getSmallFont

import com.lowagie.text.Font; //導入方法依賴的package包/類
public static Font getSmallFont(boolean bold, boolean italic, boolean underline, Color color) {
	Font font = getSmallFont(bold, italic);
	if (underline) font.setStyle(font.getStyle() + Font.UNDERLINE);
	if (color != null) font.setColor(color);
	return font;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:7,代碼來源:PdfFont.java

示例4: getDescription

import com.lowagie.text.Font; //導入方法依賴的package包/類
/**
 * This message creates the description element at the beginning of the exported document.
 *
 * @param queryInstance
 *            The query instance to extract needed data from.
 * @param user
 *            The user.
 * @param fullDateFormatter
 *            Formatter for full dates.
 * @param dateFormatter
 *            Formatter for short dates.r.
 * @param resourcesManager
 *            The resources manager to retrieve resources from.
 * @return An object to be used as a description.
 * @throws NoteNotFoundException
 *             Exception.
 * @throws AuthorizationException
 *             Exception.
 */
private Element getDescription(NoteQueryParameters queryInstance, User user,
        DateFormat dateFormatter, DateFormat fullDateFormatter,
        ResourceBundleManager resourcesManager) throws NoteNotFoundException,
        AuthorizationException {
    Collection<Object> elements = new ArrayList<Object>();
    Font boldFont = new Font();
    boldFont.setStyle(Font.BOLD);
    elements.add(RtfElementFactory.createChunk("\n"));
    Locale locale = user.getLanguageLocale();
    elements.add(RtfElementFactory.createChunk(
            resourcesManager.getText("export.postlist.filter.header", locale), boldFont));
    elements.add(RtfElementFactory.createChunk("\n"));
    elements.add(getFilters(queryInstance, user, dateFormatter, resourcesManager));
    return RtfElementFactory.createPhrase(elements);
}
 
開發者ID:Communote,項目名稱:communote-server,代碼行數:35,代碼來源:RtfNoteWriter.java

示例5: getFilters

import com.lowagie.text.Font; //導入方法依賴的package包/類
/**
 * This method returns the current filter settings as an unordered list.
 *
 * @param queryParameters
 *            The query instance with filter settings.
 * @param resourcesManager
 *            The {@link ResourceBundleManager}.
 * @param user
 *            The user.
 * @param dateFormatter
 *            Date formater.
 * @throws NoteNotFoundException
 *             NoteNotFoundException
 * @throws AuthorizationException
 *             Exception.
 * @return Filters as {@link List}.
 */
private Element getFilters(NoteQueryParameters queryParameters, User user,
        DateFormat dateFormatter, ResourceBundleManager resourcesManager)
                throws NoteNotFoundException, AuthorizationException {

    List filters = new List(List.UNORDERED);
    filters.setIndentationLeft(20);
    if (queryParameters.getNoteId() != null) {
        filters.add(RtfElementFactory.createListItem(resourcesManager.getText(
                "export.postlist.filter.single.post", user.getLanguageLocale())));
        return filters;
    }

    handleFollowFavoriteDirectOnly(queryParameters, user.getLanguageLocale(), resourcesManager,
            filters);
    TaggingCoreItemUTPExtension utpExt = queryParameters.getTypeSpecificExtension();
    handleUsersFilter(resourcesManager, user.getLanguageLocale(), filters,
            queryParameters.getUserToBeNotified());
    handleParentPostFilter(resourcesManager, dateFormatter, user.getLanguageLocale(), filters,
            utpExt);
    handleDatesFilter(queryParameters, user.getLanguageLocale(), dateFormatter,
            resourcesManager, filters);
    handleBlogFilter(resourcesManager, user.getLanguageLocale(), filters, utpExt);
    handleDiscussionFilter(resourcesManager, user.getLanguageLocale(), dateFormatter,
            queryParameters.getDiscussionId(), filters);

    if (queryParameters.getUserIds() != null) {
        final Collection<String> authorList = new ArrayList<String>();
        for (Long id : queryParameters.getUserIds()) {
            ServiceLocator.instance().getService(UserManagement.class)
            .getUserById(id, new Converter<User, Object>() {
                @Override
                public Object convert(User source) {
                    authorList.add(UserNameHelper.getDetailedUserSignature(source));
                    return null;
                }
            });
        }
        filters.add(RtfElementFactory.createListItem(resourcesManager.getText(
                "export.postlist.filter.authors", user.getLanguageLocale(),
                StringUtils.join(authorList, ", "))));
    }

    handleTagsFilter(queryParameters.getLogicalTags(), queryParameters.getTagIds(),
            user.getLanguageLocale(), resourcesManager, filters);
    handleUserSearchFilter(queryParameters.getUserSearchFilters(), user.getLanguageLocale(),
            resourcesManager, filters);

    if (queryParameters.getFullTextSearchFilters() != null) {
        filters.add(RtfElementFactory.createListItem(resourcesManager.getText(
                "export.postlist.filter.text", user.getLanguageLocale(),
                StringUtils.join(queryParameters.getFullTextSearchFilters(), " "))));
    }
    if (filters.size() == 0) {
        Font italic = new Font();
        italic.setSize(10);
        italic.setStyle(Font.ITALIC);
        Element empty = RtfElementFactory.createListItem(
                resourcesManager.getText("export.postlist.filter.none",
                        user.getLanguageLocale()), italic);
        filters.add(empty);
    }
    return filters;
}
 
開發者ID:Communote,項目名稱:communote-server,代碼行數:81,代碼來源:RtfNoteWriter.java

示例6: setFontStyle

import com.lowagie.text.Font; //導入方法依賴的package包/類
/** 
 * 功能說明:設置字體的樣式</BR> 
 * 修改日期:2011-04-27 
 * @author myclover 
 * @param family  字體類型 
 * @param color   字體顏色 
 * @param size    字體大小,22f為二號,18f為小二號,16f為三號 
 * @param style   字體樣式 
 * @return 
 */  
public static Font setFontStyle(String family , Color color , float size , int style){  
    Font font = new Font();  
    font.setFamily(family);  
    font.setColor(color);  
    font.setSize(size);  
    font.setStyle(style);  
    return font;  
}
 
開發者ID:wkeyuan,項目名稱:DWSurvey,代碼行數:19,代碼來源:DocStyleUtils.java


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