You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by stephen cumminger <st...@sonideft.com> on 2018/07/19 13:16:01 UTC

Customizing the tab showing a TopComponent in Editor mode

I'd like to change the appearance of the tab used to show a TopComponent in the Editor mode. I have been trying to use basic HTML markup to change the color of the text displayed by over-riding this method of the TopComponent:

@Override
    public String getHtmlDisplayName()
    {
      String prefix=(isModified())?"*":"";
      String toreturn= "<HTML><B>"+prefix+"<FONT COLOR=RED>"+super.getDisplayName()+"</FONT></B></HTML>";
      return toreturn;
    }

The only HTML feature that seems to work is the "bold" indicator. I assumed that the tab would support HTML similar to JLabel, but that doesn't appear to be the case.

Has anyone been sucessful modifying the tab in some way? My TopComponent is a non-singleton, so I will have multiple windows of this type populated with different data that I'd like users to be able to distinguish easily. There are also singleton TopComponents in my application that listen for the active window. I was hoping to make the active relationship obvious using a color scheme in the tab area, as that is often the only portion visible. Ideally I'd like to be able to change the background color of the whole tab, but I'd settle for changing the tab's text color.

Ideas or alternative suggestions always welcome.



Stephen Cumminger



Re: Customizing the tab showing a TopComponent in Editor mode

Posted by Geertjan Wielenga <ge...@googlemail.com.INVALID>.
This is an area of the NetBeans Platform that few people know anything
about, hence no responses here. Before I try to track down those references
(I’ll simply be googling, so anything I find you can find too), what’s the
business case for this, i.e., what are you trying to achieve, why, and how
important is this?

Gj


On Thursday, July 19, 2018, stephen cumminger <
stephen.cumminger@sonideft.com> wrote:

> After doing a little more digging, I found a Blog entry that describes how
> to implement a custom TabbedComponentFactory. https://blogs.oracle.com/
> geertjan/plug-a-custom-basictabbedpaneui-into-the-netbeans-platform
>
>
>
> However, the links to the sources are broken http://www.jroller.com/
> DhilshukReddy/entry/custom_jtabbedpane Would anyone have a copy or a link
> to them?
>
>
>
> I also found a YouTube video of Geertjan showing how to set it up. A large
> section of code was just pasted though, so having the source for this
> example would be very helpful. I did find some source for a similar named
> JGoodies implementation. It may be the missing piece ?
> https://jar-download.com/explore-java-source-code-
> detail.php?file=./javaSource/com.jgoodies/jgoodies-looks/2.
> 7.0/com/jgoodies/looks/plastic/PlasticTabbedPaneUI.java&key=
> fdbff8687fce223e862172363d7ac040
>
>
>
>
>
>
>
> *Stephen Cumminger*
>
>
>
> *From:* stephen cumminger <st...@sonideft.com>
> *Sent:* Thursday, July 19, 2018 10:16 AM
> *To:* users@netbeans.apache.org
> *Subject:* Customizing the tab showing a TopComponent in Editor mode
>
>
>
> I’d like to change the appearance of the tab used to show a TopComponent
> in the Editor mode. I have been trying to use basic HTML markup to change
> the color of the text displayed by over-riding this method of the
> TopComponent:
>
>
>
> @Override
>
>     public String getHtmlDisplayName()
>
>     {
>
>       String prefix=(isModified())?"*":"";
>
>       String toreturn= "<HTML><B>"+prefix+"<FONT COLOR=RED>"+super.
> getDisplayName()+"</FONT></B></HTML>";
>
>       return toreturn;
>
>     }
>
>
>
> The only HTML feature that seems to work is the “bold” indicator. I
> assumed that the tab would support HTML similar to JLabel, but that doesn’t
> appear to be the case.
>
>
>
> Has anyone been sucessful modifying the tab in some way? My TopComponent
> is a non-singleton, so I will have multiple windows of this type populated
> with different data that I’d like users to be able to distinguish easily.
> There are also singleton TopComponents in my application that listen for
> the active window. I was hoping to make the active relationship obvious
> using a color scheme in the tab area, as that is often the only portion
> visible. Ideally I’d like to be able to change the background color of the
> whole tab, but I’d settle for changing the tab’s text color.
>
>
>
> Ideas or alternative suggestions always welcome.
>
>
>
>
>
>
>
> *Stephen Cumminger*
>
>
>
>
>

RE: Customizing the tab showing a TopComponent in Editor mode

