⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getsms0213.java

📁 这个源码是用来收短信的
💻 JAVA
字号:
package 收短信;



import javax.swing.JLabel;
import java.awt.BorderLayout;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;
import java.sql.*;

import DB.*;

/**
* This code was generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* *************************************
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED
* for this machine, so Jigloo or this code cannot be used legally
* for any corporate or commercial purpose.
* *************************************
*/
public class GetSMS0213 extends javax.swing.JFrame {
	private JLabel jLabel1;
	private JLabel jLabel2;
	private JPasswordField password;
	private JButton jButton1;
	private JTextArea info;
	private JScrollPane jScrollPane1;
	private JTextField mob;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		GetSMS0213 inst = new GetSMS0213();
		inst.setVisible(true);
	}
	
	public GetSMS0213() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			pack();
			setSize(400, 300);
			setLayout(null);
			{
				jLabel1 = new JLabel();
				this.getContentPane().add(jLabel1);
				jLabel1.setText("\u624b\u673a\u53f7\u7801");
				jLabel1.setBounds(33, 25, 60, 30);
			}
			{
				jLabel2 = new JLabel();
				this.getContentPane().add(jLabel2);
				jLabel2.setText("\u767b\u5f55\u5bc6\u7801");
				jLabel2.setBounds(34, 66, 60, 30);
			}
			{
				mob = new JTextField();
				this.getContentPane().add(mob);
				mob.setBounds(104, 30, 157, 20);
			}
			{
				password = new JPasswordField();
				this.getContentPane().add(password);
				password.setBounds(104, 79, 157, 20);
			}
			{
				jScrollPane1 = new JScrollPane();
				this.getContentPane().add(jScrollPane1);
				jScrollPane1.setBounds(13, 117, 370, 147);
				{
					info = new JTextArea();
					jScrollPane1.setViewportView(info);
				}
			}
			{
				jButton1 = new JButton();
				this.getContentPane().add(jButton1);
				jButton1.setText("\u67e5\u8be2");
				jButton1.setBounds(288, 49, 60, 30);
				jButton1.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						db db=new db();
						String m=mob.getText();
						String p=password.getText();
						
						try {
							String sql="select password from users where mob='"+m+"'";
							ResultSet rs=db.q(sql);
							if(rs.next())
							{
								String realpassword=rs.getString("password");//从数据库中读取真实密码
								if(realpassword.equals(p))
								{
									sql="select * from sms where mob2='"+m+"' and readio=0";
									ResultSet rssms=db.q(sql);
									info.setText("号码\t发送时间\t\t短信内容\n");
									
									while(rssms.next())
									{
										info.append(rssms.getString("mob1")+"\t"+rssms.getString("stime1")+"\t"+rssms.getString("sms")+"\n");
									}
									sql="update sms set stime2=sysdate,readio=1 where mob2='"+m+"'";
									db.u(sql);
								}
								else
								{
									info.setText("手机号码或密码错误");
								}
							}
							else
							{
								info.setText("手机号码或密码错误");
							}
							
						} catch (Exception e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
						
					}
				});
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/**
	* Auto-generated method for setting the popup menu for a component
	*/
	private void setComponentPopupMenu(final java.awt.Component parent, final javax.swing.JPopupMenu menu) {
parent.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent e) {
if(e.isPopupTrigger())
menu.show(parent, e.getX(), e.getY());
}
public void mouseReleased(java.awt.event.MouseEvent e) {
if(e.isPopupTrigger())
menu.show(parent, e.getX(), e.getY());
}
});
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -