Class LaunchClassChooser

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class LaunchClassChooser extends JDialog
This modal dialog lets the user choose launchable classes from jar files.
See Also:
  • Field Details

    • jarsOnly

      protected static boolean jarsOnly
    • baseDirectoryPath

      protected static String baseDirectoryPath
  • Constructor Details

    • LaunchClassChooser

      public LaunchClassChooser(Component owner)
      Constructs an empty LaunchClassChooser dialog.
      Parameters:
      owner - the component that owns the dialog (may be null)
  • Method Details

    • setPath

      public boolean setPath(String path)
      Sets the path to be searched. The path must be a set of jar file names separated by semicolons unless jarsOnly is set to false.
      Parameters:
      path - the search path
      Returns:
      true if at least one jar file was successfully loaded
    • isLoaded

      public boolean isLoaded(String path)
      Determines if the specified path is loaded. This will return true only if the path is one or more jar files all of which are loaded.
      Parameters:
      path - the path
      Returns:
      true if all jars in the path are loaded
    • chooseClassFor

      public boolean chooseClassFor(LaunchNode node)
      Chooses a launchable class and assigns it to the specified launch node.
      Parameters:
      node - the node
      Returns:
      true if the class assignment is approved
    • chooseModel

      public Class<?> chooseModel(String previousClassName)
      Chooses and returns a model class.
      Parameters:
      previousClassName - the previous class name. May be null.
      Returns:
      the newly selected class. May return null.
    • getClass

      public Class<?> getClass(String className)
      Gets the class with the given name in the current class map.
      Parameters:
      className - the class name
      Returns:
      the Class object, or null if not found
    • setBasePath

      public static void setBasePath(String path)
      Sets the base directory for classpaths.
      Parameters:
      path - the base directory path
    • getClass

      public static Class<?> getClass(String classPath, String className)
      Gets the class with the given name in the specified path.
      Parameters:
      classPath - the path
      className - the class name
      Returns:
      the Class object, or null if not found
    • getModelClass

      public static Class<?> getModelClass(String classPath, String className)
      Gets the modelPane class with the given name in the specified path.
      Parameters:
      classPath - the path
      className - the class name
      Returns:
      the Class object, or null if not found
    • getClassOfType

      public static Class<?> getClassOfType(String classPath, String className, Class<?> type)
      Gets the class with the given name in the specified path.
      Parameters:
      classPath - the path
      className - the class name
      type - a subclass of the desired class
      Returns:
      the Class object, or null if not found
    • getClassLoader

      public static ClassLoader getClassLoader(String classPath)
      Gets the ClassLoader for the specified path.
      Parameters:
      classPath - the path
      Returns:
      the ClassLoader object, or null if not found