91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 36KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-22
  • 語言: Java
  • 標(biāo)簽: 韓順平??java??

資源簡(jiǎn)介

根據(jù)韓順平老師的視頻整理而成,簡(jiǎn)單的java GUI編程。

資源截圖

代碼片段和文件信息

package?com.test1;

import?java.awt.BorderLayout;
import?java.awt.frame;
import?java.awt.GridLayout;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.sql.Connection;
import?java.sql.DriverManager;
import?java.sql.PreparedStatement;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?java.sql.Statement;

import?javax.swing.JButton;
import?javax.swing.JDialog;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JPanel;
import?javax.swing.JTextField;

public?class?StuAddDialog?extends?JDialog?implements?ActionListener{
//定義我們需要的swing組件
JLabel?jl1jl2jl3jl4jl5jl6;
JButton?jb1jb2;
JTextField?jtf1jtf2jtf3jtf4jtf5jtf6;
JPanel?jp1jp2jp3;
//owner它的父窗口?
//title窗口名
//model指定是模式窗口還是非模式的
public?StuAddDialog(frame?ownerString?titleboolean?model){
super(ownertitlemodel);//調(diào)用父類構(gòu)造方法,達(dá)到模式對(duì)話框效果
jl1=new?JLabel(“學(xué)號(hào)“);
jl2=new?JLabel(“姓名“);
jl3=new?JLabel(“性別“);
jl4=new?JLabel(“年齡“);
jl5=new?JLabel(“籍貫“);
jl6=new?JLabel(“系別“);

jtf1=new?JTextField();
jtf2=new?JTextField();
jtf3=new?JTextField();
jtf4=new?JTextField();
jtf5=new?JTextField();
jtf6=new?JTextField();

jb1=new?JButton(“添加“);
jb1.addActionListener(this);
jb2=new?JButton(“取消“);

jp1=new?JPanel();
jp2=new?JPanel();
jp3=new?JPanel();

//設(shè)置布局
jp1.setLayout(new?GridLayout(61));
jp2.setLayout(new?GridLayout(61));

jp1.add(jl1);
jp1.add(jl2);
jp1.add(jl3);
jp1.add(jl4);
jp1.add(jl5);
jp1.add(jl6);

jp2.add(jtf1);
jp2.add(jtf2);
jp2.add(jtf3);
jp2.add(jtf4);
jp2.add(jtf5);
jp2.add(jtf6);

jp3.add(jb1);
jp3.add(jb2);

this.add(jp1BorderLayout.WEST);
this.add(jp2BorderLayout.CENTER);
this.add(jp3BorderLayout.SOUTH);

this.setSize(300200);
//this.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
this.setVisible(true);
}
@Override
public?void?actionPerformed(ActionEvent?e)?{
//?TODO?Auto-generated?method?stub
if(e.getSource()==jb1){
//對(duì)用戶點(diǎn)擊添加按鈕后的相應(yīng)動(dòng)作
Connection?ct=null;
Statement?st=null;
ResultSet?rs=null;
PreparedStatement?ps=null;
try?{
Class.forName(“com.microsoft.jdbc.sqlserver.SQLServerDriver“);
String?url=“jdbc:microsoft:sqlserver://127.0.0.1:1433;databaseName=SIMS“;
ct?=?DriverManager
.getConnection(
url
“sa“?“1234“);
String?sql=“insert?into?stu?values?(??????)“;
ps=ct.prepareStatement(sql);
ps.setString(1?jtf1.getText());
ps.setString(2?jtf2.getText());
ps.setString(3?jtf3.getText());
ps.setString(4?jtf4.getText());
ps.setString(5?jtf5.getText());
ps.setString(6?jtf6.getText());

ps.executeUpdate();
//關(guān)閉添加學(xué)生的對(duì)話框
this.dispose();
}?catch?(Exception?e2)?{
//?TODO:?handle?exception
e2.printStackTrace();
}?finally?{
try?{
if(ps!=null){
ps.close();
}
if(ct!=n

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件????????552??2014-10-31?10:31??學(xué)生管理系統(tǒng)\model1\Demo1_Student\.classpath

?????文件????????389??2014-10-31?10:29??學(xué)生管理系統(tǒng)\model1\Demo1_Student\.project

?????文件????????629??2014-10-31?10:29??學(xué)生管理系統(tǒng)\model1\Demo1_Student\.settings\org.eclipse.jdt.core.prefs

?????文件???????4204??2014-10-31?10:48??學(xué)生管理系統(tǒng)\model1\Demo1_Student\bin\com\test1\StuAddDialog.class

?????文件???????5110??2014-10-31?13:51??學(xué)生管理系統(tǒng)\model1\Demo1_Student\bin\com\test1\StuManage.class

?????文件???????3296??2014-10-31?10:31??學(xué)生管理系統(tǒng)\model1\Demo1_Student\bin\com\test1\StuModel.class

?????文件???????4679??2014-10-31?13:51??學(xué)生管理系統(tǒng)\model1\Demo1_Student\bin\com\test1\StuUpdDialog.class

?????文件???????3254??2014-10-31?10:48??學(xué)生管理系統(tǒng)\model1\Demo1_Student\src\com\test1\StuAddDialog.java

?????文件???????3914??2014-10-31?13:51??學(xué)生管理系統(tǒng)\model1\Demo1_Student\src\com\test1\StuManage.java

?????文件???????2623??2014-10-31?10:17??學(xué)生管理系統(tǒng)\model1\Demo1_Student\src\com\test1\StuModel.java

?????文件???????3785??2014-10-31?13:51??學(xué)生管理系統(tǒng)\model1\Demo1_Student\src\com\test1\StuUpdDialog.java

?????文件????????552??2014-10-31?10:31??學(xué)生管理系統(tǒng)\model2\Demo1_Student\.classpath

?????文件????????389??2014-10-31?10:29??學(xué)生管理系統(tǒng)\model2\Demo1_Student\.project

?????文件????????629??2014-10-31?10:29??學(xué)生管理系統(tǒng)\model2\Demo1_Student\.settings\org.eclipse.jdt.core.prefs

?????文件???????2892??2014-10-31?15:57??學(xué)生管理系統(tǒng)\model2\Demo1_Student\bin\com\test1\SqlHelper.class

?????文件???????3004??2014-10-31?15:58??學(xué)生管理系統(tǒng)\model2\Demo1_Student\bin\com\test1\StuAddDialog.class

?????文件???????3980??2014-10-31?16:04??學(xué)生管理系統(tǒng)\model2\Demo1_Student\bin\com\test1\StuManage.class

?????文件???????2793??2014-10-31?16:00??學(xué)生管理系統(tǒng)\model2\Demo1_Student\bin\com\test1\StuModel.class

?????文件???????3330??2014-10-31?15:58??學(xué)生管理系統(tǒng)\model2\Demo1_Student\bin\com\test1\StuUpdDialog.class

?????文件???????2320??2014-10-31?15:57??學(xué)生管理系統(tǒng)\model2\Demo1_Student\src\com\test1\SqlHelper.java

?????文件???????2557??2014-10-31?14:19??學(xué)生管理系統(tǒng)\model2\Demo1_Student\src\com\test1\StuAddDialog.java

?????文件???????3608??2014-10-31?16:04??學(xué)生管理系統(tǒng)\model2\Demo1_Student\src\com\test1\StuManage.java

?????文件???????2513??2014-10-31?16:00??學(xué)生管理系統(tǒng)\model2\Demo1_Student\src\com\test1\StuModel.java

?????文件???????2955??2014-10-31?14:26??學(xué)生管理系統(tǒng)\model2\Demo1_Student\src\com\test1\StuUpdDialog.java

?????文件????????853??2014-10-31?13:54??學(xué)生管理系統(tǒng)\stu.sql

?????目錄??????????0??2014-10-31?14:32??學(xué)生管理系統(tǒng)\model1\Demo1_Student\bin\com\test1

?????目錄??????????0??2014-10-31?14:32??學(xué)生管理系統(tǒng)\model1\Demo1_Student\src\com\test1

?????目錄??????????0??2014-10-31?16:06??學(xué)生管理系統(tǒng)\model2\Demo1_Student\bin\com\test1

?????目錄??????????0??2014-10-31?16:06??學(xué)生管理系統(tǒng)\model2\Demo1_Student\src\com\test1

?????目錄??????????0??2014-10-31?14:32??學(xué)生管理系統(tǒng)\model1\Demo1_Student\bin\com

............此處省略17個(gè)文件信息

評(píng)論

共有 條評(píng)論