Progress Bar with Cancel Button using SWT implementation issue [message #1619413] |
Mon, 16 February 2015 15:10 |
Anoop Singh Messages: 3 Registered: February 2015 |
Junior Member |
|
|
Dear Members,
I am new to java. I have to create progress bar and cancel button on UI. I am using SWT to create the progress bar and button both.
The functionality is that when one process is going on progress bar status will keep changing and if Cancel button is clicked, the process will stop and control will take to different screen.
Here is the piece of code written by me:
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
private Button cancel = null;
private ProgressBar progressBar = null;
progressBar = new ProgressBar(toplayer, SWT.NONE);
cancelProgress = new Button(layer, SWT.NONE);
progressBar.setBackground(new Color(null, 255, 255, 255)); // White
progressBar.setLayoutData(getFormdata(57, 05, 95, 65));
progressBar.setBounds(0, 0, 100, 100);
cancelProgress.setText("Cancel");
cancelProgress.setBackground(new Color(null, 240, 200, 120));
cancelProgress.setFont(getFont(12, SWT.BOLD));
cancelProgress.setLayoutData(getFormdata(83, 15, 89, 96));
cancelProgress.addMouseListener(new MouseListener() {
@Override
public void mouseUp(MouseEvent arg0) {
}
@Override
public void mouseDown(MouseEvent arg0) {
cancelProgressClicked = true;
}
@Override
public void mouseDoubleClick(MouseEvent arg0) {
}
});
But I am facing one problem. On the screen "Cancel" button doesn't recognize any event. While Progress Bar is working fine. Even when i take cursor on "Cancel" button no action is seen and also no action on click.
Could anybody please solve this issue? Looks something silly i am doing but this is very critical. Thanks in advance.
With regards,
Anoop.
|
|
|
|
Powered by
FUDForum. Page generated in 0.87995 seconds