PDA

View Full Version : How to change button background color



babyblue
20 Jul 2010, 2:11 PM
I'm trying to implement a simple color picker:


Button colorButton = new Button("");
ColorMenu colorMenu = new ColorMenu();
colorMenu.getColorPalette().addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
System.out.println(((ColorPalette) be.getComponent()).getValue());
}
});
colorButton.setMenu(colorMenu);
colorButton.setStyleAttribute("background-image", "none");


I understand that buttons have a background image set by the default css, I tried to overwrite it but didn't seem to do anything.

oxyrox
20 Jul 2010, 10:36 PM
Hi babyblue,

Here (http://www.sencha.com/forum/showthread.php?94619-CSS-Button-problem&p=489103#post489103) I posted a little tutorial how I created a custom button with its own style.

Maybe this helps to solve your problem.

Greets,
oxy