Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You may have inadvertently selected <code>Java Desktop Application</code></p> <blockquote> <p>Creates a skeleton of a desktop application based on the <a href="http://en.wikipedia.org/wiki/Swing_Application_Framework" rel="noreferrer">Swing Application Framework (JSR 296)</a>. This template provides basic application infrastructure such as a menu bar, persisting of window state, and status bar. With this template, you can also generate code to create a GUI interface for a database table.</p> </blockquote> <p>Rather than <code>Java Application</code></p> <blockquote> <p>Creates a new Java SE application in a standard IDE project. You can also generate a main class in the project. Standard projects use an IDE-generated Ant build script to build, run, and debug your project.</p> </blockquote> <p>Addendum: Use <code>File &gt; New File &gt; Java GUI Forms</code> to add high-level containers, e.g. an enclosing <code>JPanel</code>, that can be instantiated from <code>main()</code>'s <code>run()</code> method.</p> <p>For example, <code>Main.main()</code>:</p> <pre><code>package temp; import java.awt.EventQueue; import javax.swing.JFrame; public class Main { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new NewJPanel()); f.pack(); f.setVisible(true); } }); } } </code></pre> <p>And a <code>NewJPanel</code> built in the GUI editor (note "Generated Code"):</p> <pre><code>package temp; public class NewJPanel extends javax.swing.JPanel { /** Creates new form NewJPanel */ public NewJPanel() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel1.setText("Hello, world!"); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(163, 163, 163) .add(jLabel1) .addContainerGap(157, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(113, 113, 113) .add(jLabel1) .addContainerGap(171, Short.MAX_VALUE)) ); }// &lt;/editor-fold&gt; // Variables declaration - do not modify private javax.swing.JLabel jLabel1; // End of variables declaration } </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