dbTreeView set selected row background color

Questions and answers on developing, deploying and using plugins and JavaBeans

dbTreeView set selected row background color

Postby huber » Thu Apr 19, 2018 8:14 pm

Hi

I'd like to set in the dbTreeView bean the selected row background color. How can this be accomplished?

Regards,
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 316
Joined: Mon May 14, 2012 11:31 pm

Re: dbTreeView set selected row background color

Postby Gabi Boros » Fri Apr 20, 2018 1:30 pm

hi,

in which application type? for web it should work be overriding the CSS used for selection color, in the smart client it uses the color from the active LAF
Gabi Boros
Servoy
Gabi Boros
 
Posts: 336
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: dbTreeView set selected row background color

Postby huber » Fri Apr 20, 2018 2:32 pm

Hi Gabi

It's for the Smart Client. As you say, the active LAF background color is used, but I would like to use another one.

BTW, is there still no way to control the space between the start of text and the left side (or the triangle)? And also no possibility to span the selected background color over the whole width of the dbTreeView bean? Yes I know the Smart Client has (unfortunately) no priority at Servoy, but still customers expect to have an attractive UI and years of work gone into Smart Client applications can't easely thrown away.

Gabi Boros wrote:hi,

in which application type? for web it should work be overriding the CSS used for selection color, in the smart client it uses the color from the active LAF


Best regards,
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 316
Joined: Mon May 14, 2012 11:31 pm

Re: dbTreeView set selected row background color

Postby Gabi Boros » Fri Apr 20, 2018 3:03 pm

the thing is, the dbtreeview on smart client is actually a wrapper around java's swing tree control, and so, if there is no setting/support for
a desired UI change, we can't do it either (this is related to "no way to control the space between the start of text and the left side / no possibility to span the selected background color over the whole width"),
but the best way is, if you create a case, so we can have a look.
as for the background/foreground, you could try to change the LAF colors on solution open
Code: Select all
   var foregroundColor = new Packages.javax.swing.plaf.ColorUIResource(Packages.java.awt.Color.decode('#00ffff'));
   var backgroundColor = new Packages.javax.swing.plaf.ColorUIResource(Packages.java.awt.Color.decode('#ff0000'));
   var uiDefaults = Packages.javax.swing.UIManager.getDefaults();
   uiDefaults.put("Tree.selectionBackground", backgroundColor);
   uiDefaults.put("Tree.selectionForeground", foregroundColor);
Gabi Boros
Servoy
Gabi Boros
 
Posts: 336
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: dbTreeView set selected row background color

Postby huber » Fri Apr 20, 2018 3:24 pm

Thanks for your help, Gabi! And your suggestion of changing the LAF color.

The desire would be to give a bg color to each dbTreeView separatly, see attache screenshot. The main menu tree on the left should use the LAF color, the one on the right should have a light blue.

I will try your hint, thanks. And make a case.
Regards
Attachments
menu.png
menu.png (299.64 KiB) Viewed 537 times
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 316
Joined: Mon May 14, 2012 11:31 pm


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 7 guests