Link

How do I enable dark mode in JPedal Viewer?

JPedal has a flag ‘org.jpedal.userControlledLAF’ which accepts 3 different values “true”, “false” or the name of the Java LookAndFeel you want.

You can enter the name of a Java LookAndFeel, for example: ‘javax.swing.plaf.metal.MetalLookAndFeel’ to get a metal look for your viewer. If you want something more specific to your tastes, you can make your own look And Feel or look up the many already made LookAndFeels online to install and set the flag as “true”. To get the default LookAndFeel you would set the flag to “false” or you can also achieve the default by not setting flag.

//Set the userControledLAF flag to your preference 
 System.setProperty("org.jpedal.userControlledLAF", "javax.swing.plaf.metal.MetalLookAndFeel");

Viewer viewer = new Viewer();
 viewer.setupViewer();

This example code lets you open the Standalone PDF viewer with your specified look and feel, if you are looking to embed JPedal into your application with a LookAndFeel already specified ensure that you have the ‘org.jpedal.userControlledLAF’ flag set to “true” and have your LookAndFeel already set before any GUI’s are made as Java does not support dynamically changing the LookAndFeel.

You can find help on making your own lookAndFeel at The Java Tutorials.