Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] swt radio buttons

Sorry I did was editing my code before I sent it. Where 'page1' is in my actual code I have 'c1':
this is the proper 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.setSelection( true);
   img = new Label(c1, 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(c1, SWT.TOP);
 img2.setBounds(300, 100, 992, 568);
 img2.setImage(SWTResourceManager.getImage("cat.jpg"));
 img2.setVisible(true);
 }
 });'
 
Do you know what could be causing this to happen?
 
Regards,
Ann
On Wed, Jul 27, 2011 at 2:51 PM, Brian de Alwis <briandealwis@xxxxxxxxx> wrote:
You have to relayout "page1".  Or its parent.

On 26-Jul-2011, at 3:30 PM, Ann Smith wrote:

> Hi again,
>
> I am having a problem! (whats new!!)
> 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
> _______________________________________________
> e4-dev mailing list
> e4-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/e4-dev

_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev


Back to the top