Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[swtbot-dev] swt radio buttons


Hi,

I want to have two buttons that displays different pictures. when I
choose the first radio button my picture appears but when I choose the
second one after my second picture will not appear?

Here is my code:

 final Button buttondog= new Button(c1, SWT.RADIO);
   buttondog.setText("dog");
   buttondog.setBounds(10, 20, 169, 21);

   final Button buttoncat= new Button(c1, SWT.RADIO);
   buttoncat.setText("cat");
   buttoncat.setBounds(10, 50, 169, 21);

   buttonradio.addListener (SWT.Selection, new Listener () {
  public void handleEvent (Event event) {
   buttoncat.setSelection(false);
   buttondog.getSelection == true;
   img = new Label(page1, SWT.TOP);
   img.setBounds(300, 100, 992, 568);
   img.setImage(SWTResourceManager.getImage("dog.jpg"));
   img.setVisible(true);
  }
  });



 buttoncat.addListener (SWT.Selection, new Listener () {
 public void handleEvent (Event event2) {
 buttondog.setSelection(false);
 buttoncat.setSelection(true);
 img2 = new Label(page1, SWT.TOP);
 img2.setBounds(300, 100, 992, 568);
 img2.setImage(SWTResourceManager.getImage("cat.jpg"));
 img2.setVisible(true);
 }
 });

Can anyone help:?
Regards,
Ann



Back to the top