An IntelliJ live template for Swing developers
Whenever I'm prototyping Swing code, there's lots to remember about getting a component on screen:To make this easier, I've created a Live Template for IDEA. Add this to your collection of live templates, then simply type
swing[tab]
and remove a little more boilerplate from your life!public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() { public void run() {
JPanel panel = new JPanel(new BorderLayout());
$FOCUS$
JFrame frame = new JFrame();
frame.getContentPane().add(panel);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}});
}