Example usage for javax.swing UIManager getSystemLookAndFeelClassName

List of usage examples for javax.swing UIManager getSystemLookAndFeelClassName

Introduction

In this page you can find the example usage for javax.swing UIManager getSystemLookAndFeelClassName.

Prototype

public static String getSystemLookAndFeelClassName() 

Source Link

Document

Returns the name of the LookAndFeel class that implements the native system look and feel if there is one, otherwise the name of the default cross platform LookAndFeel class.

Usage

From source file:org.pegadi.client.ApplicationLauncher.java

protected void setTheme(String theme) {
    //TODO: fix nullpointerexception
    log.debug("theme: {}", theme);
    String lfTheme;/*from  w w  w .  ja v a2s .  c o m*/
    if (theme.equalsIgnoreCase("system")) {
        lfTheme = UIManager.getSystemLookAndFeelClassName();
    } else if (theme.equalsIgnoreCase("swing")) {
        lfTheme = UIManager.getCrossPlatformLookAndFeelClassName();
        lfTheme = UIManager.getSystemLookAndFeelClassName();
    } else if (theme.equalsIgnoreCase("gtk")) {
        lfTheme = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
        //DEBUG
        lfTheme = UIManager.getSystemLookAndFeelClassName();
    } else {
        log.error("Invalid L&F theme");
        throw new IllegalArgumentException("'" + theme + "' is not a supported L&F");
    }

    if (!lfTheme.equals(UIManager.getLookAndFeel().getName())) {
        try {
            UIManager.setLookAndFeel(lfTheme);
        } catch (Exception e) {
            log.warn("Unable to set selected L&F, swapping to a default L&F");
            UIManager.LookAndFeelInfo[] installedLF = UIManager.getInstalledLookAndFeels();
            try {
                UIManager.setLookAndFeel(installedLF[0].getClassName());
            } catch (Exception e2) {
                log.error("Unable to load any L&F, exiting", e2);
                System.exit(-1);
            }
        }
        try {
            log.debug("attempting to update componenttreeui");
            SwingUtilities.updateComponentTreeUI(this.getContentPane());
        } catch (Exception swe) {
            log.error("Unable to update component tree", swe);
        }
    }
    pack();
    //Might be the cause of occasional NullpointEx due to system
    //not being able to locate LookAndFeel
}

From source file:com.sshtools.appframework.ui.SshToolsApplication.java

protected LookAndFeelInfo getDefaultLAF() {
    return getLAF(PreferencesStore.get(PREF_LAF, UIManager.getSystemLookAndFeelClassName()));
}

From source file:de.cenote.jasperstarter.Report.java

