# Change title of Installation and add an image

**URL:** <https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104>\
**Category:** Java\
**Tags:** welding\
**Created:** [November 13, 2018, 11:05am UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104 "2018-11-13T11:05:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon2844783](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@anon2844783](https://forum.universal-robots.com/u/anon2844783)\
**Post date:** [November 13, 2018, 11:05am UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104/1 "2018-11-13T11:05:48Z")

</div>

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:

 ![Screenshot%20from%202018-11-13%2003-06-24](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/1X/e82bc5f2ef942db2f3d69a408c6ea21949f7e681.png)

Instead of that:

 ![Screenshot%20from%202018-11-14%2003-06-44](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/1X/5ff53e1db4579adb936385be14f383f8a60ba576.png)

---

<div class="post-metadata">

**Author:** ![artiminds](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@artiminds](https://forum.universal-robots.com/u/artiminds)\
**Post date:** [November 15, 2018, 11:17am UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104/2 "2018-11-15T11:17:28Z")

</div>

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: [Label Text Position : Label&nbsp;«&nbsp;Swing JFC&nbsp;«&nbsp;Java](http://www.java2s.com/Code/Java/Swing-JFC/LabelTextPosition.htm)

---

<div class="post-metadata">

**Author:** ![anon12495347](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@anon12495347](https://forum.universal-robots.com/u/anon12495347)\
**Post date:** [November 15, 2018, 12:03pm UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104/3 "2018-11-15T12:03:04Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![artiminds](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@artiminds](https://forum.universal-robots.com/u/artiminds)\
**Post date:** [November 15, 2018, 12:23pm UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104/4 "2018-11-15T12:23:16Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![anon12495347](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@anon12495347](https://forum.universal-robots.com/u/anon12495347)\
**Post date:** [November 15, 2018, 12:41pm UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104/5 "2018-11-15T12:41:52Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![artiminds](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@artiminds](https://forum.universal-robots.com/u/artiminds)\
**Post date:** [November 15, 2018, 12:54pm UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104/6 "2018-11-15T12:54:28Z")

</div>

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”.

---

<div class="post-metadata">

**Author:** ![anon2844783](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@anon2844783](https://forum.universal-robots.com/u/anon2844783)\
**Post date:** [November 15, 2018, 1:00pm UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104/7 "2018-11-15T13:00:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![artiminds](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@artiminds](https://forum.universal-robots.com/u/artiminds)\
**Post date:** [November 15, 2018, 1:06pm UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104/8 "2018-11-15T13:06:52Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![anon65872039](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@anon65872039](https://forum.universal-robots.com/u/anon65872039)\
**Post date:** [November 16, 2018, 8:24am UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104/9 "2018-11-16T08:24:36Z")

</div>

I kind of have the same problem as @anon2844783 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.

---

<div class="post-metadata">

**Author:** ![anon2844783](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@anon2844783](https://forum.universal-robots.com/u/anon2844783)\
**Post date:** [November 16, 2018, 8:40am UTC](https://forum.universal-robots.com/t/change-title-of-installation-and-add-an-image/3104/10 "2018-11-16T08:40:46Z")

</div>

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