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


Java MediaSizeName.equals方法代碼示例

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

示例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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:37,代碼來源:Win32PrintService.java

示例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;
    }
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:14,代碼來源:Win32PrintService.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:37,代碼來源:Win32PrintService.java

示例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;
  }
 
開發者ID:rquast,項目名稱:swingsane,代碼行數:28,代碼來源:PreferredDefaultsImpl.java


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