public static void setLookAndFeel() {
    try {/*  w  w w.j  a v a  2 s  . c om*/
        // Set System L&F
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:de.huxhorn.lilith.Lilith.java

public static void startUI(final String appTitle) {
    final Logger logger = LoggerFactory.getLogger(Lilith.class);

    UIManager.installLookAndFeel("JGoodies Windows", "com.jgoodies.looks.windows.WindowsLookAndFeel");
    UIManager.installLookAndFeel("JGoodies Plastic", "com.jgoodies.looks.plastic.PlasticLookAndFeel");
    UIManager.installLookAndFeel("JGoodies Plastic 3D", "com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
    UIManager.installLookAndFeel("JGoodies Plastic XP", "com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
    // Substance requires 1.6
    UIManager.installLookAndFeel("Substance Dark - Twilight",
            "org.pushingpixels.substance.api.skin.SubstanceTwilightLookAndFeel");
    UIManager.installLookAndFeel("Substance Light - Business",
            "org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel");

    //UIManager.installLookAndFeel("Napkin", "net.sourceforge.napkinlaf.NapkinLookAndFeel");

    // look & feels must be installed before creation of ApplicationPreferences.
    ApplicationPreferences applicationPreferences = new ApplicationPreferences();

    // init look & feel
    String lookAndFeelName = applicationPreferences.getLookAndFeel();
    String systemLookAndFeelClassName = UIManager.getSystemLookAndFeelClassName();
    String lookAndFeelClassName = systemLookAndFeelClassName;
    if (lookAndFeelName != null) {
        for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if (lookAndFeelName.equals(info.getName())) {
                lookAndFeelClassName = info.getClassName();
                break;
            }//from   w w w.  j  av a 2s . co m
        }
    }

    try {
        UIManager.setLookAndFeel(lookAndFeelClassName);
    } catch (Throwable e) {
        if (logger.isWarnEnabled())
            logger.warn("Failed to set look&feel to '{}'.", lookAndFeelClassName, e);
        if (!lookAndFeelClassName.equals(systemLookAndFeelClassName)) {
            try {
                UIManager.setLookAndFeel(systemLookAndFeelClassName);
                lookAndFeelClassName = systemLookAndFeelClassName;
            } catch (Throwable e2) {
                if (logger.isWarnEnabled())
                    logger.warn("Failed to set look&feel to '{}'.", systemLookAndFeelClassName, e);
                lookAndFeelClassName = null;
            }
        }
    }

    boolean screenMenuBar = false;
    if (systemLookAndFeelClassName.equals(lookAndFeelClassName)) {
        // This instance of application is only used to query some info. The real one is in MainFrame.
        Application application = new DefaultApplication();

        if (application.isMac()) {
            // Use Apple Aqua L&F screen menu bar if available; set property before any frames created
            try {
                System.setProperty(APPLE_SCREEN_MENU_BAR_SYSTEM_PROPERTY, "true");
                screenMenuBar = true;
            } catch (Throwable e) {
                try {
                    screenMenuBar = Boolean
                            .parseBoolean(System.getProperty(APPLE_SCREEN_MENU_BAR_SYSTEM_PROPERTY, "false"));
                } catch (Throwable e2) {
                    // ignore
                }
            }
        }
    }

    applicationPreferences.setUsingScreenMenuBar(screenMenuBar);

    boolean splashScreenDisabled = applicationPreferences.isSplashScreenDisabled();
    try {
        SplashScreen splashScreen = null;
        if (!splashScreenDisabled) {
            CreateSplashRunnable createRunnable = new CreateSplashRunnable(appTitle);
            EventQueue.invokeAndWait(createRunnable);
            splashScreen = createRunnable.getSplashScreen();
            Thread.sleep(500); // so the splash gets the chance to get displayed :(
            updateSplashStatus(splashScreen, "Initialized application preferences...");
        }

        File startupApplicationPath = applicationPreferences.getStartupApplicationPath();
        if (startupApplicationPath.mkdirs()) {
            if (logger.isDebugEnabled())
                logger.debug("Created '{}'.", startupApplicationPath.getAbsolutePath());
        }

        // System.err redirection
        {
            File errorLog = new File(startupApplicationPath, "errors.log");
            boolean freshFile = false;
            if (!errorLog.isFile()) {
                freshFile = true;
            }
            try {
                FileOutputStream fos = new FileOutputStream(errorLog, true);
                PrintStream ps = new PrintStream(fos, true, StandardCharsets.UTF_8.name());
                if (!freshFile) {
                    ps.println("----------------------------------------");
                }
                String currentDateTime = DateTimeFormatters.DATETIME_IN_SYSTEM_ZONE_SPACE.format(Instant.now());
                ps.println("Started " + APP_NAME + " V" + APP_VERSION + " at " + currentDateTime);
                System.setErr(ps);
                if (logger.isInfoEnabled())
                    logger.info("Writing System.err to '{}'.", errorLog.getAbsolutePath());
            } catch (FileNotFoundException | UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }

        File prevPathFile = new File(startupApplicationPath,
                ApplicationPreferences.PREVIOUS_APPLICATION_PATH_FILENAME);
        if (prevPathFile.isFile()) {
            updateSplashStatus(splashScreen, "Moving application path content...");
            moveApplicationPathContent(prevPathFile, startupApplicationPath);
        }
        if (!applicationPreferences.isLicensed()) {
            hideSplashScreen(splashScreen);

            LicenseAgreementDialog licenseDialog = new LicenseAgreementDialog();
            licenseDialog.setAlwaysOnTop(true);
            licenseDialog.setAutoRequestFocus(true);
            Windows.showWindow(licenseDialog, null, true);
            if (licenseDialog.isLicenseAgreed()) {
                applicationPreferences.setLicensed(true);
            } else {
                if (logger.isWarnEnabled())
                    logger.warn("Didn't accept license! Exiting...");
                System.exit(-1);
            }
        }

        updateSplashStatus(splashScreen, "Creating main window...");
        CreateMainFrameRunnable createMain = new CreateMainFrameRunnable(applicationPreferences, splashScreen,
                appTitle);
        EventQueue.invokeAndWait(createMain);
        final MainFrame frame = createMain.getMainFrame();
        if (logger.isDebugEnabled())
            logger.debug("After show...");
        updateSplashStatus(splashScreen, "Initializing application...");
        EventQueue.invokeAndWait(frame::startUp);
        hideSplashScreen(splashScreen);
        mainFrame = frame;

    } catch (InterruptedException ex) {
        if (logger.isInfoEnabled())
            logger.info("Interrupted...", ex);
        IOUtilities.interruptIfNecessary(ex);
    } catch (InvocationTargetException ex) {
        if (logger.isWarnEnabled())
            logger.warn("InvocationTargetException...", ex);
        if (logger.isWarnEnabled())
            logger.warn("Target-Exception: ", ex.getTargetException());

    }
}

From source file:net.sf.jabref.JabRef.java

private void setLookAndFeel() {
    try {/*w  w w .  ja  v  a 2  s  .c  o  m*/
        String lookFeel;
        String systemLnF = UIManager.getSystemLookAndFeelClassName();

        if (Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_LOOK_AND_FEEL)) {
            // Use system Look & Feel by default
            lookFeel = systemLnF;
        } else {
            lookFeel = Globals.prefs.get(JabRefPreferences.WIN_LOOK_AND_FEEL);
        }

        // At all cost, avoid ending up with the Metal look and feel:
        if ("javax.swing.plaf.metal.MetalLookAndFeel".equals(lookFeel)) {
            Plastic3DLookAndFeel lnf = new Plastic3DLookAndFeel();
            Plastic3DLookAndFeel.setCurrentTheme(new SkyBluer());
            com.jgoodies.looks.Options.setPopupDropShadowEnabled(true);
            UIManager.setLookAndFeel(lnf);
        } else {
            try {
                UIManager.setLookAndFeel(lookFeel);
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                    | UnsupportedLookAndFeelException e) {
                // specified look and feel does not exist on the classpath, so use system l&f
                UIManager.setLookAndFeel(systemLnF);
                // also set system l&f as default
                Globals.prefs.put(JabRefPreferences.WIN_LOOK_AND_FEEL, systemLnF);
                // notify the user
                JOptionPane.showMessageDialog(JabRef.jrf,
                        Localization.lang(
                                "Unable to find the requested Look & Feel and thus the default one is used."),
                        Localization.lang("Warning"), JOptionPane.WARNING_MESSAGE);
            }
        }
    } catch (Exception e) {
        LOGGER.warn("Look and feel could not be set", e);
    }

    // In JabRef v2.8, we did it only on NON-Mac. Now, we try on all platforms
    boolean overrideDefaultFonts = Globals.prefs.getBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONTS);
    if (overrideDefaultFonts) {
        int fontSize = Globals.prefs.getInt(JabRefPreferences.MENU_FONT_SIZE);
        UIDefaults defaults = UIManager.getDefaults();
        Enumeration<Object> keys = defaults.keys();
        Double zoomLevel = null;
        for (Object key : Collections.list(keys)) {
            if ((key instanceof String) && ((String) key).endsWith(".font")) {
                FontUIResource font = (FontUIResource) UIManager.get(key);
                if (zoomLevel == null) {
                    // zoomLevel not yet set, calculate it based on the first found font
                    zoomLevel = (double) fontSize / (double) font.getSize();
                }
                font = new FontUIResource(font.getName(), font.getStyle(), fontSize);
                defaults.put(key, font);
            }
        }
        if (zoomLevel != null) {
            GUIGlobals.zoomLevel = zoomLevel;
        }
    }
}

From source file:edu.stanford.muse.launcher.Main.java

/** we need a system tray icon for management.
 * http://docs.oracle.com/javase/6/docs/api/java/awt/SystemTray.html */
public static void setupSystemTrayIcon() {
    // Set the app name in the menu bar for mac. 
    // c.f. http://stackoverflow.com/questions/8918826/java-os-x-lion-set-application-name-doesnt-work
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Muse");
    try {//from  w  w w  . ja v  a  2s.  c om
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    TrayIcon trayIcon = null;
    if (SystemTray.isSupported()) {
        System.out.println("Adding Muse to the system tray");
        SystemTray tray = SystemTray.getSystemTray();

        URL u = Main.class.getClassLoader().getResource("muse-icon.png"); // note: this better be 16x16, Windows doesn't resize! Mac os does.
        System.out.println("muse icon resource is " + u);
        Image image = Toolkit.getDefaultToolkit().getImage(u);
        System.out.println("Image = " + image);

        // create menu items and their listeners
        ActionListener openMuseControlsListener = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    launchBrowser(BASE_URL + "/info");
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        };

        ActionListener QuitMuseListener = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                out.println("*** Received quit from system tray. Stopping the Jetty embedded web server.");
                try {
                    server.stop();
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }
                System.exit(0); // we need to explicitly system.exit because we now use Swing (due to system tray, etc).
            }
        };

        // create a popup menu
        PopupMenu popup = new PopupMenu();
        MenuItem defaultItem = new MenuItem("Open Muse window");
        defaultItem.addActionListener(openMuseControlsListener);
        popup.add(defaultItem);
        MenuItem quitItem = new MenuItem("Quit Muse");
        quitItem.addActionListener(QuitMuseListener);
        popup.add(quitItem);

        /// ... add other items
        // construct a TrayIcon
        String message = "Muse menu";
        // on windows - the tray menu is a little non-intuitive, needs a right click (plain click seems unused)
        if (System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0)
            message = "Right click for Muse menu";
        trayIcon = new TrayIcon(image, message, popup);
        System.out.println("tray Icon = " + trayIcon);
        // set the TrayIcon properties
        //            trayIcon.addActionListener(openMuseControlsListener);
        try {
            tray.add(trayIcon);
        } catch (AWTException e) {
            System.err.println(e);
        }
        // ...
    } else {
        // disable tray option in your application or
        // perform other actions
        //            ...
    }
    System.out.println("Done!");
    // ...
    // some time later
    // the application state has changed - update the image
    if (trayIcon != null) {
        //        trayIcon.setImage(updatedImage);
    }
    // ...
}

