2010年1月25日 星期一

Cheome extensions browserAction

設定icon上面的文字
chrome.browserAction.setBadgeText(object details)
Sets the badge text for the browser action. The badge is displayed on top of the icon.
Parameters
details
object )



text
string )


Any number of characters can be passed, but only about four can fit in the space.
tabId
optional integer )


Limits the change to when a particular tab is selected. Automatically resets when the tab is closed.



設定icon上文字的顏色
chrome.browserAction.setIcon(object details)
Sets the background color for the badge.
Parameters
details
object )



color
array of integer )


An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255].
tabId
optional integer )


Limits the change to when a particular tab is selected. Automatically resets when the tab is closed.



2010年1月23日 星期六

javascript call java by java applet

這是要測試,在網頁上嵌入javascript,然後再去call用java寫好的function。

首先我們先從java下手

import java.awt.*;
import java.applet.*;
import javax.swing.*;
import java.io.*;
public class tester1 extends Applet {

  public int hello( int i )
  {
    javax.swing.JOptionPane.showMessageDialog(null, "Hello World!\n i = " + i + ".");
    Graphics g = getGraphics();
    g.drawString("Hello World!\n", 10, 10);
    return i+1;
  }
}