• 大小: 19.21MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2023-07-07
  • 语言: Java
  • 标签: java  雅虎  天气预报  

资源简介

包含源代码与用exe4j制作的exe程序,自带jre,jre已经做过初步的删减。

资源截图

代码片段和文件信息

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;

public class SelectCity extends Jframe {
/**
 * 
 */
private static final long serialVersionUID = 1L;
JLabel jl;
JButton jb=new JButton(“就这个“);;
JComboBox jcb=new JComboBox();
Image img;
public static class CList{
String cname;
String ccode;
public CList(String cnameString ccode){
this.cname=cname;
this.ccode=ccode;
}
public String toString(){
return(cname);
}
}

 public SelectCity(){
 jl=new JLabel(“选择城市“);
this.settitle(“天气预报“);
img=new ImageIcon(“img/icon.png“).getImage();
this.setIconImage(img);
this.setLayout(new FlowLayout(FlowLayout.LEFT1010));
jl.setPreferredSize(new Dimension(20020));
jl.setForeground(Color.blue);
this.add(jl);
jcb.setPreferredSize(new Dimension(13020));
this.add(jcb);
jb.setPreferredSize(new Dimension(9020));
jb.setForeground(Color.green);
this.add(jb);
this.initJcb();
jb.addActionListener(new ActionListener(){

@Override
public void actionPerformed(ActionEvent e) {
CList nowcn=(CList)jcb.getSelectedItem();
String selectedccode=nowcn.ccode;
String selectedcname=nowcn.cname;
Weather.tianqitianxie(new Weatherframe(selectedcname)selectedccode);
SelectCity.this.dispose();
}

});
Dimension screensize=Toolkit.getDefaultToolkit().getScreenSize();
int scrX=screensize.width;
int scrY=screensize.height;
int frameX=250;
int frameY=100;
this.setBounds((scrX/2-frameX/2)(scrY/2-frameY/2-150)  frameXframeY);
this.setVisible(true);
this.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
this.setResizable(false);
}
public static void main(String args[]){
new SelectCity();
}
public void initJcb(){
try{
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder builder=factory.newDocumentBuilder();
Document doc=builder.parse(new File(“cityList.xml“));
doc.normalize();
NodeList citylist=doc.getElementsByTagName(“cityItem“);
CList[] cia=new CList[citylist.getLength()];
for(int i=0;i Element CElement=(Element)citylist.item(i);
String cname=CElement.getElementsByTagName(“name“).item(0).getFirstChild().getNodeValue();
String ccode=CElement.getElementsByTagName(“code“).item(0).getFirstChild().getNodeValue();
    cia[i]=new CList(cnameccode);
}
jcb.setModel(new DefaultComboBoxModel(cia));
}catch(Exception e){e.printStackTrace();}
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1086  2010-09-28 21:27  tianqiyubao\cityList.xml

     文件      13303  2010-09-26 16:27  tianqiyubao\img\daomeixiong.png

     文件      16000  2010-09-24 21:51  tianqiyubao\img\icon.png

     文件      52732  2010-09-26 22:36  tianqiyubao\img\mengyou.png

     文件      46043  2010-09-26 13:54  tianqiyubao\img\smile.png

     文件      10240  2010-05-15 12:22  tianqiyubao\jre\bin\attach.dll

     文件    1208320  2010-05-15 12:22  tianqiyubao\jre\bin\awt.dll

     文件     114688  2010-05-15 12:22  tianqiyubao\jre\bin\axbridge.dll

     文件     192512  2010-05-15 12:22  tianqiyubao\jre\bin\cmm.dll

     文件     143360  2010-05-15 12:22  tianqiyubao\jre\bin\dcpr.dll

     文件      77824  2010-05-15 12:22  tianqiyubao\jre\bin\deploy.dll

     文件     405504  2010-05-15 12:22  tianqiyubao\jre\bin\deploytk.dll

     文件      16896  2010-05-15 12:22  tianqiyubao\jre\bin\dt_shmem.dll

     文件      13312  2010-05-15 12:22  tianqiyubao\jre\bin\dt_socket.dll

     文件      69632  2010-05-15 12:22  tianqiyubao\jre\bin\eula.dll

     文件     339968  2010-05-15 12:22  tianqiyubao\jre\bin\fontmanager.dll

     文件      15872  2010-05-15 12:22  tianqiyubao\jre\bin\hpi.dll

     文件     139264  2010-05-15 12:22  tianqiyubao\jre\bin\hprof.dll

     文件      98304  2010-05-15 12:22  tianqiyubao\jre\bin\instrument.dll

     文件      12800  2010-05-15 12:22  tianqiyubao\jre\bin\ioser12.dll

     文件       7680  2010-05-15 12:22  tianqiyubao\jre\bin\j2pcsc.dll

     文件      41984  2010-05-15 12:22  tianqiyubao\jre\bin\j2pkcs11.dll

     文件      10240  2010-05-15 12:22  tianqiyubao\jre\bin\jaas_nt.dll

     文件     126976  2010-05-15 12:22  tianqiyubao\jre\bin\java.dll

     文件     139264  2010-05-15 12:22  tianqiyubao\jre\bin\java.exe

     文件      73728  2010-05-15 12:22  tianqiyubao\jre\bin\javacpl.cpl

     文件     139264  2010-05-15 12:22  tianqiyubao\jre\bin\javaw.exe

     文件      14336  2010-05-15 12:22  tianqiyubao\jre\bin\java_crw_demo.dll

     文件       5120  2010-05-15 12:22  tianqiyubao\jre\bin\jawt.dll

     文件      61544  2008-11-09 22:23  tianqiyubao\jre\bin\jcov.dll

............此处省略208个文件信息

评论

共有 条评论