This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 14 - Pages: 1 - Last Post: 13-Dec-2020 01:42 Last Post By: ctwist
ctwist

Posts: 607
Registered: 27-Sep-2003
Theme-specific skin settings
Posted: 10-Dec-2020 03:36
 
  Click to reply to this thread Reply
Set the jAlbum "Look and Feel" to the default.

Open a project. Set the skin to Mirage. Open an image's Mirage custom panel.
All is well.

Change the "Look and Feel" to jAlbum Dark. Repeat the above process.
The title in the custom panel looks terrible.

Is there a way to set "Look and Feel"-specific colours for a skin?

Edited by: ctwist on 09-Dec-2020 21:52

To ask the question in a different way:
Can I query the colours (e.g. text colour, background colour) for the current theme? I could then apply an algorithm that calculates contrasting colours.

Edited by: ctwist on 11-Dec-2020 09:04

BTW I didn't need to apply an algorithm. I used the provided colors.
davidekholm

Posts: 3,454
Registered: 18-Oct-2002
Re: Theme-specific skin settings
Posted: 10-Dec-2020 12:07   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
You can use the UIDefaults API to query look&feel specific colors. We also have the JAlbumColor API which is prioritized. If a certain color isn't found there, look in UIDefaults.

(I assume you've restarted jAlbum after changing look&feel. It's always needed)
JeffTucker

Posts: 7,401
Registered: 31-Jan-2006
Re: Theme-specific skin settings
Posted: 10-Dec-2020 22:26   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
While tinkering with something else, I may have stumbled on the simple answer to this one. This screws up with look-and-feel settings other than the system default:
setOpaque(true);
Set it to false and see if that helps.
ctwist

Posts: 607
Registered: 27-Sep-2003
Re: Theme-specific skin settings
Posted: 11-Dec-2020 07:01   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
I already call setOpaque() where necessary.

I am following David's suggestion. It is accomplishing what I want. All of my colors were chosen for the default look and feel; they didn't suit other look and feels.

E.g. I changed
vURL.setBackground(new Color(230,230,230));
to
vURL.setBackground(JAlbumColor.controlLtHighlight);
So this color changes when you change the look and feel setting.

It takes a bit of trial and error to get the right colors. I temporarily added this to CustomUI.java.
System.out.println(JAlbumColor.albumHighlight);
System.out.println(JAlbumColor.albumHover);
System.out.println(JAlbumColor.border);
System.out.println(JAlbumColor.control);
System.out.println(JAlbumColor.controlDkShadow);
System.out.println(JAlbumColor.controlHighlight);
System.out.println(JAlbumColor.controlLtHighlight);
System.out.println(JAlbumColor.controlShadow);
System.out.println(JAlbumColor.controlText);
System.out.println(JAlbumColor.highlight);
System.out.println(JAlbumColor.imageBackground);
System.out.println(JAlbumColor.imageBorder);
System.out.println(JAlbumColor.linkText);
System.out.println(JAlbumColor.rubberBand);
System.out.println(JAlbumColor.sublimeBorder);
System.out.println(JAlbumColor.text);
System.out.println(JAlbumColor.textHighlight);
System.out.println(JAlbumColor.textHighlightText);
System.out.println(JAlbumColor.textInactiveText);
System.out.println(JAlbumColor.textSublimeText);
System.out.println(JAlbumColor.textText);
System.out.println(JAlbumColor.window);
System.out.println(JAlbumColor.windowText);
This reports the standard colors for the current look and feel; this helps to identify the appropriate colors.

Edited by: ctwist on 11-Dec-2020 01:10

In most situations, jAlbum chooses the correct color. There are just a few situations where i need to override this.
davidekholm

Posts: 3,454
Registered: 18-Oct-2002
Re: Theme-specific skin settings
Posted: 11-Dec-2020 08:09   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
Great that you update your skin to be look&feel aware!
ctwist

Posts: 607
Registered: 27-Sep-2003
Re: Theme-specific skin settings
Posted: 11-Dec-2020 22:48   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
While tinkering with something else, I may have stumbled on the simple answer to this one. This screws up with look-and-feel settings other than the system default:
setOpaque(true);
Set it to false and see if that helps.
I just re-read your post and realized that I did not read it properly (it was late).

