-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e7d7ff0
Showing
505 changed files
with
26,539 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
.metadata/.plugins/com.genuitec.eclipse.desktop/dialog_settings.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<section name="Workbench"> | ||
</section> |
18 changes: 18 additions & 0 deletions
18
.metadata/.plugins/com.genuitec.eclipse.sqlexplorer/ConnectionProfiles.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Beans> | ||
<Bean Class="com.genuitec.eclipse.sqlexplorer.utils.ConnectionProfile"> | ||
<activate>false</activate> | ||
<driverIdentifier Class="net.sourceforge.squirrel_sql.fw.id.UidIdentifier"> | ||
<string>151978a:15dc61dd57b:-7fde</string> | ||
</driverIdentifier> | ||
<identifier Class="net.sourceforge.squirrel_sql.fw.id.UidIdentifier"> | ||
<string>151978a:15dc61dd57b:-7fdd</string> | ||
</identifier> | ||
<name>MyEclipse Derby</name> | ||
<password encryption="true">gFOjO/OmrJ8m4/rtM2cMIw==</password> | ||
<promptForPassword>false</promptForPassword> | ||
<schema Indexed="true"/> | ||
<schemaDisplayPolicy>0</schemaDisplayPolicy> | ||
<url>jdbc:derby://localhost:1527/myeclipse</url> | ||
<userName>classiccars</userName> | ||
</Bean> | ||
</Beans> |
356 changes: 356 additions & 0 deletions
356
.metadata/.plugins/com.genuitec.eclipse.sqlexplorer/SQLDrivers.xml
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<section name="Workbench"> | ||
</section> |
177 changes: 177 additions & 0 deletions
177
.metadata/.plugins/org.eclipse.core.resources/.history/10/a03d4e9c8497001718f7e05878b57310
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
package com.etc._06DeleteDemo; | ||
|
||
import java.awt.EventQueue; | ||
import java.util.List; | ||
|
||
import javax.swing.JFrame; | ||
import javax.swing.JOptionPane; | ||
import javax.swing.JScrollPane; | ||
import javax.swing.JTable; | ||
import javax.swing.table.DefaultTableModel; | ||
|
||
import com.etc._03Login.dao.UserDao; | ||
import com.etc._03Login.entity.User; | ||
import javax.swing.JPopupMenu; | ||
import java.awt.Component; | ||
import java.awt.event.MouseAdapter; | ||
import java.awt.event.MouseEvent; | ||
import javax.swing.JMenu; | ||
import javax.swing.JMenuItem; | ||
import java.awt.event.ActionListener; | ||
import java.awt.event.ActionEvent; | ||
|
||
public class DeleteDemo { | ||
|
||
private JFrame frame; | ||
private JTable table; | ||
|
||
/** | ||
* Launch the application. | ||
*/ | ||
public static void main(String[] args) { | ||
EventQueue.invokeLater(new Runnable() { | ||
public void run() { | ||
try { | ||
DeleteDemo window = new DeleteDemo(); | ||
window.frame.setVisible(true); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Create the application. | ||
*/ | ||
public DeleteDemo() { | ||
initialize(); | ||
} | ||
|
||
/** | ||
* Initialize the contents of the frame. | ||
*/ | ||
private void initialize() { | ||
frame = new JFrame(); | ||
frame.setBounds(100, 100, 450, 300); | ||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
frame.getContentPane().setLayout(null); | ||
|
||
JScrollPane scrollPane = new JScrollPane(); | ||
scrollPane.setBounds(70, 54, 297, 145); | ||
frame.getContentPane().add(scrollPane); | ||
|
||
table = new JTable(); | ||
//����UserDao ���ݿ� | ||
UserDao dao = new UserDao(); | ||
Object[][] data = null;//����data���� | ||
try { | ||
List<User> list = dao.queryAllUser(); | ||
data = new Object[list.size()][4]; | ||
for(int i = 0;i<list.size();i++){ | ||
User user = list.get(i); | ||
data[i][0] = user.getId(); | ||
data[i][1] = user.getUsername(); | ||
data[i][2] = user.getSex(); | ||
data[i][3] = user.getHobby(); | ||
} | ||
|
||
} catch (Exception e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
table.setModel(new DefaultTableModel( | ||
data, | ||
new String[] { | ||
"���", "����", "�Ա�", "����" | ||
} | ||
)); | ||
scrollPane.setViewportView(table); | ||
|
||
JPopupMenu popupMenu = new JPopupMenu(); | ||
addPopup(table, popupMenu); | ||
|
||
JMenuItem menuItem_1 = new JMenuItem("ɾ��"); | ||
menuItem_1.addActionListener(new ActionListener() { | ||
public void actionPerformed(ActionEvent e) { | ||
// --------------ɾ�����¼� | ||
System.out.println("ɾ��"); | ||
int n = JOptionPane.showConfirmDialog(null, "�Ƿ�ɾ��", "��ʾ", | ||
JOptionPane.YES_NO_OPTION); | ||
System.out.println("n = " + n); | ||
|
||
if (n == 0) {// ȷ��ɾ�� | ||
// getValueAt(int row, int column) | ||
// ���� row �� column λ�õĵ�Ԫ��ֵ�� | ||
|
||
Object obj = table.getValueAt(table.getSelectedRow(), 0); | ||
System.out.println(obj); | ||
|
||
// ����UserDao ���ݿ� | ||
UserDao dao = new UserDao(); | ||
try { | ||
boolean flag = dao.deleteUser((Long) obj); | ||
if (flag) { | ||
JOptionPane.showMessageDialog(null, "ɾ���ɹ�"); | ||
|
||
//---------���ݿ� tableˢ�����ݿ�ʼ-------------- | ||
// ����UserDao ���ݿ� | ||
Object[][] data = null;// ����data���� | ||
try { | ||
List<User> list = dao.queryAllUser(); | ||
data = new Object[list.size()][4]; | ||
for (int i = 0; i < list.size(); i++) { | ||
User user = list.get(i); | ||
data[i][0] = user.getId(); | ||
data[i][1] = user.getUsername(); | ||
data[i][2] = user.getSex(); | ||
data[i][3] = user.getHobby(); | ||
} | ||
|
||
} catch (Exception e2) { | ||
// TODO Auto-generated catch block | ||
e2.printStackTrace(); | ||
} | ||
table.setModel(new DefaultTableModel(data, | ||
new String[] { "���", "����", "�Ա�", "����" })); | ||
|
||
//---------���ݿ� tableˢ�����ݽ���-------------- | ||
} else { | ||
JOptionPane.showMessageDialog(null, "ɾ��ʧ��"); | ||
} | ||
} catch (Exception e1) { | ||
// TODO Auto-generated catch block | ||
e1.printStackTrace(); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
}); | ||
popupMenu.add(menuItem_1); | ||
|
||
JMenu menu = new JMenu("����"); | ||
popupMenu.add(menu); | ||
|
||
JMenuItem menuItem = new JMenuItem("�����Ӳ˵�"); | ||
menu.add(menuItem); | ||
} | ||
private static void addPopup(Component component, final JPopupMenu popup) { | ||
component.addMouseListener(new MouseAdapter() { | ||
public void mousePressed(MouseEvent e) { | ||
if (e.isPopupTrigger()) { | ||
showMenu(e); | ||
} | ||
} | ||
public void mouseReleased(MouseEvent e) { | ||
if (e.isPopupTrigger()) { | ||
showMenu(e); | ||
} | ||
} | ||
private void showMenu(MouseEvent e) { | ||
popup.show(e.getComponent(), e.getX(), e.getY()); | ||
} | ||
}); | ||
} | ||
} |
Empty file added
0
.metadata/.plugins/org.eclipse.core.resources/.history/13/0067e450ac87001713c4b5d8567e34e5
Empty file.
7 changes: 7 additions & 0 deletions
7
.metadata/.plugins/org.eclipse.core.resources/.history/15/d037c0a511830017192a847471e8848c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.6 |
26 changes: 26 additions & 0 deletions
26
.metadata/.plugins/org.eclipse.core.resources/.history/16/a09c1bf3969300171416f4318a5811a0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.etc._02LoginStrDemo; | ||
|
||
import java.io.IOException; | ||
import java.net.ServerSocket; | ||
import java.net.Socket; | ||
|
||
/** | ||
* ����� | ||
* @author Administrator | ||
* | ||
*/ | ||
public class LoginServer { | ||
public static void main(String[] args) throws IOException { | ||
System.out.println("�����������....."); | ||
// 1. ������������Socket��ָ���˿ڲ���ʼ���� | ||
ServerSocket server = new ServerSocket(8888); | ||
// 2. ʹ��accept()���������ȴ�����������µ����� | ||
Socket client = server.accept(); | ||
System.out.println("���ӹ����Ŀͻ���:"+client.getInetAddress()); | ||
// 3. �������������� | ||
// 4. �����е�Э���ϲ����Ự | ||
// 5. ʹ��close()�ر�����Socket | ||
|
||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
.metadata/.plugins/org.eclipse.core.resources/.history/19/e09d1af311830017192a847471e8848c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.etc._12singleInstance; | ||
|
||
public class Apple { | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
.metadata/.plugins/org.eclipse.core.resources/.history/1c/d02b4566779300171416f4318a5811a0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.etc._01InetAddressDemo; | ||
|
||
import java.io.IOException; | ||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
|
||
/** | ||
* IP���� | ||
* @author Administrator | ||
* | ||
*/ | ||
public class InetAddressDemo { | ||
public static void main(String[] args) throws IOException { | ||
InetAddress ip = InetAddress.getByName("MNBAUV1MW3IICTF"); | ||
// InetAddress ip = InetAddress.getByName("www.baidu.com"); | ||
System.out.println(ip); | ||
|
||
//��ȡ�������� | ||
System.out.println(ip.getHostName()); | ||
|
||
//��ȡIP��ַ | ||
System.out.println(ip.getHostAddress()); | ||
|
||
|
||
//boolean isReachable(int timeout) �����Ƿ���Դﵽ�õ�ַ�� | ||
System.out.println(ip.isReachable(5000)); | ||
|
||
System.out.println(InetAddress.getLocalHost()); | ||
|
||
|
||
|
||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
.metadata/.plugins/org.eclipse.core.resources/.history/1f/007708a1769300171416f4318a5811a0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.etc._09Task; | ||
|
||
class MyThread extends Thread{ | ||
private long time; | ||
MyThread(long time){ | ||
this.time = time; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
// TODO Auto-generated method stub | ||
System.out.println(Thread.currentThread().getName()+" begin..."); | ||
try { | ||
Thread.sleep(this.time); | ||
} catch (InterruptedException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
System.out.println(Thread.currentThread().getName()+" end..."); | ||
} | ||
} | ||
|
||
public class Task { | ||
//2�� �����⣺���̣߳������̶߳���ÿ��һ��ʱ����ִ���̶߳���1��5�룩�� | ||
// �̶߳���2��7�룩���̶߳���3��9�룩 | ||
public static void main(String[] args) { | ||
MyThread my1 = new MyThread(5000); | ||
MyThread my2 = new MyThread(7000); | ||
MyThread my3 = new MyThread(9000); | ||
my1.start(); | ||
try { | ||
my1.join(); | ||
} catch (InterruptedException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
my2.start(); | ||
try { | ||
my2.join();//ֻ��my2��ִ�� �����߳�Ҫ�� | ||
} catch (InterruptedException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
my3.start(); | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
.metadata/.plugins/org.eclipse.core.resources/.history/20/303646119f9600171a5fe7fe6dd2b700
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.etc._03Login.dao; | ||
|
||
|
||
import java.sql.SQLException; | ||
import java.util.ArrayList; | ||
|
||
import com.etc._03Login.entity.User; | ||
import com.etc._03Login.utils.JDBCUtils; | ||
|
||
|
||
|
||
public class UserDao { | ||
//创建一个JDBC工具对象 | ||
private JDBCUtils jdbc = new JDBCUtils(); | ||
public UserDao(){ | ||
jdbc.getConnection(); | ||
} | ||
|
||
//插入数据 | ||
public boolean addUser(User user) throws Exception{ | ||
|
||
String sql = "INSERT INTO t_User (id,username,password,sex,birthday,hobby)" + | ||
" VALUES(null,?,?,?,?,?)"; | ||
ArrayList<Object> params = new ArrayList<Object>(); | ||
params.add(user.getUsername()); | ||
params.add(user.getPassword()); | ||
params.add(user.getSex()); | ||
params.add(user.getBirthday()); | ||
params.add(user.getHobby()); | ||
boolean flag = jdbc.updateByPreparedStatement(sql, params); | ||
jdbc.releaseConn(); | ||
return flag; | ||
} | ||
|
||
} |
Oops, something went wrong.