From source file:Classes.MainForm.java

public void exitLabelMouseClicked(MouseEvent e) {//hid main form and display try icon

    if (!SystemTray.isSupported()) {
        System.exit(0);//from   w w w. ja  v  a  2s .com
    } else {
        if (this.mainFrame.isVisible()) {
            this.mainFrame.dispose();
        }
        if (MainForm.trayIcon == null) {
            try {
                try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                } catch (Exception ex) {
                }
                initTray();
            } catch (IOException e1) {
                System.exit(0);
            }
        }
    }
}

From source file:edu.stanford.epadd.launcher.Main.java

/** we need a system tray icon for management.
 * http://docs.oracle.com/javase/6/docs/api/java/awt/SystemTray.html */
public static void setupSystemTrayIcon() {
    // Set the app name in the menu bar for mac. 
    // c.f. http://stackoverflow.com/questions/8918826/java-os-x-lion-set-application-name-doesnt-work
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "ePADD");
    try {//from   w  w w .jav a2 s  . c o m
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    TrayIcon trayIcon = null;
    if (SystemTray.isSupported()) {
        System.out.println("Adding ePADD to the system tray");
        SystemTray tray = SystemTray.getSystemTray();

        URL u = Main.class.getClassLoader().getResource("muse-icon.png"); // note: this better be 16x16, Windows doesn't resize! Mac os does.
        System.out.println("ePADD icon resource is " + u);
        Image image = Toolkit.getDefaultToolkit().getImage(u);
        System.out.println("Image = " + image);

        // create menu items and their listeners
        ActionListener openMuseControlsListener = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    launchBrowser(BASE_URL); // no + "info" for epadd like in muse
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        };

        ActionListener QuitMuseListener = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                out.println("*** Received quit from system tray. Stopping the Jetty embedded web server.");
                try {
                    server.stop();
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }
                System.exit(0); // we need to explicitly system.exit because we now use Swing (due to system tray, etc).
            }
        };

        // create a popup menu
        PopupMenu popup = new PopupMenu();
        MenuItem defaultItem = new MenuItem("Open ePADD window");
        defaultItem.addActionListener(openMuseControlsListener);
        popup.add(defaultItem);
        MenuItem quitItem = new MenuItem("Quit ePADD");
        quitItem.addActionListener(QuitMuseListener);
        popup.add(quitItem);

        /// ... add other items
        // construct a TrayIcon
        String message = "ePADD menu";
        // on windows - the tray menu is a little non-intuitive, needs a right click (plain click seems unused)
        if (System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0)
            message = "Right click for ePADD menu";
        trayIcon = new TrayIcon(image, message, popup);
        System.out.println("tray Icon = " + trayIcon);
        // set the TrayIcon properties
        //            trayIcon.addActionListener(openMuseControlsListener);
        try {
            tray.add(trayIcon);
        } catch (AWTException e) {
            System.err.println(e);
        }
        // ...
    } else {
        // disable tray option in your application or
        // perform other actions
        //            ...
    }
    System.out.println("Done!");
    // ...
    // some time later
    // the application state has changed - update the image
    if (trayIcon != null) {
        //        trayIcon.setImage(updatedImage);
    }
    // ...
}

