Search code examples
javajarmiglayout

How do you import MigLayout into a Java Swing project?


I have a projet for my classes and I want to improve it a bit by using the external library MigLayout.

So I downloaded the jar file and imported it to my project's classpath.

I tried this to import the class but I don't think it's the right way to go :/ :

package views;

import com.miglayout.MigLayout;  // <----

import javax.swing.JFrame;

public class HomeView extends JFrame {

    ...

}

VS Code and Eclipse output: The package com is not accessible

Thanks in advance for your responses :)


Solution

  • According to the API documentation, the correct class to import is:

    import net.miginfocom.swing.MigLayout;