Styling of controls does'nt work  programmatically

Hallo,
     I have a stylesheet (mystylesheet.css) with following entry:
.flowpane{
    -fx-background-color: rgb(0,0,0);
in then start-method of my application I execute:
        StackPane root = new FlowPane();
        Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
        scene.getStylesheets().add(css.getFile());
        root.applyCss();
no FlowPane gets black. But if I do that in SceneBuilder and add the stylesheet to root than after loading Fxml-file the FlowPane gets black.
Another approach:
        StackPane root = new FlowPane();
        Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
        scene.getStylesheets().add(css.getFile());
        root.getStyleSheets().add(css.getFile());
        root.applyCss();
Nothing happens.
        StackPane root = new FlowPane();
        Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
        scene.getStylesheets().add(css.getFile());
        root.getStyleSheets().add(css.getFile());
        root.getStyleClass().add("flowpanel"); 
        root.applyCss();
Does'nt work too;
but root.setStyle("-fx-background-color: rgb(0,0,0) works. But I need to style my application by css-files.
What I'm doing wrong?
with regards
Rafal Ziolkowski

The way I usually add stylesheets to a scene for simple programs that aren't using FXML is to invoke the following line from the application:
scene.getStylesheets().add(MyApplication.class.getResource("mystyles.css").toExternalForm());
Where mystyles.css is placed in the same directory as your Java source file and the project build process copies it to your project output directory (e.g. it will be copied to the same location as the application class file).  Optionally the build process can package the app up into something like an executable jar file.  So if you build is doing that you can unjar the jar file and check that your css is in there in the correct location next to your main application class.
I have no idea what css.getFile() is in your code, so it is impossible to comment on what that may do.  It is usually best for questions like this to provide a complete minimal executable that somebody could just copy and paste to run.  Also if there is any stack trace generated, then you should include the complete stack trace in your question.

Similar Messages

  • Downloaded ios7 to my iphone4s and now my volume control does not work 99 % of the time. what can i do to solve the problem

    I downloaded ios7 to my iphone and now my volume control does not work 99% of the time. Is there something I need to do to correct this?

    Adjust the Volume Control in Control Center, or try a RESET.............

  • Mission Control does not work!!!!!!!!

    Hi all,
    I have recently Reformatted my mac and made it into 1 partition of 500gb just to run mac os x. I did it with the discs the laptop came with.
    After OSx install was complete, I ran the os x lion downloaded from the app store and installed it too. After completely updating the system with software updates and my other software like ms office, vlc, flash, iLife etc.
    I have found that the mission control does not work sometimes. It allows you to swipe from screen to screen but when when you swipe up.. It hides the top apple bar but nothing else happens.. Everything else is fine so far.
    When I turn my mac on. If it gets stuck the only way to make it work again is to restart. Which is a bit annoying.. Plz tell me if it's a bug or something.
    If that happens to someone else as well?
    Thanks

    Does it work ok if you create a new user?
    To create a user account:
    Choose Apple menu > System Preferences and click Users & Groups. Click the lock icon to unlock it, and type an administrator name and password.
    Click the Add button below the list of accounts, choosing a type of account Standard is fine) from the New Account pop-up menu.

  • Keyboard volume control does not work

    I have an iMac G5, running OS 10.5.8, and a new Apple Keyboard with Numeric Keypad. My keyboard volume control does not work. Any have ideas as to why ? (I have a similar set-up at work with no volume problems.)

    Try system prefs/keyboard/keyboard/ and uncheck Use all F1, F2 etc as standard function keys.
    Other wise the volume and brightness controls will only work if you hold down the function key first (fn)

  • 2002 G3 600 mhz iMac display stays dim with an unidentified sign displayed.  The contrast control does not work.

    My display screen is dim and the contrast control does not work.  There is a sign on the screen that I have been unable to identify.  It is a white circle outline with a half moon solid circle within it.  Does anyone know what's wrong?

    There is a sign on the screen that I have been unable to identify.  It is a white circle outline with a half moon solid circle within it
    That would be a screen contrast symbol     
    My display screen is dim and the contrast control does not work.
    Did you reset the PRAM? http://support.apple.com/kb/ht1379 And the pram battery may need to be replaced if it is over 3 years old it is under the iMac under the ram cover and there is a little button in there to reset the pmu as well. you have to have it pluged in when you do a pmu reset. there is a lot more stuff to try before the worst case scenario that is a bad PAV board the Pav is what runs the monitor and if it is going bad That may be a syptom that it is haveing and they can not be fixed (Well not for under $250 and that is useing old parts because they do not make them any more) but that wood be worst case scenario. Lets just hope it just needs to be reset Try that and Keep us posted

  • My Bose SIE2i volume control does not work. (pause/play does work). This is the secone set - the apple store in Sydney replaced the firsat set that had the same problem. It was working OK and has stopped.

    My Bose SIE2i volume control does not work. (pause/play does work). This is the second set - the apple store in Sydney replaced the first set that had the same problem. It was working OK and has stopped.

    Thanks again V.K. I did check the layout, and it was listed as alphabet when I inputted the password. So that doesn't seems to the the issue.
    Just finished a truly mystifying experiment, but I put in a shorter password in the way mentioned earlier and it worked. I then systematically kept increasing the characters of that password and it seems that if the password starts to exceed about 16, it stops recognizing it. I am fairly sure it is not the password itself since it never gives an error when typing in the verification password. So unless I systematically make the exact mistake twice at the setup screen, and then don't or make a different mistake every time at the login screen, I don't think its my typing skill.
    So problem solved for now, but I am still a bit worried. Maybe I should completely reinstall and use a shorter password.
    Is there supposed to be a length limit?

  • Brightness control does not work with the bluetooth keyboard connected on my iPad2. Please someone could help me ?

    Brightness control does not work with the bluetooth keyboard connected on my iPad2. Please someone could help me ?

    Julien-
    I have the Apple MC184LL/A Bluetooth Wireless Keyboard.  The brigtness control works with mine, as do most of the other functions.
    Try cycling the keyboard off and on.  Hold the power button until the green LED goes out.  Then press it one more time to turn it back on.
    You might try resetting the iPad's network.  Go to Settings-General-Reset-Reset Network Settings.  Then you may need to reconnect your WiFi and Bluetooth.
    If that doesn't help, try resetting/rebooting the iPad.  Hold both the Home and Sleep buttons for several seconds until the Apple logo appears.  Ignore the "Slide to power off" arrow.  The iPad will restart in a couple of minutes.  Resetting this way will not hurt anything, and sometimes clears up mysterious problems.
    Fred

  • The 3 and 4 finger trackpad control does not work

    After the installation of OS 10.7, everything work well since this week. The 3 & 4 finger control does not work now. I reboot my iMac and chek the Preference of the trackpad.
    What I have to do ?

    Adjust the Volume Control in Control Center, or try a RESET.............

  • MenuBar volume control does not work

    itunes volume control DOES control the volume of my external speakers which are attached to a ProSonus FireBox.
    Website links with controls of audio DO control the volume of my external speakers which are attached to a ProSonus FireBox
    However, the main Mac MenuBar sound control slide bar does not control the sound itunes or these websites AND the MenuBar sound control slide bar does not control either my internal or external speakers.
    Sound Control panel Input Panel is set at the PreSonus FireBox (0260) device with mic setttings at mid level and the master output volume set about 1.5 units up with "show volume in menu bar" box checked and Mute box clear of checkmarks.
    The Sound Control Panel Output panel is set at Presonus FireBox (0260) with the master output volume set at 1.5 units with "show show volume in menu bar" box checked and Mute box clear of checkmarks. Controlling the slider from the Sound Control Panel DOES control the slider in the Mac MenuBar but not the sound.
    The fact that sound is coming out of the firebox indicates sound from itunes and web site sound links IS being redirected from the internal speakers to the firebox and then the firebox is redirecting the sound to the external speakers.
    However, the volume control at the mac is not sending out a lower
    signal to the firebox or the firebox is not responding to the lower signal or something else has control over the volume control.
    There are two clues. The volume control of itunes DOES work and the manual control of the Firebox is working.
    Another interesting observation is that the "Sound Effects" panel of the Sound Control Panel does appear to work correctly; the alerts are supposed to work through the internal speakers (as the drop down list box is selected that way) and the Master volume does limit the alert volume. But I find it interresting that the Master volume is coupled to the internal speakers when the Master Volume should be coupled to the firebox (and then through to the external speaakers).
    osx: 10.5.2
    Imac G5
    Burr Brown PCM3052
    presonus FireBox
    mdl: 0x10000
    GUID: 0xA9200D7030104
    software version: 0x10001
    unit spec ID: 0xA02D

    Hi stoye-
    You cannot control the volume of the digital signal. The presonus converts the digital signal to analog and the volume control is done there.
    Luck-
    -DP

  • UrBeats controler does'nt work

    Hi I just bought some urBeats. When I plug it in my Ipod the sound is fine, but the controler for volume and play/pause does'nt work at all. I tryed it on my friends Samsung Galaxys and the play/pause worked.
    Is it my Ipod or the urBeats ?

    Have you went to urBeats support site/contacted them?
    You can try:
    - Reset the iOS device. Nothing will be lost      
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Unsync/delete all music and resync
    - Reset all settings                            
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                               
    iOS: Back up and restore your iOS device with iCloud or iTunes      
    - Restore to factory settings/new iOS device.                       

  • IPhone 3Gs Voice Control does not work

    Purchased IPhone 3Gs 32g beside having no service were I live (AT&T is building a cell tower about a mile from my house) my Voice control only works about 1% of the time. For the Ipod I usually get some kind of error message “like listing not found” when it does find an album or artist it always the same one. I am sick of hearing Santana. For call when I do get a signal I also usually get an error message or if it works it pick on of my doctors and that’s it.
    Went to the Genesis bar and they said it was a software problem, they gave me a new IPhone with my old sims card, but the did not test the new IPhone Voice control in the store because there were on contacts or albums in the memory.
    Got home synced the new one and guess what same exact problem. I have read and tried everything on the internet and nothing has worked any ideas or suggestions ? Please help I tired of listing to Santana and calling Dr. Aronald.

    There's a few things you can try that might help out.
    No. 1 Make sure your genius results are updated. If you're saying "Play music like Snoop Dogg" it's going to try to make a genius playlist, and that might be why you have no results found.
    No. 2 Speak slower. This might sound kinda dumb, I'm not trying to be a smartass. I found that my voice command worked 200% better when I spoke just a little bit slower. Not sure why exactly, but the difference was night and day.
    No. 3 When calling someone (on purpose of course) it helps to sometimes add "mobile" at the end if the number is listed as mobile in your contact book. Usually you only need to do this if the contact has more then one number, but it helps even if they don't just to eliminate any ambiguity from the voice command.
    Hope that helps!

  • Changing icons & Controls does not work- Help needed

    When changing the theme in "theme preferences" only the window borders change... The icons and window controls remains as the same boring default.
    Does anybody have a solution to the problem?

    kapelrud wrote:
    Oh, sorry... I just had to forget that
    I use gnome 2.8 as my DE
    Update: A nice little reboot fixed the problem. It may have been because I added fam to the startup...
    i always use ... "switch" and "switch2" from pacman.  they're small programs to switch gtk/gtk2 themes... I don't have the whole gnome package so that works well for me.

  • IPhone 3GS with iOS4 - voice control does not work any more

    Hi - I updated the OS of my iPhone 3GS to iOS4 and everything went well. But ever since I did the update the voice control comes back with strange results when I try to use it. It was working well enough with OS3. Has anybody the same problems and is there a solution?
    Thanks,
    Klaus

    I'm experiencing basically the same as teardrop3d. I'm Australian (with voice settings on English (Australian)) and my 3Gs had at least 90% accuracy with both calls and music requests.
    On iOS4 I've had a single correct result out of at least 30 attempts at using it.
    Requesting "play playlist <name>" will often either start calling a seemingly random person from my phone book (different each time anyway) or sometimes a seemingly random number (I don't know where the number comes from, it's not in my phone book). Sometimes it'll actually offer to play music, usually a specific artist (not a playlist) and occasionally a playlist (but so far never the right one).
    Requesting "call <name> <number type>" has worked once correctly, but usually just tries to call a seemingly random number from my phone book (or a number I don't know, not in my phonebook...).
    As teardrop3d notes, the voice control screen stays up for about 2-4 seconds after I finish talking. It doesn't seem to be recording during this time, as the waveform stops responding to my voice but the screen sits there (with words moving past in the background still) as if its waiting for me to keep talking.
    I've tried talking in different accents to no avail, and didn't get any better results with a different English language setting on the Voice Control (I'm not sure if that's actually listening for different accents or just responding in a different accent?)
    This feature which I used to use multiple times a day to avoid having to take my phone out of my pocket while walking/riding is now useless. I continue to test it each day to see if it ever works, or if there are any behaviours that change it (e.g. locked vs unlocked or with music playing/not playing when I press/hold the mic-button, etc) but so far haven't found any workarounds.

  • Remote control does not work with DVD player.

    I have a HP Pavilion DV6135nr, the remote control came with the computer, its a RC6. I can not get the computer to recognize the remote control.

    Have you tried if this remote works with any other HP notebook? if not, have you replaced the battery on the remote to check its not a battery issue on the remote?
    Although I am an HP Employee, I am speaking for myself and not for HP.
    Make it easier for other people to find solutions, by marking my answer “Accept as Solution” if it solves your problem.

  • Time access control does not work

    I set up the time access control for my kids devices, but they can still access the internet.

    Several possibilities exist:
    1) The Timed Access entries are not being set up correctly. Have you tested each device yourself?
    2) The kids are smart enough to know how to work around the settings
    3) The kids know how to get on another nearby wireless network.
    Regarding 2) and 3), there are numerous popular sites on the Internet that kids visit that provide them with tips and techniques to get around security on popular routers, so that possibility may be more real than you might imagine.
    Regarding 1), we may be able to help, as there are two basic ways to set up Timed Access.....one being quite a bit more secure than the other. Unfortunately, this means a more time consuming and tedious set up.

