< prev index next >

modules/javafx.graphics/src/main/java/javafx/application/Application.java

Print this page




 168  * @see Platform
 169  *
 170  * @since JavaFX 2.0
 171  */
 172 public abstract class Application {
 173     /**
 174      * Constant for user agent stylesheet for the "Caspian" theme. Caspian
 175      * is the theme that shipped as default in JavaFX 2.x.
 176      * @since JavaFX 8.0
 177      */
 178     public static final String STYLESHEET_CASPIAN = "CASPIAN";
 179     /**
 180      * Constant for user agent stylesheet for the "Modena" theme. Modena
 181      * is the default theme for JavaFX 8.x.
 182      * @since JavaFX 8.0
 183      */
 184     public static final String STYLESHEET_MODENA = "MODENA";
 185 
 186     /**
 187      * Launch a standalone application. This method is typically called
 188      * from the main method(). It must not be called more than once or an
 189      * exception will be thrown.
 190      *
 191      * <p>
 192      * The launch method does not return until the application has exited,
 193      * either via a call to Platform.exit or all of the application windows
 194      * have been closed.
 195      * The class specified by the {@code appClass} argument must be
 196      * a public subclass of {@code Application}
 197      * with a public no-argument constructor, in a package that is
 198      * {@link Module#isExported(String,Module) exported}
 199      * (or {@link Module#isOpen(String,Module) open}) to at least the
 200      * {@code javafx.graphics} module, or a RuntimeException will be thrown.
 201      *
 202      * <p>
 203      * Typical usage is:
 204      * <pre>
 205      *     public static void main(String[] args) {
 206      *         Application.launch(MyApp.class, args);
 207      *     }
 208      * </pre>
 209      * where <code>MyApp</code> is a subclass of Application.
 210      *
 211      * @param appClass the application class that is constructed and executed
 212      *        by the launcher.
 213      * @param args the command line arguments passed to the application.
 214      *             An application may get these parameters using the
 215      *             {@link #getParameters()} method.
 216      *
 217      * @throws IllegalStateException if this method is called more than once.
 218      * @throws IllegalArgumentException if <code>appClass</code> is not a
 219      *         subclass of <code>Application</code>.
 220      * @throws RuntimeException if there is an error launching the
 221      * JavaFX runtime, or if the application class cannot be constructed
 222      * (e.g., if the class is not public or is not in an exported package), or
 223      * if an Exception or Error is thrown by the Application constructor, init
 224      * method, start method, or stop method.
 225      */
 226     public static void launch(Class<? extends Application> appClass, String... args) {
 227         LauncherImpl.launchApplication(appClass, args);
 228     }
 229 
 230     /**
 231      * Launch a standalone application. This method is typically called
 232      * from the main method(). It must not be called more than once or an
 233      * exception will be thrown.
 234      * This is equivalent to {@code launch(TheClass.class, args)} where
 235      * {@code TheClass} is the
 236      * immediately enclosing class of the method that called launch.
 237      * It must be a public subclass of {@code Application}
 238      * with a public no-argument constructor, in a package that is
 239      * {@link Module#isExported(String,Module) exported}
 240      * (or {@link Module#isOpen(String,Module) open}) to at least the
 241      * {@code javafx.graphics} module, or a RuntimeException will be thrown.
 242      *
 243      * <p>
 244      * The launch method does not return until the application has exited,
 245      * either via a call to Platform.exit or all of the application windows
 246      * have been closed.
 247      *
 248      * <p>
 249      * Typical usage is:
 250      * <pre>
 251      *     public static void main(String[] args) {
 252      *         Application.launch(args);
 253      *     }
 254      * </pre>
 255      *
 256      * @param args the command line arguments passed to the application.
 257      *             An application may get these parameters using the
 258      *             {@link #getParameters()} method.
 259      *
 260      * @throws IllegalStateException if this method is called more than once.
 261      * @throws RuntimeException if there is an error launching the
 262      * JavaFX runtime, or if the application class cannot be constructed
 263      * (e.g., if the class is not public or is not in an exported package), or
 264      * if an Exception or Error is thrown by the Application constructor, init
 265      * method, start method, or stop method.




 168  * @see Platform
 169  *
 170  * @since JavaFX 2.0
 171  */
 172 public abstract class Application {
 173     /**
 174      * Constant for user agent stylesheet for the "Caspian" theme. Caspian
 175      * is the theme that shipped as default in JavaFX 2.x.
 176      * @since JavaFX 8.0
 177      */
 178     public static final String STYLESHEET_CASPIAN = "CASPIAN";
 179     /**
 180      * Constant for user agent stylesheet for the "Modena" theme. Modena
 181      * is the default theme for JavaFX 8.x.
 182      * @since JavaFX 8.0
 183      */
 184     public static final String STYLESHEET_MODENA = "MODENA";
 185 
 186     /**
 187      * Launch a standalone application. This method is typically called
 188      * from the {@code main} method. It must not be called more than once or an
 189      * exception will be thrown.
 190      *
 191      * <p>
 192      * The launch method does not return until the application has exited,
 193      * either via a call to {@link Platform#exit()} or all of the application windows
 194      * have been closed.
 195      * The class specified by the {@code appClass} argument must be
 196      * a public subclass of {@code Application}
 197      * with a public no-argument constructor, in a package that is
 198      * {@link Module#isExported(String,Module) exported}
 199      * (or {@link Module#isOpen(String,Module) open}) to at least the
 200      * {@code javafx.graphics} module, or a RuntimeException will be thrown.
 201      *
 202      * <p>
 203      * Typical usage is:
 204      * <pre>
 205      *     public static void main(String[] args) {
 206      *         Application.launch(MyApp.class, args);
 207      *     }
 208      * </pre>
 209      * where <code>MyApp</code> is a subclass of Application.
 210      *
 211      * @param appClass the application class that is constructed and executed
 212      *        by the launcher.
 213      * @param args the command line arguments passed to the application.
 214      *             An application may get these parameters using the
 215      *             {@link #getParameters()} method.
 216      *
 217      * @throws IllegalStateException if this method is called more than once.
 218      * @throws IllegalArgumentException if <code>appClass</code> is not a
 219      *         subclass of <code>Application</code>.
 220      * @throws RuntimeException if there is an error launching the
 221      * JavaFX runtime, or if the application class cannot be constructed
 222      * (e.g., if the class is not public or is not in an exported package), or
 223      * if an Exception or Error is thrown by the Application constructor, init
 224      * method, start method, or stop method.
 225      */
 226     public static void launch(Class<? extends Application> appClass, String... args) {
 227         LauncherImpl.launchApplication(appClass, args);
 228     }
 229 
 230     /**
 231      * Launch a standalone application. This method is typically called
 232      * from the {@code main} method. It must not be called more than once or an
 233      * exception will be thrown.
 234      * This is equivalent to {@code launch(TheClass.class, args)} where
 235      * {@code TheClass} is the
 236      * immediately enclosing class of the method that called launch.
 237      * It must be a public subclass of {@code Application}
 238      * with a public no-argument constructor, in a package that is
 239      * {@link Module#isExported(String,Module) exported}
 240      * (or {@link Module#isOpen(String,Module) open}) to at least the
 241      * {@code javafx.graphics} module, or a RuntimeException will be thrown.
 242      *
 243      * <p>
 244      * The launch method does not return until the application has exited,
 245      * either via a call to {@link Platform#exit()} or all of the application windows
 246      * have been closed.
 247      *
 248      * <p>
 249      * Typical usage is:
 250      * <pre>
 251      *     public static void main(String[] args) {
 252      *         Application.launch(args);
 253      *     }
 254      * </pre>
 255      *
 256      * @param args the command line arguments passed to the application.
 257      *             An application may get these parameters using the
 258      *             {@link #getParameters()} method.
 259      *
 260      * @throws IllegalStateException if this method is called more than once.
 261      * @throws RuntimeException if there is an error launching the
 262      * JavaFX runtime, or if the application class cannot be constructed
 263      * (e.g., if the class is not public or is not in an exported package), or
 264      * if an Exception or Error is thrown by the Application constructor, init
 265      * method, start method, or stop method.


< prev index next >