Margins on JPanel with MigLayout

I created an OptionDialog without any buttons and put a JPanel in it that uses MigLayout for its layout. That JPanel has another JPanel inside of it.

Both of these panels seem to have a margin on the outside of it. Maybe it is padding on the container. Either way I would like a way to get rid of them.

How can I get rid of these margins? In the picture they are the grey and the dark orange borders around the JPanels.

Here is the panel code:

setBackground(new Color(239,209,59));
setLayout(new MigLayout("wrap 1"));
JLabel title = new JLabel("Enroll Today!", JLabel.CENTER);
Font f = title.getFont().deriveFont((float)36);
title.setFont(f);
add(title);
JPanel docsPanel = new JPanel();
docsPanel.setBorder(BorderFactory.createEmptyBorder());
docsPanel.setLayout(new MigLayout("wrap 1", "", "[grow,fill]"));
docsPanel.setBackground(new Color(255,235,115));
for (final Document d : docs){
    JButton doc = new JButton("* "+d.getName());
    doc.setFont(f.deriveFont((float)24));
    doc.setBorder(null);
    doc.setContentAreaFilled(false);
docsPanel.add(doc);
}
add(docsPanel);

Here is the OptionDialog code:

DocumentPanel panel = new DocumentPanel(controller.getDocuments());
JOptionPane.showOptionDialog(null, panel, "Enroll now!", JOptionPane.DEFAULT_OPTION, 
                             JOptionPane.PLAIN_MESSAGE, null, new Object[] {}, null);

Answers


Blindly, try "ins 0, wrap 1" in the MigLayout constructor.


Need Your Help

Tricky PHP Arrays

php arrays xml-rpc

The output for print_r($array) is as follow;

How to automatically process contents of <textarea> without user pressing a button?

ajax textarea

On my page I have a textarea where users can enter a list of items, items being separated by a newline.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.