代碼貼上
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import java
import
import java
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import com
class RefBoolean {public boolean var = false;}
class RefInt {public int var =
public class DictFrame {
public static void main(String[] args) {
try {UIManager
catch (Exception e) { System
Toolkit tk = Toolkit
final RefBoolean canDrag = new RefBoolean()
final RefBoolean isFirst = new RefBoolean()
final RefInt oldX = new RefInt()
final RefInt oldY = new RefInt()
isFirst
final JFrame jf = new JFrame()
final JDialog jdmean = new JDialog()
final JTextField jtfWord = new JTextField(
final JTextArea jtamean = new JTextArea(
JScrollPane jScmean=new JScrollPane(jtamean)
JPanel jp = new JPanel()
Image image = tk
jf
jf
jdmean
jdmean
jdmean
jtamean
jdmean
jdmean
AWTUtilities
AWTUtilities
jtfWord
jp
jp
jp
jf
jf
jf
jf
jp
jf
try {
if(SystemTray
SystemTray st = SystemTray
TrayIcon ti = new TrayIcon(image)
ti
PopupMenu popupMenu
MenuItem menuItem
ti
ti
public void mouseClicked(MouseEvent e) {
if (e
jf
}
}
})
st
popupMenu
menuItem
menuItem
public void actionPerformed(ActionEvent evt) {
System
}
})
popupMenu
}
} catch (AWTException e) {
e
}
jf
public void windowIconified(WindowEvent evt) {
}
})
tk
@Override
public void eventDispatched(AWTEvent event) {
if(((KeyEvent) event)
if(((KeyEvent) event)
System
}else if( ((KeyEvent) event)
jf
if(AWTUtilities
double[] ds = {
for(double d:ds) {
_sleep(
AWTUtilities
}
}
} else if( ((KeyEvent) event)
jf
jtfWord
}
}
}
}
jp
@Override
public void mouseMoved(MouseEvent arg
}
@Override
public void mouseDragged(MouseEvent arg
int x = arg
int y = arg
if(isFirst
oldX
oldY
isFirst
}
int detaX = x
int detaY = y
jf
jdmean
oldX
oldY
}
})
jp
@Override
public void mouseReleased(MouseEvent arg
canDrag
isFirst
}
@Override
public void mousePressed(MouseEvent arg
canDrag
isFirst
}
@Override
public void mouseExited(MouseEvent arg
}
@Override
public void mouseEntered(MouseEvent arg
}
@Override
public void mouseClicked(MouseEvent arg
}
})
jf
public void windowIconified(WindowEvent evt) {
AWTUtilities
}
})
jtfWord
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
if( e
if((e
jtfWord
jtamean
Thread t = new Thread(new Runnable() {
@Override
public void run() {
if(AWTUtilities
double[] ds = {
for(int i=
double d = ds[i];
_sleep(
AWTUtilities
jdmean
}
}
}
})
t
return;
}
try {
String url =
+jtfWord
VarByte vb = DictFrame
String content = new String(vb
String tagBegin =
String tagEnd =
StringBuilder sb = new StringBuilder()
int cur =
while((cur=content
cur +=
int curEnd = content
sb
curEnd +=
}
if(sb
jtamean
AWTUtilities
jdmean
} catch (Exception ex) {
jtamean
AWTUtilities
jdmean
}
}
}
@Override
public void keyPressed(KeyEvent arg
}
})
}
public static void _sleep(long m) {
try {
Thread
} catch (InterruptedException e) {
e
}
}
public static VarByte getPage (String address) throws Exception {
URL url = new URL(address)
InputStream inStream = url
VarByte page = new VarByte()
int oneTimeSize =
byte[] b = new byte[oneTimeSize];
int len;
while((len=inStream
if(len!=oneTimeSize) {
b = pyOf(b
}
page
}
if(inStream!=null) inStream
return page;
}
}
class VarByte {
byte[] b = new byte[
int capacity =
int len =
public VarByte append(byte[] ba) {
if(len+ba
byte[] tmp = new byte[(len+ba
System
System
b = tmp;
len = len+ba
capacity = len*
} else {
System
len = len + ba
}
return this;
}
public byte[] to_byte() {
byte[] btmp = new byte[len];
System
return btmp;
}
public byte[] to_byte(int start
byte[] btmp = new byte[len];
for(int i=
btmp[i] = b[start+i];
}
return btmp;
}
public int size() {
return len;
}
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/25904.html