Maybe you are looking for

  • PDF print Cocoon problem

    Hello! I use Apex + Tomcat + Cocoon + fop_post from Carl Backstrom's Blog [http://carlback.blogspot.com/2007/03/apex-cocoon-pdf-and-more.html]. Printing reports is possible, but printing big reports, with a lot of data in a cel,l doesn't work. Trying

  • HELP songs dissapearing on my iPod...

    every time i try and sync my ipod or put songs on my ipod i keep getting error messages saying the ipod cannot be sycned , an unkown error occured (-48) And ive had other numbered errors coming up too ... my ipod is a 5th gen 30GB video ipod and only

  • Network Manager Can't Connect Wirelessly

    Hi everyone, I'm trying to migrate from Connman to Network Manager for my network needs (as well as from e17 to xmonad) and I'm seeing some strange behavior. I can get the network manager applet running, but it won't connect to any wireless networks.

  • OSB proxy services:singleton?

    Are OSB proxy services singleton in nature! That means if 10 requests are fired for the proxy, does only one instance of proxy service process them one by one or multiple instances will process requests in parallel?

  • Can we use two costing variants for standards cost estimate release.

    Hi, We have 2 plants (plant 5100 and plant 5200) under company code 5000. We have run standard cost estimate(CK11N) for material 98001000027 at plant 5100 using costing variant ZG01 and at plant 5200 using costing variant ZG02. First, we released  st