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


Java MediaSizeName.NA_LETTER屬性代碼示例

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


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

示例1: assignMediaSize

private MediaSizeName assignMediaSize(String size) {
    MediaSizeAssigner mediaSizeAssigner = new MediaSizeAssigner();

    MediaSizeName answer;

    if (size == null) {
        // default to NA letter if no size configured
        answer = MediaSizeName.NA_LETTER;
    } else if (size.toLowerCase().startsWith("iso")) {
        answer = mediaSizeAssigner.selectMediaSizeNameISO(size);
    } else if (size.startsWith("jis")) {
        answer = mediaSizeAssigner.selectMediaSizeNameJIS(size);
    } else if (size.startsWith("na")) {
        answer = mediaSizeAssigner.selectMediaSizeNameNA(size);
    } else {
        answer = mediaSizeAssigner.selectMediaSizeNameOther(size);
    }

    return answer;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:20,代碼來源:PrinterConfiguration.java

示例2: createPaperTypeCombo

private void createPaperTypeCombo(PrintRequestAttributeSet set) {
	Media[] possible = (Media[]) mService.getSupportedAttributeValues(Media.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
	if (possible != null && possible.length > 0) {
		Media current = (Media) PrintUtilities.getSetting(mService, set, Media.class, true);
		if (current == null) {
			current = MediaSizeName.NA_LETTER;
		}
		ArrayList<WrappedMediaSizeName> types = new ArrayList<>();
		int selection = 0;
		int index = 0;
		for (Media one : possible) {
			if (one instanceof MediaSizeName) {
				MediaSizeName name = (MediaSizeName) one;
				types.add(new WrappedMediaSizeName(cleanUpMediaSizeName(name), name));
				if (name == current) {
					selection = index;
				}
				index++;
			}
		}
		mPaperType = new JComboBox<>(types.toArray(new WrappedMediaSizeName[0]));
		mPaperType.setSelectedIndex(selection);
		UIUtilities.setOnlySize(mPaperType, mPaperType.getPreferredSize());
		LinkedLabel label = new LinkedLabel(PAPER_TYPE, mPaperType);
		add(label, new PrecisionLayoutData().setEndHorizontalAlignment());
		add(mPaperType);
	} else {
		mPaperType = null;
	}
}
 
開發者ID:Ayutac,項目名稱:toolkit,代碼行數:30,代碼來源:PageSetupPanel.java

示例3: getDefaultAttributeValue

@Override
public Object getDefaultAttributeValue(Class<? extends Attribute> category) {
	if (category == Media.class) {
		return MediaSizeName.NA_LETTER;
	}
	if (category == OrientationRequested.class) {
		return OrientationRequested.PORTRAIT;
	}
	return null;
}
 
開發者ID:Ayutac,項目名稱:toolkit,代碼行數:10,代碼來源:DummyPrintService.java

示例4: getSupportedAttributeValues

@Override
public Object getSupportedAttributeValues(Class<? extends Attribute> category, DocFlavor flavor, AttributeSet attributes) {
	if (category == Media.class) {
		return new Media[] { MediaSizeName.NA_LETTER, MediaSizeName.NA_LEGAL, MediaSizeName.ISO_A4 };
	}
	if (category == OrientationRequested.class) {
		return new OrientationRequested[] { OrientationRequested.PORTRAIT, OrientationRequested.LANDSCAPE };
	}
	return null;
}
 
開發者ID:Ayutac,項目名稱:toolkit,代碼行數:10,代碼來源:DummyPrintService.java

示例5: setPaperSize

/**
 * Sets the paper size.
 *
 * @param service The {@link PrintService} to use.
 * @param set The {@link PrintRequestAttributeSet} to use.
 * @param size The size of the paper.
 * @param units The type of units being used.
 */
public static void setPaperSize(PrintService service, PrintRequestAttributeSet set, double[] size, LengthUnits units) {
	double[] margins = getPaperMargins(service, set, units);
	MediaSizeName mediaSizeName = MediaSize.findMedia((float) LengthUnits.IN.convert(units, size[0]), (float) LengthUnits.IN.convert(units, size[1]), Size2DSyntax.INCH);

	if (mediaSizeName == null) {
		mediaSizeName = MediaSizeName.NA_LETTER;
	}
	set.add(mediaSizeName);
	setPaperMargins(service, set, margins, units);
}
 
開發者ID:Ayutac,項目名稱:toolkit,代碼行數:18,代碼來源:PrintUtilities.java

示例6: selectMediaSizeNameNA

public MediaSizeName selectMediaSizeNameNA(String size) {
    if (size.equalsIgnoreCase("na_letter")) {
        mediaSizeName = MediaSizeName.NA_LETTER;
    } else if (size.equalsIgnoreCase("na_legal")) {
        mediaSizeName = MediaSizeName.NA_LEGAL;
    } else if (size.equalsIgnoreCase("executive")) {
        mediaSizeName = MediaSizeName.EXECUTIVE;
    } else if (size.equalsIgnoreCase("ledger")) {
        mediaSizeName = MediaSizeName.LEDGER;
    } else if (size.equalsIgnoreCase("tabloid")) {
        mediaSizeName = MediaSizeName.TABLOID;
    } else if (size.equalsIgnoreCase("invoice")) {
        mediaSizeName = MediaSizeName.INVOICE;
    } else if (size.equalsIgnoreCase("folio")) {
        mediaSizeName = MediaSizeName.FOLIO;
    } else if (size.equalsIgnoreCase("quarto")) {
        mediaSizeName = MediaSizeName.QUARTO;
    } else if (size.equalsIgnoreCase("japanese_postcard")) {
        mediaSizeName = MediaSizeName.JAPANESE_POSTCARD;
    } else if (size.equalsIgnoreCase("oufuko_postcard")) {
        mediaSizeName = MediaSizeName.JAPANESE_DOUBLE_POSTCARD;
    } else if (size.equalsIgnoreCase("a")) {
        mediaSizeName = MediaSizeName.A;
    } else if (size.equalsIgnoreCase("b")) {
        mediaSizeName = MediaSizeName.B;
    } else if (size.equalsIgnoreCase("c")) {
        mediaSizeName = MediaSizeName.C;
    } else if (size.equalsIgnoreCase("d")) {
        mediaSizeName = MediaSizeName.D;
    } else if (size.equalsIgnoreCase("e")) {
        mediaSizeName = MediaSizeName.E;
    } else if (size.equalsIgnoreCase("iso_designated_long")) {
        mediaSizeName = MediaSizeName.ISO_DESIGNATED_LONG;
    } else if (size.equalsIgnoreCase("italian_envelope")) {
        mediaSizeName = MediaSizeName.ITALY_ENVELOPE;
    } else if (size.equalsIgnoreCase("monarch_envelope")) {
        mediaSizeName = MediaSizeName.MONARCH_ENVELOPE;
    } else if (size.equalsIgnoreCase("personal_envelope")) {
        mediaSizeName = MediaSizeName.PERSONAL_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_number_9_envelope")) {
        mediaSizeName = MediaSizeName.NA_NUMBER_9_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_number_10_envelope")) {
        mediaSizeName = MediaSizeName.NA_NUMBER_10_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_number_11_envelope")) {
        mediaSizeName = MediaSizeName.NA_NUMBER_11_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_number_12_envelope")) {
        mediaSizeName = MediaSizeName.NA_NUMBER_12_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_number_14_envelope")) {
        mediaSizeName = MediaSizeName.NA_NUMBER_14_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_6x9_envelope")) {
        mediaSizeName = MediaSizeName.NA_6X9_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_7x9_envelope")) {
        mediaSizeName = MediaSizeName.NA_7X9_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_9x11_envelope")) {
        mediaSizeName = MediaSizeName.NA_9X11_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_9x12_envelope")) {
        mediaSizeName = MediaSizeName.NA_9X12_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_10x13_envelope")) {
        mediaSizeName = MediaSizeName.NA_10X13_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_10x14_envelope")) {
        mediaSizeName = MediaSizeName.NA_10X14_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_10x15_envelope")) {
        mediaSizeName = MediaSizeName.NA_10X15_ENVELOPE;
    } else if (size.equalsIgnoreCase("na_5x7")) {
        mediaSizeName = MediaSizeName.NA_5X7;
    } else if (size.equalsIgnoreCase("na_8x10")) {
        mediaSizeName = MediaSizeName.NA_8X10;
    } else {
        mediaSizeName = MediaSizeName.NA_LETTER;
    }
    
    return mediaSizeName;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:73,代碼來源:MediaSizeAssigner.java


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