Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a hello world app in a Form in Intellij

I'm trying to make a hello world form in Intellij. I've created the form, but the question now is what code to make in main() to make the form run and show up?

PS: all the tutorials around seem to only focus on "how to do forms on intellij" not in "how to actually make it run, then".

Thanks

like image 371
devoured elysium Avatar asked Mar 22 '11 19:03

devoured elysium


People also ask

Can I make app in IntelliJ IDEA?

Create a new Android project Launch IntelliJ IDEA. On the Welcome screen, click New Project. If you already have a project open, from the main menu select File | New | Project. In the New Project wizard, select Android on the left.


1 Answers

  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); } 
like image 121
Steve McLeod Avatar answered Oct 14 '22 14:10

Steve McLeod