Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you process command line arguments in java Swing Application Framework
    text
    copied!<p>I'm trying to grab the arguments passed form the command line when I run my application. I have a project made through netbeans that uses the SingleFrameApplication class or the swing application framework. The main method does a call </p> <pre><code>launch(MyApp.class, args); </code></pre> <p>in it's main method. The documentation found in <a href="http://java.sun.com/developer/technicalArticles/javase/swingappfr/">http://java.sun.com/developer/technicalArticles/javase/swingappfr/</a> says that:</p> <blockquote> <p>The launch method calls the application's optional initialize method just prior to calling the startup method. You can use the initialize method to perform any initial configuration or setup steps. For example, you can process command-line arguments from within the initialize method. You can also check a database connection or set system properties. In short, the framework provides this method for any non-UI related setup that your application may need before displaying the UI. The Application and SingleFrameApplication classes provide an empty method body for the initialize method. The method does nothing by default. </p> </blockquote> <p>Are we talking about the MyApp.initialize method here? If so, there doesn't seem to be any reference to the args parameter.</p> <p>EDIT: This is not an applet, it's a desktop application. Remember, it's using the Swing Application Framework, which means that, part of this is to have a "launcher" class for you main java class GUI. A code snippet would be:</p> <pre><code>public class MyApp extends SingleFrameApplication { @Override protected void startup() { MyAppGUI view = new MyAppGUI(this); show(new MyAppGUI(this)); } public static void main(String[] args) { launch(MyAppGUI.class, args); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload