google-code-export / macwidgets

Automatically exported from code.google.com/p/macwidgets
1 stars 0 forks source link

ITunesTableUI selection colors are reset after focus change #103

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create an itunestable and set a custom selection background/foreground color
2. let the table loose focus
3. when the focus is gained again by the table, the selection colors are
reset to defaults defined in ITunesTableUI

in ITunesTableUI, the makeTableActive/makeTableInactive should check
whether a custom selection color was set or store the old values when made
inactive.

suggestion:

private Color lastSelectionForeground =
SELECTION_ACTIVE_SELECTION_FOREGROUND_COLOR;
private Color lastSelectionBackground =
SELECTION_ACTIVE_SELECTION_BACKGROUND_COLOR;

private void makeTableActive() {
   table.setSelectionForeground(lastSelectionForeground);
   table.setSelectionBackground(lastSelectionBackground);
}

private void makeTableInactive() {
  lastSelectionBackground = table.getSelectionBackground();
  lastSelectionForeground = table.getSelectionForeground();
  table.setSelectionForeground(SELECTION_INACTIVE_SELECTION_FOREGROUND_COLOR);
  table.setSelectionBackground(SELECTION_INACTIVE_SELECTION_BACKGROUND_COLOR);
}

Original issue reported on code.google.com by thasso.g...@gmail.com on 27 Jun 2009 at 12:32

GoogleCodeExporter commented 9 years ago
What's the use case for changing the selection color? I'm a little worried that 
if I support the changing of such 
details that we'll end up with "frankenstein" iTunes tables.

Original comment by kenneth....@gmail.com on 27 Jun 2009 at 6:57

GoogleCodeExporter commented 9 years ago
The case where I run into this is that I have a custom selection color defined 
in the
applications color scheme and would like to reflect it where ever possible.
I would argue that the selection color is a property of JTable and should only 
be
reflected, not controlled, by the TableUI implementation. I see the point in 
opening
up the API and agree that it is good to keep the thing as closed as possible to
ensure that it is hard to create ugly UIs, but I think the tables selection 
color is
something that should be exposed by the API. 
If you don't want to support a custom selection color, the ITunesTableUI should 
only
use its own selection color, as for now, I can set the color initially and the 
UI
flips back to its own colors only after a focus lost/gain.  

Original comment by thasso.g...@gmail.com on 27 Jun 2009 at 9:32

GoogleCodeExporter commented 9 years ago
Fair enough. I'll look into this Thasso.

Original comment by kenneth....@gmail.com on 27 Jun 2009 at 9:47