Posted by stephen cumminger <st...@sonideft.com>.
After doing a little more digging, I found a Blog entry that describes how to implement a custom TabbedComponentFactory. https://blogs.oracle.com/geertjan/plug-a-custom-basictabbedpaneui-into-the-netbeans-platform

However, the links to the sources are broken http://www.jroller.com/DhilshukReddy/entry/custom_jtabbedpane Would anyone have a copy or a link to them?

I also found a YouTube video of Geertjan showing how to set it up. A large section of code was just pasted though, so having the source for this example would be very helpful. I did find some source for a similar named JGoodies implementation. It may be the missing piece ? https://jar-download.com/explore-java-source-code-detail.php?file=./javaSource/com.jgoodies/jgoodies-looks/2.7.0/com/jgoodies/looks/plastic/PlasticTabbedPaneUI.java&key=fdbff8687fce223e862172363d7ac040



Stephen Cumminger

From: stephen cumminger <st...@sonideft.com>
Sent: Thursday, July 19, 2018 10:16 AM
To: users@netbeans.apache.org
Subject: Customizing the tab showing a TopComponent in Editor mode

I'd like to change the appearance of the tab used to show a TopComponent in the Editor mode. I have been trying to use basic HTML markup to change the color of the text displayed by over-riding this method of the TopComponent:

@Override
    public String getHtmlDisplayName()
    {
      String prefix=(isModified())?"*":"";
      String toreturn= "<HTML><B>"+prefix+"<FONT COLOR=RED>"+super.getDisplayName()+"</FONT></B></HTML>";
      return toreturn;
    }

The only HTML feature that seems to work is the "bold" indicator. I assumed that the tab would support HTML similar to JLabel, but that doesn't appear to be the case.

Has anyone been sucessful modifying the tab in some way? My TopComponent is a non-singleton, so I will have multiple windows of this type populated with different data that I'd like users to be able to distinguish easily. There are also singleton TopComponents in my application that listen for the active window. I was hoping to make the active relationship obvious using a color scheme in the tab area, as that is often the only portion visible. Ideally I'd like to be able to change the background color of the whole tab, but I'd settle for changing the tab's text color.

Ideas or alternative suggestions always welcome.



Stephen Cumminger



RE: Customizing the tab showing a TopComponent in Editor mode

Posted by stephen cumminger <st...@sonideft.com>.
Just concluding this thread to tell everyone that I went with the AttentionHighlight suggestion below. The html results for tab title were not consistently reliable.


Stephen Cumminger

From: stephen cumminger <st...@sonideft.com>
Sent: Friday, July 20, 2018 2:50 PM
To: users@netbeans.apache.org
Subject: RE: Customizing the tab showing a TopComponent in Editor mode

Good suggestions. Thanks. Turns out that after another Clean & Build, html color markups are working again in the default platform tabs.

Regards,


Stephen Cumminger


From: Geertjan Wielenga <ge...@googlemail.com.INVALID>>
Sent: Friday, July 20, 2018 9:47 AM
To: users@netbeans.apache.org<ma...@netbeans.apache.org>
Subject: Re: Customizing the tab showing a TopComponent in Editor mode

I'd advise looking closely at the functionality provided out of the box by the APIs rather than rolling your own complex solutions, e.g., here's a few:

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#setAttentionHighlight-boolean-

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#makeBusy-boolean-

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#requestFocus--

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#requestAttention-boolean-

Gj



On Fri, Jul 20, 2018 at 2:39 PM, stephen cumminger <st...@sonideft.com>> wrote:
I downloaded an older version of JGoodies PlasticTabbedPaneUI and about 20 related java files to support it. I had to make an adjustment to it to suppress its titling of the tabs, but other than that it fits in really well into the NetBeans platform; using Geertjan's Blog for guidance. Using TopComponent.setDisplayName() works quite well, and yes it does support the font color markup. I can now color the titles that I wanted.

To answer Neil's question, I did try various colors using the hex codes. It didn't work.

I'm not sure this is a common use case that would warrant filing a bug. There would be value for others in finding the missing referenced file for the Blog so that others can also follow this path to doing something different. The file missing from the Blog appeared to be one java file that did what JGoodies did in 20+.

The business case for me is that I can have multiple documents opened by the user at the same time. I also have various singleton windows that will be listening on the global lookup for certain objects that may be selected within the documents. Each singleton will be listening for different objects within the selected document. Since the singleton windows can make changes to the opened documents, I wanted it very clear visually which document is being viewed/modified in the singleton.

