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:
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 « Swing JFC « Java
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âŠ
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.
Thank you everyone for your answers but Iâll put it somewhere else.