Hello guys I'm using FlatLaf library in my java swing code so I'm getting the class no found and classloader error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello guys I'm using FlatLaf library in my java swing code so I'm getting the class no found and classloader error

import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.SwingUtilities; import com.formdev.flatlaf.FlatLightLaf; import com.formdev.flatlaf.ui.FlatListUI; public class JFrameBackgroundColor { public static void main(String[] args) throws Exception { FlatLightLaf.setup();//setting the look and feel // schedule this for the event dispatch thread (edt) SwingUtilities.invokeLater(new Runnable() { public void run() { displayJFrame(); } }); } static void displayJFrame() { // create our jframe as usual JFrame jframe=new JFrame(); //UIManager.setLookAndFeel(new FlatLightLaf()); //JFrame.setDefaultLookAndFeelDecorated(true); jframe.getRootPane().putClientProperty("JRootPane.titleBarBackground", new Color(23,180,252)); jframe.getRootPane().putClientProperty("JRootPane.titleBarForeground", Color.white); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //jframe.getContentPane().setBackground( Color.RED ); // jframe.setBackground(Color.red); // set the jframe size and location, and make it visible jframe.setPreferredSize(new Dimension(400, 300)); jframe.pack(); jframe.setLocationRelativeTo(null); jframe.setVisible(true); } }

27th Dec 2022, 6:45 AM
Coderalgeria
Coderalgeria - avatar
2 Answers
+ 1
The library jar should be in your classpath, or in your maven dependencies. If you are using a particular IDE it probably has some features to help import external libraries to your project. https://stackoverflow.com/questions/17402009/importing-library-in-java
27th Dec 2022, 6:58 AM
Tibor Santa
Tibor Santa - avatar
0
Acctualy it is in my classpath
27th Dec 2022, 7:23 AM
Coderalgeria
Coderalgeria - avatar