[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Application-wide css
From:       david.grieve () oracle ! com (David Grieve)
Date:       2012-05-31 13:03:18
Message-ID: 4CED08C9-F5AA-46C6-8F87-16208CFD7397 () oracle ! com
[Download RAW message or body]

Or add a listener to Scene.sceneProperty.

        stage.sceneProperty().addListener(new ChangeListener<Scene>() {

            public void changed(ObservableValue<? extends Scene> ov, Scene t, Scene \
t1) {  t1.getStylesheets().setAll(APPLICATION_WIDE_STYLESHEETS);
            }

        });

Note that popups get their styles from the stylesheets of the scene of the window \
from which the popup was shown. 

On May 31, 2012, at 4:38 AM, Werner Lehmann wrote:

> Hi David,
> 
> thanks. I can live with that but it was worth a question.
> 
> To explain the background, lets assume I wanted to style all my buttons in all \
> scenes in the same way. And I don't want to duplicate the css obviously. Then it \
> would be handy to have that @import feature because it lives in the css "space". I \
> guess you could say it is personal preference to rather do it in css, not in java. \
> By the way, I am going to have lots of scenes because we are in the process of \
> migrating a largish Swing application, replacing bits and pieces with JFXPanels. 
> Maybe I should subclass Scene, Popup, ContextMenu (etc) to add such an \
> application-wide css by default... 
> Rgds
> Werner
> 
> On 31.05.2012 03:58, David Grieve wrote:
> > Currently @-keyword statements are ignored and StyleManager isn't going
> > to help you either.
> > 
> > I'm not sure what @import buys you over adding the application wide
> > stylesheet to the stylesheets property of Scene or Parent. I'm not
> > saying it isn't something we shouldn't have. In fact, I could use it
> > myself. But right now, ObservableList<String> getStylesheets() is all we
> > have to work with.
> > 
> > 
> > On May 30, 2012, at 8:32 PM, Richard Bair wrote:
> > 
> > > I've been waiting for David or Jasper to respond :-)
> > > 
> > > Ping!
> > > 
> > > Richard
> > > 
> > > On May 25, 2012, at 8:15 AM, Werner Lehmann wrote:
> > > 
> > > > Hi,
> > > > 
> > > > is there a way to import one css into another? This would allow for
> > > > an application wide stylesheet - to be imported by control or scene
> > > > css. Usually that's the purpose of @import but according to the css
> > > > reference, "@-keyword statements are ignored."
> > > > 
> > > > Alternatively, is it possible to do this in a central place, e.g.
> > > > with the help of StyleManager?
> > > > 
> > > > Rgds
> > > > Werner
> > > 
> > 
> > <http://www.oracle.com>
> > David Grieve | Principal Member of Technical Staff
> > Mobile: +16033121013 <tel:+16033121013>
> > Oracle Java Client UI and Tools
> > Durham, NH 03824
> > <http://www.oracle.com/commitment> Oracle is committed to developing
> > practices and products that help protect the environment


David Grieve | Principal Member of Technical Staff
Mobile: +16033121013 
Oracle Java Client UI and Tools
Durham, NH 03824 
 Oracle is committed to developing practices and products that help protect the \
environment


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic