唉,弄了一个小时,终于把打包学会了。
在JAVA写的这个小工具,虽然实用性不大,但毕竟是第一个个人小工具。JAVA写的这个东西虽然大小只有
3K,但有一个不足就是,即使你再小的工具,也一定要装JAVA的环境!
下面是截图:
源码如下:
import java.net.*;import java.awt.*;import java.awt.event.*;
public class CZIP extends Frame implements ActionListener {TextField text;Label lab1, lab2, lab3,lab4,lab5,lab6,lab7;Button but1, but2;URL add;InetAddress ip;
CZIP() { super("网站IP地址查询小工具"); setSize(400, 150); setLayout(null); setBounds(312,309,400,150); text = new TextField(30); text.setBounds(160, 36, 220, 20); lab4 = new Label(); lab4.setBounds(160, 66, 220, 20); lab5 = new Label(); lab5.setBounds(160, 96, 100, 20); lab1 = new Label("所查URL:"); lab1.setBounds(10, 30, 120, 30); lab2 = new Label("主机域名:"); lab2.setBounds(10, 60, 120, 30); lab3 = new Label("主机IP地址:"); lab3.setBounds(10, 90, 120, 30); but1 = new Button("查询"); but1.setBounds(276, 96, 50, 20); but2 = new Button("退出"); but2.setBounds(330, 96, 50, 20); lab6 = new Label("提示:'http//'不可省略!"); lab6.setBounds(10, 120, 130, 30); lab7 = new Label("Van 版权所有。"); lab7.setBounds(300, 126, 80, 20); add(lab1); add(text); add(lab2); add(lab4); add(lab3); add(lab5); add(but1); add(but2); add(lab6); add(lab7); text.addActionListener(this); but1.addActionListener(this); but2.addActionListener(this); setVisible(true); validate();}
public void actionPerformed(ActionEvent e) {
try { add = new URL(text.getText().trim()); ip = InetAddress.getByName(add.getHost()); } catch (MalformedURLException murle) { System.out.println(murle); } catch (UnknownHostException uh) {
}
if (e.getSource() == but1) { if (text.getText() != "") { lab4.setText(ip.getHostName()); lab5.setText(ip.getHostAddress()); }
} if (e.getSource() == but2) System.exit(0);}
public static void main(String args[]) { new CZIP();
}}
以后希望能写不这么菜的吧!
个人总结:这里主要学会了用DOS,和eclipse打包方法。呵呵!