Regards,


Stephen Cumminger


-----Original Message-----
From: Neil C Smith <ne...@apache.org>>
Sent: Friday, July 20, 2018 6:13 AM
To: stephen cumminger <st...@sonideft.com>>; users@netbeans.apache.org<ma...@netbeans.apache.org>
Subject: Re: Customizing the tab showing a TopComponent in Editor mode

On Thu, 19 Jul 2018 at 14:16, stephen cumminger <st...@sonideft.com>> wrote:
>       String toreturn= "<HTML><B>"+prefix+"<FONT
> COLOR=RED>"+super.getDisplayName()+"</FONT></B></HTML>";

Have you tried <font color='#ff0000'> ?

From recollection it uses this -
http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/openide/awt/HtmlRenderer.html

Best wishes,

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org<ma...@netbeans.apache.org>
For additional commands, e-mail: users-help@netbeans.apache.org<ma...@netbeans.apache.org>

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org<ma...@netbeans.apache.org>
For additional commands, e-mail: users-help@netbeans.apache.org<ma...@netbeans.apache.org>

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


RE: Customizing the tab showing a TopComponent in Editor mode

Posted by stephen cumminger <st...@sonideft.com>.
Good suggestions. Thanks. Turns out that after another Clean & Build, html color markups are working again in the default platform tabs.

Regards,


Stephen Cumminger


From: Geertjan Wielenga <ge...@googlemail.com.INVALID>
Sent: Friday, July 20, 2018 9:47 AM
To: users@netbeans.apache.org
Subject: Re: Customizing the tab showing a TopComponent in Editor mode

I'd advise looking closely at the functionality provided out of the box by the APIs rather than rolling your own complex solutions, e.g., here's a few:

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#setAttentionHighlight-boolean-

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#makeBusy-boolean-

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#requestFocus--

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#requestAttention-boolean-

Gj



On Fri, Jul 20, 2018 at 2:39 PM, stephen cumminger <st...@sonideft.com>> wrote:
I downloaded an older version of JGoodies PlasticTabbedPaneUI and about 20 related java files to support it. I had to make an adjustment to it to suppress its titling of the tabs, but other than that it fits in really well into the NetBeans platform; using Geertjan's Blog for guidance. Using TopComponent.setDisplayName() works quite well, and yes it does support the font color markup. I can now color the titles that I wanted.

To answer Neil's question, I did try various colors using the hex codes. It didn't work.

I'm not sure this is a common use case that would warrant filing a bug. There would be value for others in finding the missing referenced file for the Blog so that others can also follow this path to doing something different. The file missing from the Blog appeared to be one java file that did what JGoodies did in 20+.

The business case for me is that I can have multiple documents opened by the user at the same time. I also have various singleton windows that will be listening on the global lookup for certain objects that may be selected within the documents. Each singleton will be listening for different objects within the selected document. Since the singleton windows can make changes to the opened documents, I wanted it very clear visually which document is being viewed/modified in the singleton.

Regards,


Stephen Cumminger


-----Original Message-----
From: Neil C Smith <ne...@apache.org>>
Sent: Friday, July 20, 2018 6:13 AM
To: stephen cumminger <st...@sonideft.com>>; users@netbeans.apache.org<ma...@netbeans.apache.org>
Subject: Re: Customizing the tab showing a TopComponent in Editor mode

On Thu, 19 Jul 2018 at 14:16, stephen cumminger <st...@sonideft.com>> wrote:
>       String toreturn= "<HTML><B>"+prefix+"<FONT
> COLOR=RED>"+super.getDisplayName()+"</FONT></B></HTML>";

Have you tried <font color='#ff0000'> ?

From recollection it uses this -
http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/openide/awt/HtmlRenderer.html

Best wishes,

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org<ma...@netbeans.apache.org>
For additional commands, e-mail: users-help@netbeans.apache.org<ma...@netbeans.apache.org>

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org<ma...@netbeans.apache.org>
For additional commands, e-mail: users-help@netbeans.apache.org<ma...@netbeans.apache.org>

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: Customizing the tab showing a TopComponent in Editor mode

Posted by Geertjan Wielenga <ge...@googlemail.com.INVALID>.
I'd advise looking closely at the functionality provided out of the box by
the APIs rather than rolling your own complex solutions, e.g., here's a few:

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#setAttentionHighlight-boolean-

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#makeBusy-boolean-

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#requestFocus--

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html#requestAttention-boolean-

Gj