From source file:com.moss.bdbadmin.client.ui.BdbAdminClient.java

public static void main(String[] args) throws Exception {

    Thread t = new Thread() {
        public void run() {
            try {
                Magic.initialize();/*from  w  w  w .j  av  a  2s .  c  o m*/
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    };
    t.setPriority(Thread.MIN_PRIORITY);
    t.start();

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

    HttpClient httpClient = new HttpClient();
    BdbClient.init();

    JFrame frame = new JFrame();

    ProxyFactory proxyFactory = VeracityProxyFactory.create();

    BdbAdminClient client = new BdbAdminClient(httpClient, frame, new File("config.xml"), proxyFactory);

    frame.setTitle("Bdb Network Explorer");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(client);
    frame.setSize(1024, 768);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

From source file:org.jets3t.apps.uploader.Uploader.java

/**
 * Initialises the application's GUI elements.
 *///from ww  w .jav  a 2  s  .c o  m
private void initGui() {
    // Initialise skins factory.
    skinsFactory = SkinsFactory.getInstance(uploaderProperties.getProperties());

    // Set Skinned Look and Feel.
    LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme("SkinnedLookAndFeel");
    try {
        UIManager.setLookAndFeel(lookAndFeel);
    } catch (UnsupportedLookAndFeelException e) {
        log.error("Unable to set skinned LookAndFeel", e);
    }

    // Apply branding
    String applicationTitle = replaceMessageVariables(
            uploaderProperties.getStringProperty("gui.applicationTitle", null));
    if (applicationTitle != null) {
        ownerFrame.setTitle(applicationTitle);
    }
    String applicationIconPath = uploaderProperties.getStringProperty("gui.applicationIcon", null);
    if (!isRunningAsApplet && applicationIconPath != null) {
        guiUtils.applyIcon(ownerFrame, applicationIconPath);
    }
    String footerHtml = uploaderProperties.getStringProperty("gui.footerHtml", null);
    String footerIconPath = uploaderProperties.getStringProperty("gui.footerIcon", null);

    // Footer for branding
    boolean includeFooter = false;
    JHtmlLabel footerLabel = skinsFactory.createSkinnedJHtmlLabel("FooterLabel");
    footerLabel.setHyperlinkeActivatedListener(this);
    footerLabel.setHorizontalAlignment(JLabel.CENTER);
    if (footerHtml != null) {
        footerLabel.setText(replaceMessageVariables(footerHtml));
        includeFooter = true;
    }
    if (footerIconPath != null) {
        guiUtils.applyIcon(footerLabel, footerIconPath);
    }

    userInputFields = new UserInputFields(insetsDefault, this, skinsFactory);

    // Screeen 1 : User input fields.
    JPanel screen1Panel = skinsFactory.createSkinnedJPanel("Screen1Panel");
    screen1Panel.setLayout(GRID_BAG_LAYOUT);
    userInputFields.buildFieldsPanel(screen1Panel, uploaderProperties);

    // Screen 2 : Drag/drop panel.
    JPanel screen2Panel = skinsFactory.createSkinnedJPanel("Screen2Panel");
    screen2Panel.setLayout(GRID_BAG_LAYOUT);
    dragDropTargetLabel = skinsFactory.createSkinnedJHtmlLabel("DragDropTargetLabel");
    dragDropTargetLabel.setHyperlinkeActivatedListener(this);
    dragDropTargetLabel.setHorizontalAlignment(JLabel.CENTER);
    dragDropTargetLabel.setVerticalAlignment(JLabel.CENTER);

    JButton chooseFileButton = skinsFactory.createSkinnedJButton("ChooseFileButton");
    chooseFileButton.setActionCommand("ChooseFile");
    chooseFileButton.addActionListener(this);
    configureButton(chooseFileButton, "screen.2.browseButton");

    screen2Panel.add(dragDropTargetLabel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    screen2Panel.add(chooseFileButton, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTH,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Screen 3 : Information about the file to be uploaded.
    JPanel screen3Panel = skinsFactory.createSkinnedJPanel("Screen3Panel");
    screen3Panel.setLayout(GRID_BAG_LAYOUT);
    fileToUploadLabel = skinsFactory.createSkinnedJHtmlLabel("FileToUploadLabel");
    fileToUploadLabel.setHyperlinkeActivatedListener(this);
    fileToUploadLabel.setHorizontalAlignment(JLabel.CENTER);
    fileToUploadLabel.setVerticalAlignment(JLabel.CENTER);
    screen3Panel.add(fileToUploadLabel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // Screen 4 : Upload progress.
    JPanel screen4Panel = skinsFactory.createSkinnedJPanel("Screen4Panel");
    screen4Panel.setLayout(GRID_BAG_LAYOUT);
    fileInformationLabel = skinsFactory.createSkinnedJHtmlLabel("FileInformationLabel");
    fileInformationLabel.setHyperlinkeActivatedListener(this);
    fileInformationLabel.setHorizontalAlignment(JLabel.CENTER);
    progressBar = skinsFactory.createSkinnedJProgressBar("ProgressBar", 0, 100);
    progressBar.setStringPainted(true);
    progressStatusTextLabel = skinsFactory.createSkinnedJHtmlLabel("ProgressStatusTextLabel");
    progressStatusTextLabel.setHyperlinkeActivatedListener(this);
    progressStatusTextLabel.setText(" ");
    progressStatusTextLabel.setHorizontalAlignment(JLabel.CENTER);
    progressTransferDetailsLabel = skinsFactory.createSkinnedJHtmlLabel("ProgressTransferDetailsLabel");
    progressTransferDetailsLabel.setHyperlinkeActivatedListener(this);
    progressTransferDetailsLabel.setText(" ");
    progressTransferDetailsLabel.setHorizontalAlignment(JLabel.CENTER);
    cancelUploadButton = skinsFactory.createSkinnedJButton("CancelUploadButton");
    cancelUploadButton.setActionCommand("CancelUpload");
    cancelUploadButton.addActionListener(this);
    configureButton(cancelUploadButton, "screen.4.cancelButton");

    screen4Panel.add(fileInformationLabel, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    screen4Panel.add(progressBar, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    screen4Panel.add(progressStatusTextLabel, new GridBagConstraints(0, 2, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    screen4Panel.add(progressTransferDetailsLabel, new GridBagConstraints(0, 3, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    screen4Panel.add(cancelUploadButton, new GridBagConstraints(0, 4, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Screen 5 : Thankyou message.
    JPanel screen5Panel = skinsFactory.createSkinnedJPanel("Screen5Panel");
    screen5Panel.setLayout(GRID_BAG_LAYOUT);
    finalMessageLabel = skinsFactory.createSkinnedJHtmlLabel("FinalMessageLabel");
    finalMessageLabel.setHyperlinkeActivatedListener(this);
    finalMessageLabel.setHorizontalAlignment(JLabel.CENTER);
    screen5Panel.add(finalMessageLabel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // Wizard Button panel.
    backButton = skinsFactory.createSkinnedJButton("backButton");
    backButton.setActionCommand("Back");
    backButton.addActionListener(this);
    nextButton = skinsFactory.createSkinnedJButton("nextButton");
    nextButton.setActionCommand("Next");
    nextButton.addActionListener(this);

    buttonsPanel = skinsFactory.createSkinnedJPanel("ButtonsPanel");
    buttonsPanelCardLayout = new CardLayout();
    buttonsPanel.setLayout(buttonsPanelCardLayout);
    JPanel buttonsInvisiblePanel = skinsFactory.createSkinnedJPanel("ButtonsInvisiblePanel");
    JPanel buttonsVisiblePanel = skinsFactory.createSkinnedJPanel("ButtonsVisiblePanel");
    buttonsVisiblePanel.setLayout(GRID_BAG_LAYOUT);
    buttonsVisiblePanel.add(backButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    buttonsVisiblePanel.add(nextButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.EAST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    buttonsPanel.add(buttonsInvisiblePanel, "invisible");
    buttonsPanel.add(buttonsVisiblePanel, "visible");

    // Overall content panel.
    appContentPanel = skinsFactory.createSkinnedJPanel("ApplicationContentPanel");
    appContentPanel.setLayout(GRID_BAG_LAYOUT);
    JPanel userGuidancePanel = skinsFactory.createSkinnedJPanel("UserGuidancePanel");
    userGuidancePanel.setLayout(GRID_BAG_LAYOUT);
    primaryPanel = skinsFactory.createSkinnedJPanel("PrimaryPanel");
    primaryPanelCardLayout = new CardLayout();
    primaryPanel.setLayout(primaryPanelCardLayout);
    JPanel navigationPanel = skinsFactory.createSkinnedJPanel("NavigationPanel");
    navigationPanel.setLayout(GRID_BAG_LAYOUT);

    appContentPanel.add(userGuidancePanel, new GridBagConstraints(0, 0, 1, 1, 1, 0.2, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    appContentPanel.add(primaryPanel, new GridBagConstraints(0, 1, 1, 1, 1, 0.6, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    appContentPanel.add(navigationPanel, new GridBagConstraints(0, 2, 1, 1, 1, 0.2, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    if (includeFooter) {
        log.debug("Adding footer for branding");
        appContentPanel.add(footerLabel, new GridBagConstraints(0, 3, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    }
    this.getContentPane().add(appContentPanel);

    userGuidanceLabel = skinsFactory.createSkinnedJHtmlLabel("UserGuidanceLabel");
    userGuidanceLabel.setHyperlinkeActivatedListener(this);
    userGuidanceLabel.setHorizontalAlignment(JLabel.CENTER);

    userGuidancePanel.add(userGuidanceLabel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsNone, 0, 0));
    navigationPanel.add(buttonsPanel, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsNone, 0, 0));

    primaryPanel.add(screen1Panel, "screen1");
    primaryPanel.add(screen2Panel, "screen2");
    primaryPanel.add(screen3Panel, "screen3");
    primaryPanel.add(screen4Panel, "screen4");
    primaryPanel.add(screen5Panel, "screen5");

    // Set preferred sizes
    int preferredWidth = uploaderProperties.getIntProperty("gui.minSizeWidth", 400);
    int preferredHeight = uploaderProperties.getIntProperty("gui.minSizeHeight", 500);
    this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight)));

    // Initialize drop target.
    initDropTarget(new Component[] { this });

    // Revert to default Look and Feel for all future GUI elements (eg Dialog boxes).
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
        log.error("Unable to set default system LookAndFeel", e);
    }

    wizardStepForward();
}