Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Swing (SWT_AWT) and focus management (tab) problem
Swing (SWT_AWT) and focus management (tab) problem [message #461292] Tue, 20 September 2005 14:56
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Hello,
Focus management doesn't work in Swt swing control
I make simple snippet and tab do nothing
Is it bug ?

example :

package demo;

import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Panel;

import javax.swing.JLabel;
import javax.swing.JRootPane;
import javax.swing.JTextField;

import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class SwtSwingSnippet {

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

Composite composite = new Composite(shell, SWT.NO_BACKGROUND |
SWT.EMBEDDED);

try {
System.setProperty("sun.awt.noerasebackground","true");
} catch (NoSuchMethodError error) {}

/* Create and setting up frame */
Frame frame = SWT_AWT.new_Frame(composite);
Panel panel = new Panel(new BorderLayout()) {
public void update(java.awt.Graphics g) {
paint(g);
}
};
frame.add(panel);
JRootPane root = new JRootPane();
panel.add(root);
java.awt.Container contentPane = root.getContentPane();

JLabel label1 = new JLabel("Text 1");
JTextField field1 = new JTextField(10);
JLabel label2 = new JLabel("Text 2");
JTextField field2 = new JTextField(10);

contentPane.setLayout(new GridLayout(2,2));
contentPane.add(label1);
contentPane.add(field1);
contentPane.add(label2);
contentPane.add(field2);

shell.setSize(200,70);
shell.open();
while(!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}
Previous Topic:Query for positioning the views
Next Topic:FocusListener and mouse
Goto Forum:
  


Current Time: Mon Sep 16 11:11:57 GMT 2019

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

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

Back to the top