Skip to content

Instantly share code, notes, and snippets.

@mfullen
Created January 9, 2014 02:40
Show Gist options
  • Save mfullen/8328563 to your computer and use it in GitHub Desktop.
Save mfullen/8328563 to your computer and use it in GitHub Desktop.
Code required to create a Movie panel with Mig Layout
public static JPanel createMigLayoutPanel()
{
JPanel panel = new JPanel();
JTextField title = new JTextField();
JTextField descrption = new JTextField();
JTextField releasedate = new JTextField();
JTextField category = new JTextField();
//allow 2 components per line
panel.setLayout(new MigLayout("wrap 2"));
panel.setBorder(BorderFactory.createTitledBorder("Movie"));
panel.add(new JLabel("Title"));
//grow in the x direction and span the space
panel.add(title, "span,growx, w 150!");
panel.add(new JLabel("Description"));
panel.add(descrption, "growx");
panel.add(new JLabel("Release Date"));
panel.add(releasedate, "growx");
panel.add(new JLabel("Category"));
panel.add(category, "growx");
return panel;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment