Java/GWT/RadioButton

Материал из Java эксперт
Перейти к: навигация, поиск

Use RadioButtonGroup

package com.jexp.gwt.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.HorizontalPanel;
public class GWTClient implements EntryPoint {
  public void onModuleLoad() {
    RadioButton radio0 = new RadioButton("group0", "Choice 0");
    RadioButton radio1 = new RadioButton("group0", "Choice 1");
    RadioButton radio2 = new RadioButton("group0", "Choice 2 (Disabled)");
    RadioButton radio3 = new RadioButton("group0", "Choice 3");
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(8);
    hp.add(radio0);
    hp.add(radio1);
    hp.add(radio2);
    hp.add(radio3);
    radio2.setEnabled(false);
    
    RootPanel.get().add(hp);
  }
}