home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / awt / Win32GraphicsEnvironment.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  3.9 KB  |  163 lines

  1. package sun.awt;
  2.  
  3. import java.awt.GraphicsDevice;
  4. import java.awt.print.PrinterJob;
  5. import java.io.File;
  6. import java.util.NoSuchElementException;
  7. import java.util.StringTokenizer;
  8. import sun.awt.windows.WFontConfiguration;
  9. import sun.awt.windows.WPrinterJob;
  10. import sun.awt.windows.WToolkit;
  11. import sun.font.FontManager;
  12. import sun.java2d.SunGraphicsEnvironment;
  13. import sun.java2d.windows.WindowsFlags;
  14.  
  15. public class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
  16.    private static boolean displayInitialized;
  17.    static String fontsForPrinting;
  18.  
  19.    public static void init() {
  20.    }
  21.  
  22.    private static native void initDisplay();
  23.  
  24.    public static void initDisplayWrapper() {
  25.       if (!displayInitialized) {
  26.          displayInitialized = true;
  27.          initDisplay();
  28.       }
  29.  
  30.    }
  31.  
  32.    protected native int getNumScreens();
  33.  
  34.    protected native int getDefaultScreen();
  35.  
  36.    public GraphicsDevice getDefaultScreenDevice() {
  37.       return this.getScreenDevices()[this.getDefaultScreen()];
  38.    }
  39.  
  40.    public native int getXResolution();
  41.  
  42.    public native int getYResolution();
  43.  
  44.    public void displayChanged() {
  45.       WToolkit.resetGC();
  46.       super.displayChanged();
  47.    }
  48.  
  49.    private static native String getEUDCFontFile();
  50.  
  51.    protected boolean useAbsoluteFontFileNames() {
  52.       return false;
  53.    }
  54.  
  55.    protected void registerFontFile(String var1, String[] var2, int var3, boolean var4) {
  56.       if (!this.registeredFontFiles.contains(var1)) {
  57.          this.registeredFontFiles.add(var1);
  58.          byte var5;
  59.          if (ttFilter.accept((File)null, var1)) {
  60.             var5 = 0;
  61.          } else {
  62.             if (!t1Filter.accept((File)null, var1)) {
  63.                return;
  64.             }
  65.  
  66.             var5 = 1;
  67.          }
  68.  
  69.          if (this.fontPath == null) {
  70.             this.fontPath = this.getPlatformFontPath(noType1Font);
  71.          }
  72.  
  73.          String var6 = jreFontDirName + File.pathSeparator + this.fontPath;
  74.          StringTokenizer var7 = new StringTokenizer(var6, File.pathSeparator);
  75.          boolean var8 = false;
  76.  
  77.          try {
  78.             while(!var8 && var7.hasMoreTokens()) {
  79.                String var9 = var7.nextToken();
  80.                File var10 = new File(var9, var1);
  81.                if (var10.canRead()) {
  82.                   var8 = true;
  83.                   String var11 = var10.getAbsolutePath();
  84.                   if (var4) {
  85.                      FontManager.registerDeferredFont(var1, var11, var2, var5, true, var3);
  86.                   } else {
  87.                      FontManager.registerFontFile(var11, var2, var5, true, var3);
  88.                   }
  89.                   break;
  90.                }
  91.             }
  92.          } catch (NoSuchElementException var12) {
  93.             System.err.println(var12);
  94.          }
  95.  
  96.          if (!var8) {
  97.             this.addToMissingFontFileList(var1);
  98.          }
  99.  
  100.       }
  101.    }
  102.  
  103.    protected void registerJREFontsWithPlatform(String var1) {
  104.       fontsForPrinting = var1;
  105.    }
  106.  
  107.    public static void registerJREFontsForPrinting() {
  108.       Object var0 = null;
  109.       String var6;
  110.       synchronized(Win32GraphicsEnvironment.class) {
  111.          if (fontsForPrinting == null) {
  112.             return;
  113.          }
  114.  
  115.          var6 = fontsForPrinting;
  116.          fontsForPrinting = null;
  117.       }
  118.  
  119.       File var7 = new File(var6);
  120.       String[] var2 = var7.list(new SunGraphicsEnvironment.TTFilter());
  121.       if (var2 != null) {
  122.          for(int var3 = 0; var3 < var2.length; ++var3) {
  123.             File var4 = new File(var7, var2[var3]);
  124.             registerFontWithPlatform(var4.getAbsolutePath());
  125.          }
  126.  
  127.       }
  128.    }
  129.  
  130.    protected static native void registerFontWithPlatform(String var0);
  131.  
  132.    protected static native void deRegisterFontWithPlatform(String var0);
  133.  
  134.    protected GraphicsDevice makeScreenDevice(int var1) {
  135.       return new Win32GraphicsDevice(var1);
  136.    }
  137.  
  138.    public PrinterJob getPrinterJob() {
  139.       SecurityManager var1 = System.getSecurityManager();
  140.       if (var1 != null) {
  141.          var1.checkPrintJobAccess();
  142.       }
  143.  
  144.       return new WPrinterJob();
  145.    }
  146.  
  147.    protected FontConfiguration createFontConfiguration() {
  148.       return new WFontConfiguration(this);
  149.    }
  150.  
  151.    public FontConfiguration createFontConfiguration(boolean var1, boolean var2) {
  152.       return new WFontConfiguration(this, var1, var2);
  153.    }
  154.  
  155.    static {
  156.       WToolkit.loadLibraries();
  157.       WindowsFlags.initFlags();
  158.       initDisplayWrapper();
  159.       eudcFontFileName = getEUDCFontFile();
  160.       fontsForPrinting = null;
  161.    }
  162. }
  163.