aami
aami

Reputation: 25

MigLayout can not be resolved in java

MigLayout can not be resolved problem in my application. code is given below. i have also tried this to do in main body but same error was occuring.

package javaAss;
import java.awt.*;
import javax.swing.*;
import javax.swing.SwingUtilities;

public class Guest 
   {
       JFrame frame=new JFrame("Login as Guest");
       JPanel panel = new JPanel();
       JLabel password=new JLabel("Enter Password");
       JTextField length=new JTextField(5);
       JButton b1=new JButton("Sign in");
       JButton b2=new JButton("Go Back");

public Guest()
{

    JOptionPane.showMessageDialog(null,"You Selected Login as Guest");
    panel.setLayout( new MigLayout());
    panel.add(password);
    panel.add(length);
    panel.add(b1);
    panel.add(b2);
    frame.setSize(500,400);
    frame.setResizable(true);
    frame.setVisible(true);
    frame.add(panel);
}
public static void main (String [] aa)
 {
    SwingUtilities.invokeLater(new Runnable()
    {
    public void run()
    {
        new Guest();    
    }
    });

  }
 }

in this line

panel.setLayout( new MigLayout());

error is occurring again and again that, MigLayout can not be resolved, however i have tried to do this with this also net.miginfocom.swing.MigLayout

I am running this application with eclipse and my java compiler is 1.6 JRE

Upvotes: 1

Views: 2460

Answers (1)

dehlen
dehlen

Reputation: 7389

MigLayout is not a standard Java Layout. You have to:

  • download to corresponding .jar file

  • add jar to your classpath

  • and import it

Here is a Getting Started Guide: MigLayout Website

Upvotes: 2

Related Questions