I have a java fxml file with some controls in it. I want to change the style of them by using my custom css file. So I use Scene Builder and loaded the css file. It worked. But when I make changes on the css the controls on the scene builder do not respond to them. Furthermore reverting (deleting or commenting out) the changes on the css file and reloading it on the fxml through scenebuilder results in making changes to the style, the ones I had commented out or deleted. Does it use any cache, should I close and reload scene builder?
I have done some javaFX(1.x 2.x 8.x) applications without scene builder before. Today I started to use it (GLUON JavaFX Scene Builder 8.0.0) just to get what is it, because have some more javaFX tasks.
I found similar problem. I spend two hours just to attach css file to simple GridPane, and cannot do this :(. I opened my recent project fxml, and builder cannot open it, while I remove project specific import from it... (It shows error and exceptions stack trace, so I spend some time to found out why it occurs). After I fix that, my old project FXML opened scene and applied style from css (there were just colors, no images or other resources was used).
Every time I changed css - scene builder shows that it found changes, but not render them... cool, right? Even though I preview from menu.
Total: Every time you change css you should reopen fxml.
Related
JavaFX Entry
I just installed JavaFX for Eclipse; and so far, it's working. When I want to edit the CSS Stylesheet, there is for every file the message: "Unknown Property"—with the yellow sign.
What need I to do in this case? I think JavaFX should be installed corectly, because all other is working.
I am putting styles in CSS file and import it correctly in fxml file, but styles are not showing in scene builder. But when I run the app all the styles are applied correctly. I am using intelijIdea Can someone please help me
I know this is old, but I believe certain names aren't picked up on, it seems.
For example, when I use the name, "content" for a class, or "title", those classes will not show up in the list of available class styles to apply to components. This seems like a silly, arbitrary thing to not even remotely document, but as far as I can tell, that was my issue.
I've been at this problem trying to find workarounds for weeks now and I am starting to give up. I must be doing something fundamentally wrong. Anyway, this is my situation. I have previously made a neat little program using JavaFX but have now discovered Scene Builder and want to build it all again using this tool. The project includes several components that are frequently reused such as the one below. This is made up of a label, a slider, a text field and another custom component, an InfoIcon.
I have understood that the done thing is to import the custom component (the InfoIcon) as a .jar file into Scene Builder when building my SliderVariable as I call it. This works great and I can run a small demo of my SliderVariable from within Eclipse by creating a main method, a scene and making a SliderVariable in this scene. As mentioned this works great. Importing or Including the InfoIcon does not do what I want (I don't think) because then I cannot easily make changes to the InfoIcon (or its controller) and update my SliderVariable and then see the effects in the final product.
The problems arise when I want to take it one step further and in turn use my SliderVariable in Scene Builder. I do as with the InfoIcon. I export my slider variable to a non-executable jar and then import it into Scene Builder. Here Scene Builder complains that it cannot find any UI components and thus fails to import it. I have discovered that this is because when I export the SliderVariable as a jar it does not also package its dependencies meaning the InfoIcon doesn't get bundled with it and that the compiler cannot find this component as I try to use it.
I have tried to solve this with FatJar which I cannot get working (and it seems like it is not in use any more). I have tried Maven where I couldn't import the Maven project dependency of the InfoIcon in the FXML of the SliderVariable. Finally I have also tried simply not importing a jar but instead including the source code of InfoIcon in a separate package of SliderVariable but then I couldn't import it into my FXML. I am desperate. What do people normally do if they want to reuse custom components with their own controllers in Scene Builder? Is this even done? Should I just give up :'(?
This unwieldly post must be highly confusing but I do not know how to make it clearer. Any sort of response would be greatly appreciated and if you do not believe this forum is the right place to post something like this (which it probably isn't) please point me to someplace else where I am more welcome.
Many thanks.
EDIT 1: I have now added a folder in my project called Dependencies. In here I put a copy (not a reference to) my InfoIcon.jar.
I then add this .jar file to my Build Path and remove the old one. I then enter SceneBuilder and reimport the InfoIcon jar but this time from the Dependencies folder I just created. At this point the small project test I've made still runs fine. I then export as JAR file with the following settings and hit finish.
I then try to import it into Scene Builder and Scene Builder tells me it cannot find any UI components.
EDIT 2: Should I select these items?
Note that the jar file is in Dependencies but also in Referenced Libraries (which is not visible here). This type of selection makes it so that Scene Builder can find and Import the InfoIcon but not the SliderVariable.
When you export InfoIcon, you can simply select the packages and classes related to it in the Eclipse's package explorer (or other similar explorer views), and choose export.
Similarly, when you try to export SliderVariable control, you need to choose everything you have selected in InfoIcon, on top of other files that are needed by SliderVariable control itself.
If InfoIcon is imported into SliderVariable project as a JAR file, then you would need to manually select that JAR file during the export of SliderVariable.
After switching to Apache Flex 14, I tried to implement the Flatspark theme by adding this kind of rules to my CSS :
s|Panel
{
skinClass: ClassReference("flatspark.skins.PanelSkin");
}
To make the SDK work with Flash Builder 4.6, I changed the SDK description file. From here, everything's fine.
I was able to see the new theme, create component in the design view and edit already existing MXML files.
But after restarting Flash Builder, I've got this little icon in the design view :
I cannot see or edit an existing file.
The design view works again after removing the theme from the CSS rules.
Why did it works the first time and now only display this when I add a custom CSS rule to change the skinClass parameters ?
Design view has never really worked correctly for any use case that is even remotely complex.
This is why it was removed in the next version (Flash Builder 4.7).
So i decided to implement some themes in my AIR app. I have converted my CSS files into SWF files, removed the Style linkage from my main file. Based on the user preferences stored in a file, I decide which theme to use. i.e; load the SWF file using StyleManager class.
I made my application window invisible, added a StyleEvent.COMPLETE event listener for the IEventDispatcher object returned by StyleManager.loadStyleDeclarations method. After the StyleEvent.COMPLETE occurs, I made my main window visible.
The problem i have now is, for a few seconds, i can see white canvases and all my components without any styles before using the style selected. I want to know if my approach is correct or do I need to make any changes to implement this properly?
Alright, so I seem to have figured it out myself. Getting some help from this link albeit.
Previously i read the settings in my applicationComplete and loaded the styles. So i guess all the UI components were created and added to the display list. They were bare naked without any style values.
So i changed the reading of the settings file to preinitialize, so that by the time the applicationComplete is triggered, AIR has already loaded the SWF stylesheet. So it will display the UI as i wanted.