Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » push button on the same composite of radio group is getting focus for arrow keys(push button on the same composite of radio group is getting focus for arrow keys)
push button on the same composite of radio group is getting focus for arrow keys [message #1063079] Wed, 12 June 2013 03:48
Eclipse UserFriend
Push button with a group of radio buttons on the same composite getting focus for arrow keys which is supposed to be used for selecting an option from radio group.

can we prevent this for PUSH button from getting focused to arrow keys. Is there any way ??

Here is the sample code .


import org.eclipse.swt.SWT;

import org.eclipse.swt.widgets.Button;

import org.eclipse.swt.widgets.Display;

import org.eclipse.swt.widgets.Shell;

import org.eclipse.swt.widgets.Text;

public class SWTButtons {

public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell(display);

//radio
Button[] radioButtons = new Button[3];
radioButtons[0] = new Button(shell, SWT.RADIO);
radioButtons[0].setSelection(true);
radioButtons[0].setText("Choice 1");
radioButtons[0].setLocation(50,150);
radioButtons[0].pack();

radioButtons[1] = new Button(shell, SWT.RADIO);
radioButtons[1].setText("Choice 2");
radioButtons[1].setLocation(120,150);
radioButtons[1].pack();

radioButtons[2] = new Button(shell, SWT.RADIO);
radioButtons[2].setText("Choice 3");
radioButtons[2].setLocation(190,150);
radioButtons[2].pack();
//Text
Text textBox = new Text(shell, SWT.BORDER);
textBox.setText("Test");
textBox.setLocation(260, 150);
textBox.pack();

//push button
Button pushButton = new Button(shell, SWT.PUSH);
pushButton.setLocation(100, 250);
pushButton.setText("Get Value (push button)");
pushButton.pack();


shell.setSize(500,500);
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
Previous Topic:NoSuchMethodError
Next Topic:Need to click Save All twice in juno
Goto Forum:
  


Current Time: Mon Jun 23 15:38:05 EDT 2025

Powered by FUDForum. Page generated in 0.03159 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top