本文整理匯總了Java中javax.print.attribute.standard.MediaSizeName.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java MediaSizeName.equals方法的具體用法?Java MediaSizeName.equals怎麽用?Java MediaSizeName.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.print.attribute.standard.MediaSizeName
的用法示例。
在下文中一共展示了MediaSizeName.equals方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isSupportedMedia
import javax.print.attribute.standard.MediaSizeName; //導入方法依賴的package包/類
private boolean isSupportedMedia(MediaSizeName msn) {
for (int i=0; i<mediaSizes.length; i++) {
if (msn.equals(mediaSizes[i])) {
return true;
}
}
return false;
}
示例2: findPaperID
import javax.print.attribute.standard.MediaSizeName; //導入方法依賴的package包/類
public int findPaperID(MediaSizeName msn) {
if (msn instanceof Win32MediaSize) {
Win32MediaSize winMedia = (Win32MediaSize)msn;
return winMedia.getDMPaper();
} else {
for (int id=0; id<dmPaperToPrintService.length;id++) {
if (dmPaperToPrintService[id].equals(msn)) {
return id+1; // DMPAPER_LETTER == 1
}
}
if (msn.equals(MediaSizeName.ISO_A2)) {
return DMPAPER_A2;
}
else if (msn.equals(MediaSizeName.ISO_A6)) {
return DMPAPER_A6;
}
else if (msn.equals(MediaSizeName.JIS_B6)) {
return DMPAPER_B6_JIS;
}
}
// If not found in predefined Windows ID, then we search through
// the returned IDs of the driver because they can define their own
// unique IDs.
initMedia();
if ((idList != null) && (mediaSizes != null) &&
(idList.size() == mediaSizes.length)) {
for (int i=0; i< idList.size(); i++) {
if (mediaSizes[i].getMediaSizeName() == msn) {
return ((Integer)idList.get(i)).intValue();
}
}
}
return 0;
}
示例3: isSupportedMedia
import javax.print.attribute.standard.MediaSizeName; //導入方法依賴的package包/類
private boolean isSupportedMedia(MediaSizeName msn) {
initMedia();
if (mediaSizeNames != null) {
for (int i=0; i<mediaSizeNames.length; i++) {
if (msn.equals(mediaSizeNames[i])) {
return true;
}
}
}
return false;
}
示例4: findPaperID
import javax.print.attribute.standard.MediaSizeName; //導入方法依賴的package包/類
public int findPaperID(MediaSizeName msn) {
if (msn instanceof Win32MediaSize) {
Win32MediaSize winMedia = (Win32MediaSize)msn;
return winMedia.getDMPaper();
} else {
for (int id=0; id<dmPaperToPrintService.length;id++) {
if (dmPaperToPrintService[id].equals(msn)) {
return id+1; // DMPAPER_LETTER == 1
}
}
if (msn.equals(MediaSizeName.ISO_A2)) {
return DMPAPER_A2;
}
else if (msn.equals(MediaSizeName.ISO_A6)) {
return DMPAPER_A6;
}
else if (msn.equals(MediaSizeName.JIS_B6)) {
return DMPAPER_B6_JIS;
}
}
// If not found in predefined Windows ID, then we search through
// the returned IDs of the driver because they can define their own
// unique IDs.
initMedia();
if ((idList != null) && (mediaSizes != null) &&
(idList.size() == mediaSizes.length)) {
for (int i=0; i< idList.size(); i++) {
if (mediaSizes[i].getMediaSizeName() == msn) {
return idList.get(i).intValue();
}
}
}
return 0;
}
示例5: isA4PaperSize
import javax.print.attribute.standard.MediaSizeName; //導入方法依賴的package包/類
private boolean isA4PaperSize() {
String timezone = System.getProperty("user.timezone");
if ((timezone != null) && (timezone.length() > 0)) {
return !System.getProperty("user.timezone").startsWith("America");
}
try {
PrintService pservice = PrintServiceLookup.lookupDefaultPrintService();
Object obj = pservice.getDefaultAttributeValue(Media.class);
if (obj instanceof MediaSizeName) {
MediaSizeName mediaSizeName = (MediaSizeName) obj;
return mediaSizeName.equals(MediaSizeName.ISO_A4);
}
} catch (Exception ex) {
LOG.info(ex.getLocalizedMessage());
}
String country = Locale.getDefault().getCountry();
if ((country.equals("US")) || (country.equals("CA"))) {
return false;
}
// default to true
return true;
}