Friday Jul 03, 2009

Changing the VDI3 login GUI

Disclaimer: everything written below is put here just to share my ideas and findings about how to change the UI of the VDI client used in a VDI3 environment. Since the client is packaged with all of its components in a jar file and there are no configurable ways of changing the UI at this moment, this involves updating components directly within in the jar file. I am in no way encouraging to do this with the way described here, especially not in a production environment because doing so will give you an unsupported environment. Applying a patch in the future might overwrite the changes made to the client. Furthermore, in the future, the client UI might very well be configurable. Consider this as my 'hobby-bob' project to see where we could get with this... :-)

Having that said, I have had several requests of customers, partners and colleagues to change the VDI3 login screen. Again, although formally not supported it is no rocket-science to adapt the images and class files (required to change some of the UI style) in the off-the-shelf vdaclient.jar. The java client code based on AWT / Swing can (in a default installation) be located in /etc/opt/SUNWkio/sessions/vda. If you extract the jar file you will get to a bunch of directories and class files underneath com/sun/vda/client:

# pwd
# jar xf vdaclient.jar
# ls com/sun/vda/client
VdaClient$ButtonActionListener.class  images
VdaClient$DesktopFetcher.class        model
VdaClient$DesktopStarter.class        resources
VdaClient$Response.class              ui
VdaClient.class                       util

so, what are the most common requests - in random order?

  1. Adapting the image window used for login and desktop selector,
  2. Adapting the Sun logo in the upper left corner,
  3. Changing the background of the total screen,
  4. Changing texts and fonts.

Adapting the images can be done by creating new images and updating the existing ones in the vdaclient.jar. So to start with, let us take a look inside the images directory as outlined above...

The images

If we take a look at the images directory, we see a bunch of images that could potentially be replaced by corporate logo's, style, etc. Most relevant images to adapt in many scenario's are probably 'dialog_background.png' and 'sun_logo.png'.

One could take their own favorite image editor program and create some images based on the original one or create something from scratch. Just watch out that you keep about the exact same white space for selector boxes, drop down menus and error information to appear as can been seen in the original.

1. Adapting the image window used for login and desktop selector

A simple example of an adapted 'dialog_background' image that I have made for a VDI demo show at Capgemini can be seen below.

I have run the vdaclient.jar from my laptop (via 'java -jar vdaclient.jar') to get this screenshot. Actually, this is not the best example since the logo at the lower right corner can be overwritten by (long) error messages that can occur in certain misconfigured situation. As this was not the case in this demo setup, I decided to leave it like this - based on Capgemini look and feel style.

In fact, if you create the image like this with the logo in the lower right corner, it will not show, since by default the white space will be rendered on top of the logo image (in order to get this right, you have to set the RootPanel and OptionsPanel as being transparent - this can be done by adding / changing the line 'jpanel.setOpaque(false)' to both methods 'createRootPanel' and 'createOptionsPanel' in the 'Dialog' class; how this can be done... see below).

So now we have this image created we need to update it in the vdaclient.jar file and we should be all set:

# jar uf vdaclient.jar com/sun/vda/client/images/dialog_background.png

2. Adapting the Sun logo in the upper left corner

Obviously, exactly the same method as described above applies to adapt the other images (e.g. 'sun_logo,png', etc.).

3. Changing the background of the total screen

Unfortunately, the background cannot easily be changed since it is not an image but a vertical gradient color that is generated by some Java code within vdaclient.jar. Let's look at the relevant Wallpaper.class file by decompiling the class file as follows (using jad in my case):

# cd com/sun/vda/client/ui
# jad -s java Wallpaper.class
Parsing Wallpaper.class... Generating

If we then take a look inside we see the following lines:

public class Wallpaper extends JPanel

    public Wallpaper()

    public void paintComponent(Graphics g)
        Graphics2D graphics2d = (Graphics2D)g;
        Dimension dimension = getSize();
        GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, FIRST_COLOR,
 0.0F, dimension.height, SECOND_COLOR);
        graphics2d.fill(new java.awt.geom.Rectangle2D.Double(0.0D, 0.0D, dimensi
on.width, dimension.height));

    public static final Color FIRST_COLOR = new Color(25, 107, 138);
    public static final Color SECOND_COLOR = new Color(197, 212, 225);


It is easiest to just change the background color by changing the value of FIRST_COLOR and SECOND_COLOR. If we make these both the same color we get a solid background with that color. After the code change we have to compile the class again and update the vdaclient.jar file:

# javac -classpath ../../../../../vdaclient.jar
# cd ../../../../..
# jar uf vdaclient.jar com/sun/vda/client/ui/Wallpaper.class

This is exactly what I have done for the login screen for our lab environment Sunlabs (combined with yet another login image) as you can see below.

Another thing we can do here is use a background image instead of a solid or gradient color. I have done this, it requires some more code changes but I found the total screen way to 'crowded'. If you need some guidance here drop me a note.

4. Changing texts and fonts

Most (all?) of the text in the login UI can be found in the 'resources' directory. For each of the major languages a '' file can be found. All of the strings could be changed to e.g. include the company name or similar. After you have done this you should obviously update the vdaclient.jar file again as described above.

Changing the fonts is a little more difficult since the fonts are defined within some of the class files. Therefore you need to decompile the appropriate class files (e.g., DesktopSelection, DialogContent, ThemeDefaults), change the fonts (or fontsize) used, compile again and update the vdaclient.jar file as described above at "3. Changing the background of the total screen".


This blog covers exciting things I encounter about Oracle's software and related; that is Identity & Access Management, SOA, Security, Desktop, etc. The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.


« March 2017