OS: Windows XP Pro
Servoy version: 4.1 for smart client based application
When we create buttons the default fill color is grey. I would like to change it to white. What would be the best way to do it.
I ran a test to change using setUIProperty but that did not change the grey fill area.
application.setUIProperty(“Button.background”, new Packages.javax.swing.plaf.ColorUIResource(java.awt.Color.white));
I used another approach of attaching a style class by modifying the css but that did not work either.
button.newStyle
{
background-color:00BFFF;
}
I tested application.overrideStyle(‘oldStyle’,‘newStyle’) to see if that would help.
Is there another way of getting it done or do I need to set/unset some properties in the button to get it to work.
In normal html we can create and input button type and then set a css style to the button and the background-color would change the grey color to any particular color we like. But I am not able to get the same result when I am setting the properties for the button.
The fill color of a button is determined by the Look&Feel, you can either write your own look&feel or just disable the showClick property of the button and it will behave like any label object (and then you can use CSS to customize it).
I am using the servoy_sample_crm to test it. I added the following code to the svyWebCrm.css
button {
background-color: #00bfff;
}
I set the form properties of frm_company layout as follows form.styleName = svyWebCrm and form.styleClass = DEFAULT
I have attached pic1.jpg to show the properties set for the cancel button
I have also attached pic2.jpg to show the how it behaves on the smart client. It still shows the grey fill with the light blue at the background.
As I have to enable the cancel button’s showClick property in order to show the click effect.
Is writing a custom Look&Feel just to set the button grey fill to white fill the only option. If yes any pointers on what resources are available out there for me to create a custom Look&Feel.
Writing a Look&Feel only for this is an overkill IMO, why don’t you just disable the “showClick” property of the buttons? Then you can apply any CSS or use images as buttons, you only lose that 3d feeling of the default buttons.
As its a kiosk based application It needs to have the button 3d feel. We initially had it that way but we had to revert it back to buttons in order to get that feel.
So it works. Would it be possible for you to send me the exported sample solution. I would like to import it and see what exactly the problem is on my end.