Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-25-2008, 04:34 PM
Moderator
 
Join Date: Nov 2007
Posts: 1,657
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Embedding Word in an applet
Code:
import java.applet.Applet; public class Snippet157 extends Applet { org.eclipse.swt.widgets.Display display; org.eclipse.swt.widgets.Shell swtParent; java.awt.Canvas awtParent; public void init() { Thread thread = new Thread(new Runnable() { public void run() { setLayout(new java.awt.GridLayout(1, 1)); awtParent = new java.awt.Canvas(); add(awtParent); display = new org.eclipse.swt.widgets.Display(); swtParent = org.eclipse.swt.awt.SWT_AWT.new_Shell(display, awtParent); swtParent.setLayout(new org.eclipse.swt.layout.FillLayout()); org.eclipse.swt.ole.win32.OleFrame frame = new org.eclipse.swt.ole.win32.OleFrame( swtParent, org.eclipse.swt.SWT.NONE); org.eclipse.swt.ole.win32.OleClientSite site; try { site = new org.eclipse.swt.ole.win32.OleClientSite(frame, org.eclipse.swt.SWT.NONE, "Word.Document"); } catch (org.eclipse.swt.SWTException e) { String str = "Create OleClientSite Error" + e.toString(); System.out.println(str); return; } setSize(500, 500); validate(); site.doVerb(org.eclipse.swt.ole.win32.OLE.OLEIVERB_SHOW); while (swtParent != null && !swtParent.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } }); thread.start(); } public void stop() { if (display != null && !display.isDisposed()) { display.syncExec(new Runnable() { public void run() { if (swtParent != null && !swtParent.isDisposed()) swtParent.dispose(); swtParent = null; display.dispose(); display = null; } }); remove(awtParent); awtParent = null; } } }
__________________
Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums! (closes on July 27, 2008)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word OLE Java Tip SWT 0 07-25-2008 04:33 PM
Saving word document from iframe anil@netedgecomputing.com JavaServer Pages (JSP) and JSTL 0 05-15-2008 01:49 PM
Word Scramble lk9865 New To Java 5 11-17-2007 04:22 AM
Help with a word, if it is divided by spaces baltimore New To Java 1 08-07-2007 08:31 AM
How to update Existing Word Doc Using java umashankar Advanced Java 1 07-27-2007 03:29 PM


All times are GMT +3. The time now is 08:27 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org