Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Focus problem on Mac
Focus problem on Mac [message #444671] Wed, 20 October 2004 09:46
xxx is currently offline xxxFriend
Messages: 6
Registered: July 2009
Junior Member
Sorry I forgot to add the example code in my previous post :

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
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 TestFocusLost {

private static Display display;
private static Shell shell;

public static void main(String[] args) {

display = new Display ();
shell = new Shell (display);

GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
shell.setLayout(gridLayout);

Text text = new Text(shell, SWT.BORDER);
text.setText("text 1");
text.setLayoutData(new GridData());
text.addFocusListener(new TestFocusListener(text));


Text text2 = new Text(shell, SWT.BORDER);
text2.setText("text 2");
text2.setLayoutData(new GridData());


Button button = new Button(shell, SWT.PUSH);
button.setText("Click here");
button.setLayoutData(new GridData());

shell.pack();
shell.open();

while (!shell.isDisposed ()) {
if (!display.readAndDispatch ())
display.sleep ();
}
display.dispose ();
}
}

import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.widgets.Text;

public class TestFocusListener implements FocusListener {

private Text text;
public TestFocusListener(Text text) {
this.text = text;
}

public void focusGained(FocusEvent event) {
}

public void focusLost(FocusEvent event) {
System.out.println("focusLost " + this.text.getText());
}
}
Previous Topic:Remove Ok / Cancel in Dialog
Next Topic:Label Flashing
Goto Forum:
  


Current Time: Thu Oct 29 11:48:03 GMT 2020

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

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

Back to the top