Embeded Swing/AWT components to SWT : SWT AWT Swing « SWT « Java Tutorial

Java Tutorial
1. Language
2. Data Type
3. Operators
4. Statement Control
5. Class Definition
6. Development
7. Reflection
8. Regular Expressions
9. Collections
10. Thread
11. File
12. Generics
13. I18N
14. Swing
15. Swing Event
16. 2D Graphics
17. SWT
18. SWT 2D Graphics
19. Network
20. Database
21. Hibernate
22. JPA
23. JSP
24. JSTL
25. Servlet
26. Web Services SOA
27. EJB3
28. Spring
29. PDF
30. Email
31. J2ME
32. J2EE Application
33. XML
34. Design Pattern
35. Log
36. Security
37. Apache Common
38. Ant
39. JUnit
Java
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Tutorial » SWT » SWT AWT Swing 
17. 118. 1. Embeded Swing/AWT components to SWT
Embeded Swing/AWT components to SWT
import javax.swing.JScrollPane;
import javax.swing.JTree;

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

public class EmbedSwingAWTSWT {
  public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setText("SWT and Swing/AWT Example");

    Composite treeComp = new Composite(shell, SWT.EMBEDDED)

    treeComp.setBounds(5,5,300,300);
    
    java.awt.Frame fileTableFrame = SWT_AWT.new_Frame(treeComp);
    java.awt.Panel panel = new java.awt.Panel(new java.awt.BorderLayout());
    fileTableFrame.add(panel);
    JTree fileTable = new JTree();
    fileTable.setDoubleBuffered(true);
    JScrollPane scrollPane = new JScrollPane(fileTable);
    panel.add(scrollPane);

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
  }
}
17. 118. SWT AWT Swing
17. 118. 1. Embeded Swing/AWT components to SWTEmbeded Swing/AWT components to SWT
17. 118. 2. Using AWT to paint inside SWTUsing AWT to paint inside SWT
17. 118. 3. Embed a JTable in SWT (no flicker)Embed a JTable in SWT (no flicker)
17. 118. 4. Create a FontData object which encapsulate the essential data to create a swt font.
17. 118. 5. Create an awt font by converting as much information as possible from the provided swt Font.
17. 118. 6. Create an awt font by converting as much information as possible from the provided swt FontData.
17. 118. 7. Creates a swt color instance to match the rgb values of the specified awt color. alpha channel is not supported.
17. 118. 8. Creates a swt color instance to match the rgb values of the specified awt paint.
17. 118. 9. Creates an AWT MouseEvent from a swt event.
17. 118. 10. Creates an awt color instance to match the rgb values of the specified swt color.
17. 118. 11. Draw Graphics2D stuff on a swt composite
17. 118. 12. Returns an AWT point with the same coordinates as the specified SWT point.
17. 118. 13. Returns an SWT point with the same coordinates as the specified AWT point (rounded to integer values).
17. 118. 14. Returns an SWT point with the same coordinates as the specified AWT point.
17. 118. 15. Transform a swt Rectangle instance into an AWT Rectangle.
17. 118. 16. Transform an awt Rectangle2d instance into a swt Rectangle2d.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.