Is it possible to import "FlatLaf - Flat Look and Feel" into a test case?

Hello community!!! :wave: :slightly_smiling_face:

Is there any way we can import “FlatLaf - Flat Look and Feel” into a test case? Is it possible?

Thank you for your time!!!

I finally found it!!! :slightly_smiling_face:

I just had to add the flatlaf-2.1.jar file into my project as an external library.

From menu “Project” → “Settings” → “Library Management”.
Then of course I had to import it into my code import com.formdev.flatlaf.FlatDarkLaf.
And use it like this UIManager.setLookAndFeel(new FlatDarkLaf()).

Screenshot 2022-03-26 164945
Screenshot 2022-03-26 164637

I don’t understand what level of the project you added the import to. Is this within a specific Test Case or did you add it into a build.gradle file or something entirely different? Thanks

did you read the previous post carefully before asking?


I just had to add the flatlaf-2.1.jar file into my project as an external library… (instructions follows)
after that, you add the import where do you like/need in your code

Yes, I read it and I tried the same. It didn’t work for me so I asked a clarifying question. More specifically, is “UIManager” a Groovy keyword? Katalon doesn’t recognize it when I put that in the code.


You should ask Google first with keyword “UIManager”.

Possibly UIManager is the classical class in the Swing library of Java.

The Swing library is built in JDK8, so you should be able to find it in Katalon Studio.

But you wrote you got error. What sort of error you got? I guess that you missed an import statement:

import javax.swing.UIManager;

Of-course is not.
That’s why you have to add the needed jar in the project … and obviously you have to import the library in your code to be able to use it.
This is how java (and groovy, being developed top of java) works.

Hello Chris!!! Sorry I am answering so late but just now I got an email notification about your question…
Well, after you follow the steps I wrote, just use this code below to test it. It’s a working example of a test case.

import javax.swing.JFrame
import javax.swing.JOptionPane
import javax.swing.UIManager

import com.formdev.flatlaf.FlatDarkLaf


def mainFrame() {
		try {
			UIManager.setLookAndFeel(new FlatDarkLaf())
		} catch (Exception e) {
		GUI.mainFrame = new JFrame()

def automation__set_status() {
	List<String> message_choices = ["Choice One", "Choice Two"]
	String message_txt = 'Choose the way you want to start the automation:'
	String message_result = JOptionPane.showInputDialog(GUI.mainFrame, message_txt, "Message", JOptionPane.QUESTION_MESSAGE , null, message_choices.toArray(), message_choices.toArray()[0])
	if(message_result != null){
		if(!message_result.isEmpty()) {
			switch (message_result) {
				case message_choices[0]:
				// Your code here...
				case message_choices[1]:
				// Your code here...
	} else {
		//----- "Close (x)" button -----//

public class GUI {	
	public static JFrame mainFrame