Making a hello world app in a Form in Intellij

  1. Go to the class with the same name as the form.
  2. Press the keyboard shortcut for “Generate”. It’s Ctrl+N on Mac OS X, Alt+Ins on Windows. Alternatively, from the menu, select menu Code → Generate.

  3. Select “Form main()”.

Now the main method is written and inserted for you. It will look something like this:

public static void main(String[] args) {
    JFrame frame = new JFrame("MyForm");
    frame.setContentPane(new MyForm().mainPanel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
}

Leave a Comment

File not found.