[kepler-dev] background color

Christopher Brooks cxh at eecs.berkeley.edu
Wed Aug 5 07:34:35 PDT 2009


I'll match your $5.
Setting the background is notoriously broken in AWT and Swing.
Edward and I have struggled with this since 1998 with the plotter.
I'm currently working on trying to use CSS inside Java components,
but that is even worse, see
  http://bugzilla.ecoinformatics.org/show_bug.cgi?id=3801


One thing is that Component.setBackground() says:

"public void setBackground(Color c)

     Sets the background color of this component.

     The background color affects each component differently and the parts of the component that are affected by the background color may differ between operating systems.

     Parameters:
         c - the color to become this component's color; if this parameter is null, then this component will inherit the background color of its parent
"
See

http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#setBackground%28java.awt.Color%29

Another thing is to make darn sure that the setBackground call is called
from the Swing thread.

Other than that, I suggest drinking heavily and wondering why Java did not
use Tk instead of AWT.  John Ousterhout was at Sun Labs at the time
Java was being developed.  Such a great opportunity was missed . . .

_Christopher



Aaron Schultz wrote:
> 
> Ah, so I remembered late last night why I changed the background color 
> to Gray.  When the canvas was put inside a JTabbedPane I was unable to 
> change the background color of the tab using the Swing api (5 bucks to 
> whoever can figure it out).  It really only shows up in the mac version, 
> I think the windows and linux versions don't have the problem.  So the 
> workaround was to change the backgrounds of the components in the tab to 
> match the tab background in the JTabbedPane.
> 
> The attachment illustrates the problem.
> Or you can try toggling TabManager.BGCOLOR and 
> KeplerGraphFrame.BACKGROUND_COLOR
> on mac, linux, and windows.
> 
> Aaron
> 
> 
> Matt Jones wrote:
>> Hi Shawn,
>>
>> Previous GUI design discussions and decisions were archived on the old
>> wiki, and were moved to the new web site here:
>>
>> https://kepler-project.org/developers/incubation/GUI/archive/
>>
>> One page in particular gives something of a synopsis of the decisions,
>> although it is not completely up to date nor absolutely complete:
>> https://kepler-project.org/developers/incubation/GUI/archive/visual-redesign-notes 
>>
>>
>> In addition, we never completed all of the work we agreed upon, as M.
>> Brooke left before completing the work.  Many dialog changes and other
>> GUI changes that we designed still are only represented on the design
>> diagrams in that archive area.  I still plan on getting this done
>> somehow, but not sure how to fund it now, and of course the designs
>> need to be reconsidered in light of newer UI work that has transpired
>> since.
>>
>> Matt
>>
>> On Mon, Aug 3, 2009 at 4:17 PM, Shawn Bowers<sbowers at ucdavis.edu> wrote:
>>  
>>> Hi,
>>>
>>> I think it would be good to try to document some of the GUI look and
>>> feel decisions using the Kepler Plone GUI area
>>> (https://kepler-project.org/developers/incubation/GUI).  This could
>>> just be a single page with a list of items (like color for
>>> backgrounds) and the current decisions (with rationale) regarding
>>> them. So, e.g., if a decision has been made on some item, then
>>> changing it should only be done after a discussion (because it would
>>> require changing a prior decision). This might help mitigate changes,
>>> re-changes, etc., and at least provide minimal documentation of what
>>> decisions have been made.
>>>
>>> Thoughts?
>>>
>>> Shawn
>>>
>>> On Mon, Aug 3, 2009 at 7:56 AM, Matt Jones<jones at nceas.ucsb.edu> wrote:
>>>    
>>>> Yeah, this has been bugging me too.  Lets change the background back
>>>> to the white background that we designed for the Kepler UI.  Anyone
>>>> know who made this UI change?  Can you change it back please?
>>>>
>>>> Matt
>>>>
>>>> On Mon, Aug 3, 2009 at 6:32 AM, Christopher 
>>>> Brooks<cxh at eecs.berkeley.edu> wrote:
>>>>      
>>>>> Hi Norbert,
>>>>> In Ptolemy, drag in a LocalPreferences attribute from Utilities.
>>>>> Then set the Background color.
>>>>>
>>>>> It appears that Kepler does not have LocalPreferences in the list
>>>>> of attributes, so I did Tools->Instantiate Attribute and then
>>>>> entered ptolemy.actor.gui.PtolemyPreferences
>>>>>
>>>>> When I hacked in the -printPDF facility, I added some code that
>>>>> sets the background, see for example
>>>>> ptolemy.actor.gui.ConfigurationApplication.
>>>>>
>>>>> The place where PtolemyPreferences is used to set the background is in
>>>>> ptolemy.vergil.basic.BasicGraphFrame
>>>>>
>>>>> _Christopher
>>>>>
>>>>> Podhorszki, Norbert wrote:
>>>>>        
>>>>>> Hi,
>>>>>>
>>>>>> Where can I set the GUI's background back to white?
>>>>>> After years of making nice screenshots for (white bg) papers and 
>>>>>> slides, I
>>>>>> just cannot stand the current gray background.
>>>>>>
>>>>>> There is a gray background color defined in
>>>>>>  gui/src/org/kepler/gui/frame/KeplerGraphTableau.java
>>>>>> but that seems to control only some empty areas and the toolbox.
>>>>>>
>>>>>> Thanks
>>>>>> Norbert
>>>>>>
>>>>>>  Norbert Podhorszki
>>>>>>  ------------------------------------------
>>>>>>  Scientific Computing Group
>>>>>>  National Center for Computational Sciences
>>>>>>  Oak Ridge National Laboratory
>>>>>>  Phone: (865) 574-7159
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Kepler-dev mailing list
>>>>>> Kepler-dev at kepler-project.org
>>>>>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>>>>>>           
>>>>> -- 
>>>>> Christopher Brooks (cxh at eecs berkeley edu) University of California
>>>>> CHESS Executive Director                      US Mail: 337 Cory Hall
>>>>> Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
>>>>> ph: 510.643.9841 fax:510.642.2718             (Office: 545Q Cory)
>>>>> home: (F-Tu) 707.665.0131 (W-F) 510.655.5480
>>>>> _______________________________________________
>>>>> Kepler-dev mailing list
>>>>> Kepler-dev at kepler-project.org
>>>>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>>>>>
>>>>>         
>>>>
>>>> -- 
>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> Matthew B. Jones
>>>> Director of Informatics Research and Development
>>>> National Center for Ecological Analysis and Synthesis (NCEAS)
>>>> UC Santa Barbara
>>>> jones at nceas.ucsb.edu                       Ph: 1-907-523-1960
>>>> http://www.nceas.ucsb.edu/ecoinfo
>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> _______________________________________________
>>>> Kepler-dev mailing list
>>>> Kepler-dev at kepler-project.org
>>>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>>>>
>>>>       
>>
>>
>>
>>   
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at kepler-project.org
> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev

-- 
Christopher Brooks (cxh at eecs berkeley edu) University of California
CHESS Executive Director                      US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
ph: 510.643.9841 fax:510.642.2718	      (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 (W-F) 510.655.5480


More information about the Kepler-dev mailing list