On Fri, Jul 20, 2018 at 2:39 PM, stephen cumminger <
stephen.cumminger@sonideft.com> wrote:

> I downloaded an older version of JGoodies PlasticTabbedPaneUI and about 20
> related java files to support it. I had to make an adjustment to it to
> suppress its titling of the tabs, but other than that it fits in really
> well into the NetBeans platform; using Geertjan's Blog for guidance. Using
> TopComponent.setDisplayName() works quite well, and yes it does support the
> font color markup. I can now color the titles that I wanted.
>
> To answer Neil's question, I did try various colors using the hex codes.
> It didn't work.
>
> I'm not sure this is a common use case that would warrant filing a bug.
> There would be value for others in finding the missing referenced file for
> the Blog so that others can also follow this path to doing something
> different. The file missing from the Blog appeared to be one java file that
> did what JGoodies did in 20+.
>
> The business case for me is that I can have multiple documents opened by
> the user at the same time. I also have various singleton windows that will
> be listening on the global lookup for certain objects that may be selected
> within the documents. Each singleton will be listening for different
> objects within the selected document. Since the singleton windows can make
> changes to the opened documents, I wanted it very clear visually which
> document is being viewed/modified in the singleton.
>
> Regards,
>
>
> Stephen Cumminger
>
>
> -----Original Message-----
> From: Neil C Smith <ne...@apache.org>
> Sent: Friday, July 20, 2018 6:13 AM
> To: stephen cumminger <st...@sonideft.com>;
> users@netbeans.apache.org
> Subject: Re: Customizing the tab showing a TopComponent in Editor mode
>
> On Thu, 19 Jul 2018 at 14:16, stephen cumminger <
> stephen.cumminger@sonideft.com> wrote:
> >       String toreturn= "<HTML><B>"+prefix+"<FONT
> > COLOR=RED>"+super.getDisplayName()+"</FONT></B></HTML>";
>
> Have you tried <font color='#ff0000'> ?
>
> From recollection it uses this -
> http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/
> openide/awt/HtmlRenderer.html
>
> Best wishes,
>
> Neil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

RE: Customizing the tab showing a TopComponent in Editor mode

Posted by stephen cumminger <st...@sonideft.com>.
I downloaded an older version of JGoodies PlasticTabbedPaneUI and about 20 related java files to support it. I had to make an adjustment to it to suppress its titling of the tabs, but other than that it fits in really well into the NetBeans platform; using Geertjan's Blog for guidance. Using TopComponent.setDisplayName() works quite well, and yes it does support the font color markup. I can now color the titles that I wanted.

To answer Neil's question, I did try various colors using the hex codes. It didn't work.

I'm not sure this is a common use case that would warrant filing a bug. There would be value for others in finding the missing referenced file for the Blog so that others can also follow this path to doing something different. The file missing from the Blog appeared to be one java file that did what JGoodies did in 20+.

The business case for me is that I can have multiple documents opened by the user at the same time. I also have various singleton windows that will be listening on the global lookup for certain objects that may be selected within the documents. Each singleton will be listening for different objects within the selected document. Since the singleton windows can make changes to the opened documents, I wanted it very clear visually which document is being viewed/modified in the singleton.

Regards,


Stephen Cumminger


-----Original Message-----
From: Neil C Smith <ne...@apache.org> 
Sent: Friday, July 20, 2018 6:13 AM
To: stephen cumminger <st...@sonideft.com>; users@netbeans.apache.org
Subject: Re: Customizing the tab showing a TopComponent in Editor mode

On Thu, 19 Jul 2018 at 14:16, stephen cumminger <st...@sonideft.com> wrote:
>       String toreturn= "<HTML><B>"+prefix+"<FONT 
> COLOR=RED>"+super.getDisplayName()+"</FONT></B></HTML>";

Have you tried <font color='#ff0000'> ?

From recollection it uses this -
http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/openide/awt/HtmlRenderer.html

Best wishes,

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: Customizing the tab showing a TopComponent in Editor mode

Posted by Neil C Smith <ne...@apache.org>.
On Thu, 19 Jul 2018 at 14:16, stephen cumminger
<st...@sonideft.com> wrote:
>       String toreturn= "<HTML><B>"+prefix+"<FONT COLOR=RED>"+super.getDisplayName()+"</FONT></B></HTML>";

Have you tried <font color='#ff0000'> ?

From recollection it uses this -
http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/openide/awt/HtmlRenderer.html

Best wishes,

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists