I have started to work with gBUI to build the GUI for my jMonkey-Application. It works well and I really like that you can style the gui-elements by using bss. The one thing that doesn't work though are custom style classes. I defined them in the stylesheet which I assigned to my BuiSystem and I see that this stylesheet is being loaded when I debug the application and set it to my element or try to use the preset style classes from the BTitledBar for instance. It doesn't seem to load and apply my bss.
Since there is not much documentation right now I'm kind of lost and need some help.
Have you seen this:
It's far from complete, but hopefully better than nothing. I've currently abandoned it so I can feel like I'm actually working on my game, but I do intend to come back to it.
In the meantime:
- Make sure you're loading the bss you think you're loading. If you've made a copy to the bin directory, make sure you copy any changes you make. Do something simple (like modify the text color) of a styleclass to be sure you're looking at the right place.
- If you're trying to use a custom styleclass, are you calling setStyleClass on the object you want it to apply to?
- Yes, everything is as I want it to. I can make changes for e.g. button and it changes all buttons, but I can't use custom classes…
- Yes, I'm applying to the right objects…
Hmm. So much for the simple explanation…
Maybe some code snippets:
- Creating the component and setting the style class
- The custom style description from the bss
- A screen-shot or description of what the component looks like
This is where I set the style class:
loginWindow = new BWindow(Window.LoginWindow.name(),StyleLoader.loadStyleSheet(Style.loginWindow),new BorderLayout());
This is the style:
border: 1 solid #FF0000;
background: solid #00FF00;
And this is the result:
Interesting… That's definitely different syntax than I use, which may be important, because I found out that the different ways of initializing the BuiSystem seem to have different results.
Anyway, I can't find any reference to StyleLoader in my code: is that a custom class of yours? How I've used it is like this:
BuiSystem.init(new PolledRootNode(Timer.getTimer(), _inputHandler), "/heavylead/gbui/style2.bss");
BWindow window = new BWindow(BuiSystem.getStyle(), new AbsoluteLayout());
This uses the "window" style defined in style2.bss and everything seems to work well. However, I did do a test once where I defined a custom style ("buttontest"), and a call like:
worked like I was hoping.
I've got to think that the reason is works for me, but not for you is somewhere in the difference between how we're initializing the BuiSystem, and how we're creating components and using the styles. If you try the syntax I'm using, I'd be curious to know the results.
Sorry I can't help more.
Well the StyleLoader is my own addtition. It just loads the right file according to the enum. But when I exclude it and do the style loading the "official" way it doesn't change anything.
Thank you for your help anyway.
I figured it out. Not case-sensitive …
Sorry guys. I don't know how I missed this entire thread. I don't log in one day…
@mjsimpson: I could give you access to the svn and gbui project if you wanted to put those pages up on the google code project. I hadn't even see those wiki pages. Nice beginning. I'll go through them today.
@karl: let me know if you have any other questions.
My question on this is regarding StyleLoader. Is StyleLoader doing the same things that BStyleSheetUtil doing (com.jmex.bss.) or do you some different things with StyleLoader that BStyleSheetUtil doesn't do? If StyleLoader is doing different things, would they be worth putting into BStyleSheetUtil?
Sorry for the delay getting back to you: I was concentrating on making some progress on my code. Now I've done that and I'm happy enough with it's current state to work on the tutorial again. I've pulled it into a Word document so I can organize the content and format easier than I can in the Wiki. Once I've got it done, I'll work on putting it back into the Wiki format, and I'll probably be looking for your help to host a zip of my example code.
@mjsimpson: I am more than willing to give you access to the project. You're doing an amazing amount of work. You can certainly contribute directly if you wish. But I'll host for sure. just let me know