Example usage for org.eclipse.swt.widgets Button getBackground

List of usage examples for org.eclipse.swt.widgets Button getBackground

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Button getBackground.

Prototype

public Color getBackground() 

Source Link

Document

Returns the receiver's background color.

Usage

From source file:MouseTrackExample.java

public MouseTrackExample() {
    d = new Display();
    s = new Shell(d);

    s.setSize(250, 200);/* w  w w .ja  v  a  2s .  co m*/

    s.setText("A MouseTrackListener Example");
    final Button b = new Button(s, SWT.PUSH);
    b.setText("Push Me");
    b.setBounds(20, 50, 55, 25);
    s.open();
    final Color oldColor = b.getBackground();

    b.addMouseTrackListener(new MouseTrackAdapter() {
        public void mouseEnter(MouseEvent e) {
            b.setBackground(new Color(d, 0, 153, 153));

        }

        public void mouseExit(MouseEvent e) {
            b.setBackground(oldColor);
        }
    });

    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.dispose();
}