Search code examples
javaswinguser-interfaceframeworksicepdf

Change ICEPDF Look And Feel in Java


I am using IcePDF as PDF viewer, with the PropertiesManager I can enable/disable functionalities like for example :

    SwingController controller = new SwingController();

    PropertiesManager properties = new PropertiesManager(System.getProperties(),
            ResourceBundle.getBundle(PropertiesManager.DEFAULT_MESSAGE_BUNDLE));

    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_UTILITY_PRINT, false);
    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_TOOLBAR_ANNOTATION, false);
    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_UTILITYPANE_ANNOTATION, false);
    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_TOOLBAR_ROTATE, false);
    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_UTILITY_SAVE, false);
    properties.setBoolean(PropertiesManager.PROPERTY_SHOW_TOOLBAR_FIT, false);

    SwingViewBuilder factory = new SwingViewBuilder(controller, properties);

But I want to change the Windows Look And Feel, a simple UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); doesn't work. Can someone have the solution ?


Solution

  • I finally just added to the beginning of my code that :

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
            | UnsupportedLookAndFeelException e) {
      System.err.println("[ err. ] " + e);
    }
    

    and it works.