⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialogclassloader.java

📁 Java游戏高级编程!!很不错的!!!Java游戏高级编程!!很不错的
💻 JAVA
字号:
     package com.croftsoft.core.lang.classloader;

     import java.awt.*;
     import java.io.*;

     /*********************************************************************
     * <P>
     * @version
     *   1998-06-03
     * @author
     *   <A HREF="http://www.alumni.caltech.edu/~croft/">David W. Croft</A>
     *********************************************************************/

     public class  DialogClassLoader
     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     {

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////

     /*********************************************************************
     * Loads a remote class and launches its main() method.
     *
     * @param
     *   Command-line arguments:
     *   <OL>
     *   <LI> The URL name for the codebase.
     *   <LI> The name of the class with the "main(args)" method.
     *   <LI> The name of the local persistent resource cache directory.
     *   <LI> Subsequent arguments to be passed to the invoked main method.
     *   </OL>
     *   Example
     *********************************************************************/
     public static void  main ( String [ ]  args )
       throws Exception
     //////////////////////////////////////////////////////////////////////
     {
       if ( args.length >= 3 )
       {
         CacheClassLoader.main ( args );
         return;
       }

       ( new DialogClassLoader ( ) ).start ( );
     }

     public  DialogClassLoader ( )
     //////////////////////////////////////////////////////////////////////
     {
     }

     public void  start ( )
     //////////////////////////////////////////////////////////////////////
     {
       System.out.println ( System.getProperty ( "java.class.path" ) );

// Run the user's classpath searching for "mayhem.class".
// When you find it, assume that that is the cache path.
// Look for a settings file in that directory.
// If there is no settings file in that directory, assume defaults and prompt.

//     System.out.println ( System.getProperty ( "user.home" ) );

       File  file0 = new File ( "." );
       try
       {
         System.out.println ( file0.getCanonicalPath ( ) );
       }
       catch ( Exception  ex ) { }

       Frame  frame = new Frame ( "Mystic Mayhem Installation" );
       FileDialog  fileDialog = new FileDialog (
         frame, "Mystic Mayhem - please choose the installation directory",
         FileDialog.SAVE );
       fileDialog.setFile ( "mayhem" );
       frame.setBounds ( 0, 0, 300, 300 );
       fileDialog.show ( );
       frame.show ( );
       // don't forget to dispose of both
       File  file = new File ( fileDialog.getDirectory ( )
         + File.separator + fileDialog.getFile ( ) );

       try
       {
         System.out.println ( file.getCanonicalPath ( ) );
       }
       catch ( Exception  ex ) { }

       fileDialog.dispose ( );
       frame.dispose ( );
     }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -