Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

XULRunner with Java: JavaXPCOM Tutorial 2

4 ÔÚjava´úÂëÀïǶÈëFirefox3
  ÏÖÔÚ¿ÉÒÔÈ¥ÓÃÒ»ÏÂÓÐÓõÄÀý×ÓÁË¡£Ê×ÏÈÎÒÃÇÔÚÒ»¸öjava³ÌÐòÀïʹÓÃSWTÀ´Ç¶ÈëÒ»¸öMozillaä¯ÀÀÆ÷¡£ÏÖÔÚ£¬ÎÒÃÇ¿ÉÒÔʹÓÃ
org.eclipse.swt.browser.BrowserÀàÀ´ÊµÀý»¯£ºbrowser = new Browser(shell, SWT.MOZILLA); ÔÚÕâ֮ǰ£¬ÎÒÃÇÐèҪʹÓÃATFÏîÄ¿
£¬ÒÔ¼°Ò»ÏÂATF²å¼þ¡£·Ç³£ÐÒÔË£¬ÏÖÔÚÎÒÃDz»ÐèÒªÕâЩ²¹¶¡ÁË¡£
4.1 ÅäÖû·¾³
  ΪÁËÔÚjava³ÌÐòÀïǶÈëMozillaä¯ÀÀÆ÷£¬ÎÒÃÇÐèҪʹÓÃSWTÀ´´´½¨´°¿ÚºÍǶÈëä¯ÀÀÆ÷¡£
  4.1.1 °²×°swt
   ÏÂÔضÔÓ¦²Ù×÷ϵͳµÄswt£¬¼Óµ½classpath¾ÍºÃÁË
  4.1.2 ÅäÖÃswt
   ÔËÐкóÃæÀý×ÓÐèÒªµÄjar°ü£º
   javaxpcom.jar
   MozillaInterfaces.jar
   MozillaGlue.jar
   swt.jar
   src.zip
4.2 Web BrowserÀý×Ó
package es.ladyr.javaxpcom.browser;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.mozilla.interfaces.*;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.SWTError;
public class SimpleBrowser {
public static void main(String args[]) {

final Browser browser;
Display display = new Display();
Shell shell = new Shell(display);
shell.setSize(800, 600);
shell.open();

//Initiating the browser using SWT
try {
browser = new Browser(shell, SWT.MOZILLA);
} catch (SWTError e) {
System.out.println("Could not instantiate Browser: " + e.getMessage());
return;
}



// Adapt browser size to shell size
browser.setBounds(shell.getClientArea());
// Load an URL into the web browser


Ïà¹ØÎĵµ£º

Java ¾²Ì¬´úÀíºÍ¶¯Ì¬´úÀí

1. ´úÀíģʽÖ÷ÒªÓÐÁ½ÖÖ£º¾²Ì¬´úÀíºÍ¶¯Ì¬´úÀí
2. ¾²Ì¬´úÀí£º
±ÈÈçÒªÔÚÊä³ö“HelloWorld”Ç°´òÓ¡Ò»¸ö×Ö·û´®“Welcome”
A:Ïȶ¨ÒåÒ»¸ö½Ó¿ÚÀà
Java´úÂë
package ttitfly.proxy;       
      
public interface HelloWo ......

java ·´Éä

package test;   
public class TestFactory<T> {   
    private Class <T> cls;   
    public String testabc="";   
  
    pub ......

java ¸ñʽ»¯Êä³ö

Ò»¡¢java.util.Formatter
 
java.util.Formatter ÊÇJDK1.5ÐÂÔöµÄÀà¿â£¬¹¦ÄܺÜÇ¿´ó£¬µ«ÊDz»ºÃÕÆÎÕ£¬¾ÍÏñÏÂÆåÒ»Ñù£¬ÖªµÀÈçºÎ×ßÆå×Ó£¬ºÍÊìÁ·Ó¦ÓÃÍêÈ«ÊÇÁ½ÂëÊ¡£
 
¸ñʽ»¯Ö÷ÒªÓÃÔÚÎı¾Êä³ö·½Ã棬±ÈÈ磬Êý×Ö¡¢ÈÕÆÚ¡¢½ð¶îµÈ£¬»¹ÓÐÀàËƳ¬ÊеĹºÎﵥСƱµÈµÈ£¬¶¼»áÓõ½¸ñʽ»¯Êä³öµÄ¹¤¾ß¡£ÔÚ´ËÀàû³öÏÖ֮ǰ£¬Ö»ÄÜͨ¹ý¿ ......

Java¶¨Ê±ÈÎÎñµÄʵÏÖ

¢Ù¼Ì³ÐTimerTask£¬ÖØдrun·½·¨
package bamboo.task;
import java.util.TimerTask;
public class TimeTaskTest extends TimerTask{
 @Override
 public void run() {
  System.out.println("hi");
 }
}
¢Úͨ¹ýtimerÀ´ÉèÖÃij¸öʱ¼äÀ´µ÷Ó㬻òÕßÊÇÏà¸ô¶à³¤Ê±¼äµ÷ÓÃ
package bamboo.test; ......

javaÎļþºÍÎļþ¼ÐµÄ²Ù×÷

import java.io.BufferedReader;  
import java.io.File;  
import java.io.FileInputStream;  
import java.io.FileOutputStream;  
import java.io.FileWriter;  
import java.io.IOException;  
import java.io.InputStream;  
im ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