I have not seen any problems with setOpaque(true) with other look-and-feel themes.
JeffTucker

Posts: 7,401
Registered: 31-Jan-2006
Re: Theme-specific skin settings
Posted: 11-Dec-2020 23:02   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
Attachment JUsystemF.png (6.8 KB)
Attachment JUdarkF.png (6.5 KB)
Attachment JUsystemT.png (6.5 KB)
Attachment JUdarkT.png (6.0 KB)
ctwist wrote:
I have not seen any problems with setOpaque(true) with other look-and-feel themes.

Oh, my, I certainly have. Check out the screenshots, from Jupiter, with the system look-and-feel and the jAlbum dark look-and-feel, with setOpaque() set to T or F. Nothing fancy going on - pretty basic coding. The panel with setOpaque(true) is a mess in every look-and-feel.
ctwist

Posts: 607
Registered: 27-Sep-2003
Re: Theme-specific skin settings
Posted: 11-Dec-2020 23:51   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Yesterday I tried all of the look&feels for Mirage and didn't see your symptoms.

Comparing Jupiter to Mirage:
Jupiter contains:
setBackground(SystemColor.text);
The documentation for "SystemColor.text" is "The color rendered for the background of text control objects, such as textfields and comboboxes." This does not seem appropriate; I suggest you should remove this. This may partially explain your grotesque display, but I don't think it explains it completely.
JeffTucker

Posts: 7,401
Registered: 31-Jan-2006
Re: Theme-specific skin settings
Posted: 11-Dec-2020 23:53   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Ah, I see - you're taking active control over the colors. I don't bother - I just let the look-and-feel provide, well, the look and feel. ;)

In fact, I just yanked out one line of my code that wasn't doing anything. So, other than defining and adding my fields to the edit panel, the only thing I'm doing is setOpaque(false), so that the look-and-feel background color shines through without interference.
JeffTucker

Posts: 7,401
Registered: 31-Jan-2006
Re: Theme-specific skin settings
Posted: 12-Dec-2020 00:00   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
Attachment sysOpF.png (6.4 KB)
Attachment sysOpT.png (6.1 KB)
OK, I am now not doing any color setting on the edit panel. So the only difference is between setOpaque(true) and setOpaque(false). See the screenshots. I'll take the "false" setting, thank you very much. Similar result in the dark schemes.
ctwist

Posts: 607
Registered: 27-Sep-2003
Re: Theme-specific skin settings
Posted: 12-Dec-2020 00:04   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
Ah, I see - you're taking active control over the colors.
Actually, I just override the colours of the title of the panel and some borders. The look&feel does not manage this.

Edited by: ctwist on 11-Dec-2020 18:11

In my unpublished upgrade, I do this
vTitle.setBackground(JAlbumColor.rubberBand);
Maybe it's not perfect, but it makes the title stand out in each look&feel.
JeffTucker

Posts: 7,401
Registered: 31-Jan-2006
Re: Theme-specific skin settings
Posted: 12-Dec-2020 00:17   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
Ah, I see. I'm not sure I'd go to the trouble. I'd probably just show the current object name in a text field, but set to be non-editable. But of course, I'm lazy.
ctwist

Posts: 607
Registered: 27-Sep-2003
Re: Theme-specific skin settings
Posted: 12-Dec-2020 00:19   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
OK, I am now not doing any color setting on the edit panel. So the only difference is between setOpaque(true) and setOpaque(false). See the screenshots. I'll take the "false" setting, thank you very much. Similar result in the dark schemes.
I don't remember why I setOpaque(true) for the entire panel. I set it on some individual components because their background color was not consistent with other components.

I will review setOpaque(true) for the entire panel.
JeffTucker

Posts: 7,401
Registered: 31-Jan-2006
Re: Theme-specific skin settings
Posted: 12-Dec-2020 00:25   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
Some of the stuff in my code is leftover from various "thrashing about" exercises from a decade ago, with bad code provided both by David and by TomCee. ;)
ctwist

Posts: 607
Registered: 27-Sep-2003
Re: Theme-specific skin settings
Posted: 13-Dec-2020 01:42   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
I have removed setOpaque(true) for the entire panel. After I did this, I no longer needed it on some other components. The only place where it is needed is the title.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums