mgarin / weblaf

WebLaF is a fully open-source Look & Feel and component library written in pure Java for cross-platform desktop Swing applications.
http://weblookandfeel.com
GNU General Public License v3.0
1.14k stars 235 forks source link

Missing methods #645

Closed krischik closed 4 years ago

krischik commented 4 years ago

I wanted to the libraries I use in my project up to date and noticed that several methods disappeared:

Tried to search the website and the release notes but I didn't find mentioning. What happened to them?

Martin

mgarin commented 4 years ago

Methods that you mentioned (as well as all other style-related methods in components) have been removed starting with v1.2.9 update. A much more advanced styling system was introduced to replace all those methods. I recommend reading introduction article about the new styling system which is available on wiki: Styling Introduction

New styling system is more complicated to get started with, but it gives you full control over how component look like, down to every detail. It also allows you to easily integrate your custom visual pieces into existing components if necessary.

krischik commented 4 years ago

This looks indeed very difficult. And upgrade guide explaining how to each deleted method maps to one of the XML tags would have been nice.

mgarin commented 4 years ago

I will be adding some more tutorials for the styling in the future, but I don't think that covering 1 to 1 transition is necessary. All the methods you've mentioned in the question are fairly easy to find counterpart for by just looking at the styles available in WebLaF out-of-the-box, for instance here are XML files of the light skin: https://github.com/mgarin/weblaf/tree/master/modules/ui/src/com/alee/skin/light/resources

Specifically, something like button style: https://github.com/mgarin/weblaf/blob/master/modules/ui/src/com/alee/skin/light/resources/button.xml

There are also XSDs available in the project that can be used in modern IDEs for autocompletion in style & skin XML.

mgarin commented 4 years ago

Overall - current styling system is actually a pretty simple state-based model in which you define the view of each state. After that library takes care of compiling the resulting styles together and applying them to the actual components.

Every element and attribute available in XML is represented by an object or field in the code, for instance <WebShape> is represented by WebShape.java which is an implementation of IShape. You can write and use your own implementations for specific things like shadows, backgrounds etc if you feel that existing implementations aren't working the way you want them to.

Once you understand the general concept - it should be pretty simple to get into styling. There are, of course, a lot of small nuances, but I tried to cover them all in the introduction article and I'm always ready to help if you have any questions about it.