?? getsms0213.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 + -