Hey,
ich habe ein Problem mit dem Tabbing in diesem Frame.
Ich möchte mit TAB zwischen den textfeldern wechseln, es tut sich aber leider nichts..?
ich hab diese
frame.setFocusTraversalKeysEnabled()
methode gefunden, aber irgendwie klappt das nicht...
hoffentlich hat einer von euch eine Idee...
bis dann!
ich habe ein Problem mit dem Tabbing in diesem Frame.
Ich möchte mit TAB zwischen den textfeldern wechseln, es tut sich aber leider nichts..?
ich hab diese
frame.setFocusTraversalKeysEnabled()
methode gefunden, aber irgendwie klappt das nicht...
hoffentlich hat einer von euch eine Idee...
bis dann!
Code:
import java.awt.Frame;
import javax.swing.JTextField;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class SimpleFrame extends Dialog {
private Shell dialogShell;
private Composite composite1;
private JTextField tf1 = new JTextField("asdasd");
private JTextField tf2 = new JTextField("asdasd");
private JTextField tf3 = new JTextField("asdasd");
private JTextField tf4 = new JTextField("asdasd");
private Frame frame1;
public static void main(String[] args) {
try {
Display display = Display.getDefault();
Shell shell = new Shell(display);
SimpleFrame inst = new SimpleFrame(shell, SWT.NULL);
inst.open();
} catch (Exception e) {
e.printStackTrace();
}
}
public SimpleFrame(Shell parent, int style) {
super(parent, style);
}
public void open() {
try {
Shell parent = getParent();
dialogShell = new Shell(parent, SWT.DIALOG_TRIM
| SWT.APPLICATION_MODAL);
dialogShell.setLayout(new GridLayout());
composite1 = new Composite(dialogShell, SWT.EMBEDDED);
composite1.setLayoutData(new GridData(500,270));
frame1 = SWT_AWT.new_Frame(composite1);
frame1.setLayout(new java.awt.GridLayout(2, 2));
frame1.add(tf1);
frame1.add(tf2);
frame1.add(tf3);
frame1.add(tf4);
dialogShell.pack();
dialogShell.open();
Display display = dialogShell.getDisplay();
while (!dialogShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}