Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Setting specific background and border colors to buttons (Adding specific colors to buttons)
Setting specific background and border colors to buttons [message #1007718] Thu, 07 February 2013 04:58 Go to previous message
K C is currently offline K C
Messages: 1
Registered: February 2013
Junior Member
We use RAP 1.2 as our GUI based engine. I have been asked to set the colors of the background (to #8FA8BF) and border(to #7B92AB) and also the text (to #FFFFFF).

I tried the following code in a sub-class of org.eclipse.swt.widgets.Button:

public class Button extends org.eclipse.swt.widgets.Button {
public Button(Composite parent, int style) {
super(parent, style);
this.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
Color buttonColor = new Color(e.display, 143, 168, 91);
e.gc.setBackground(buttonColor);

buttonColor.dispose();
}
});
}
}

Is this the right approach? In my Eclipse, when I attach the 3.5 SWT jars, then it compiles. But, when I try to compile it using our build (Ant based), which uses the RAP 1.2 plugins, then it fails to recognize PaintListener, PaintEvent and also the addPaintListener method. What am I doing wrong?
 
Read Message
Read Message
Previous Topic:Focus Issue
Next Topic:SWT Browser (IE9) F12 Developer Tools
Goto Forum:
  


Current Time: Fri May 24 06:35:18 EDT 2013

Powered by FUDForum. Page generated in 0.01647 seconds