Universal Robots Forum

Change title of Installation and add an image

Is it possible to change the title of IntallationNode and add an image on the same line, like a titlebar but in javaSwing?

To have this:

Instead of that:

1 Like

If you’re using Java Swing I would create a JLabel with the text “Olympus Welding” and add an icon to it.
See the documentation of the Java API; there exist functions to define where the icon should be relative to
the text. It’s also possible to set the spacing between label and icon.

Some examples: http://www.java2s.com/Code/Java/Swing-JFC/LabelTextPosition.htm

But what is shown as ‘Olympus Welding’ is a fixed title that is only a ‘String’.
Filled in the installationnode-service as (overwrite) 'public String getTitle(Locale locale) { function.
Adding an icon there is not possible I think?

The function getTitle() in OverlayInstallationNodeService returns/sets the name of the URCap that will be displayed in the list on the left with the scroll-bars. Here you can’t set an icon.
But the “UR Welding”/“Olymous Welding” displayed on the main page on the right can be customized as you want (default this page is completely empty).

Tried it, changing the value set in ‘getTitle()’ will change both the left tree node as well as the Title on the right part.
(Note: tested not in e-series but in CB series / version 3.7.0).

Then you seem to use the return value of the “getTitle()” function also in your main panel.
I’ve multiple URCap’s here where the titles on the left and right differ (HTML).
You can also see in the first image above that the title on the left is “Olympus Welding”
and on the main panel on the right “UR Welding”.

Thank you for your answers.
The function getTitle() actually change both parts.
On the second image it has been done in HTML but in Swing I can’t have two different title because even if I don’t write anything the title Olympus Welding is here.
Do you have any idea why?

Just checked the documentation:
getTitle(Locale) returns the title for the node, to be shown on the left side of the Installation
tab to access the customized installation screen. For simplicity, the title is specied simply
as “Hello World Swing”. In a more realistic example, the return value of the getTitle(Locale)
method would be translated into the language specied by standard Java localization,
based on the provided Locale argument. The title is also used as the fixed header for the
installation node screen in PolyScope. The method is only called once.

So you could define a second label with an icon as written above or use HTML…

1 Like

I kind of have the same problem as @nina.overney but I don’t think the method you mention will work. In the Swing implementation you don’t have a handle for the title in the InstallationNode, meaning you can’t add labels (or images) to the same line as the title.
You definitely can define a second label, but only add it on another line than the title, as described in the original post. The only solution I have found, is to use the HTML implementation.

3 Likes

Thank you everyone for your answers but I’ll put it somewhere else.