/**
* @ Param ARGs
*/
Public static void main (string [] ARGs ){
// Todo auto-generated method stub
Display display = display. getdefault ();
Shell shell = new shell (Display );
Shell. setsize (200,200 );
Shell. setlayout (New filllayout (SWT. Horizontal ));
Showradiobutton (Shell );
Shell. open ();
While (! Shell. isdisposed ())
{
If (! Display. readanddispatch ())
{
Display. Sleep ();
}
}
Display. Dispose ();
}
Public static void showradiobutton (shell)
{
// Only one button can be selected among the buttons
// Single-choice button. When creating an object, you must specify the parent class to which the button belongs.
// Set a single-choice button to the selected state by Bt. setselection (true)
// The method used to determine whether a button is selected is Bt. getselection ();
// The first radio button
Group group1 = new group (shell, SWT. shadow_etched_out );
Group1.setlayout (New filllayout (SWT. Vertical ));
Group1.settext ("this is a set of styles ");
Button Bt1 = new button (group1, SWT. Radio | SWT. Left );
Bt1.settext ("SWT. Left ");
Bt1.settooltiptext ("SWT. Left ");
Button bt2 = new button (group1, SWT. Radio | SWT. Right );
Bt2.settext ("SWT. Right ");
Bt2.settooltiptext ("SWT. Right ");
Button bt3 = new button (group1, SWT. Radio | SWT. center );
Bt3.settext ("SWT. Center ");
Bt3.settooltiptext ("SWT. Center ");
// This is the second radio button.
Group group2 = new group (shell, SWT. shadow_etched_out );
Group2.setlayout (New filllayout (SWT. Vertical ));
Group2.settext ("this is another set of styles ");
Button bt4 = new button (group2, SWT. Radio | SWT. Flat );
Bt4.settext ("SWT. Flat ");
Bt4.settooltiptext ("SWT. Flat ");
// Set the initial status
Bt4.setselection (true );
Button BT5 = new button (group2, SWT. Radio | SWT. Border );
Bt5.settext ("SWT. Border ");
Bt5.settooltiptext ("SWT. Border ");
Button bt6 = new button (group2, SWT. Radio );
Bt6.settext ("SWT. Radio ");
Bt6.settooltiptext ("SWT. Radio ");
}