THE THIRTY-FOURTH DAY

    今天星期三,参加培训的第三十四天,依旧早上在宿舍看书,看的运算符,为什么记忆这么深呢,因为不知不觉就到点了,那些位运算什么的,让时间过的挺快的,所以呢,也没有什么,只是还是一直在做QQ,真的是挺难的,一点都不会,不知道别人怎么写的,有个人交流一下就好了。

    在网上看了一下别人写的代码,看不怎么懂,但是知道了,一些用到的东西要定义成常量,方便使用,还有别的什么的话,就放到代码里去说吧。

QQ窗口:

public MainView() {
		// TODO Auto-generated constructor stub
//		setSize(350, 700);
		setBounds(1000, 30, 300, 700);
//		frame.setTitle("qq注册");
		setUndecorated(true);//不显示标题栏
		setType(JFrame.Type.UTILITY);//不在任务栏显示
		addMoveWindow();
		Container container = this.getContentPane();
		container.add(upPanel());
	    container.setLayout(new FlowLayout());
        container.add(downPanel());
	    container.add(addFriend());
//		container.setLayout(new GridLayout(0, 1));
		setVisible(true);
	}
public void addMoveWindow() {
	    	ImageIcon trayImg = new ImageIcon("image/他的妃.jpg");// 托盘图标          
	        trayIcon = new TrayIcon(trayImg.getImage(), "test", new PopupMenu());  
	        trayIcon.setImageAutoSize(true);
	        try {
				tray.add(trayIcon);//显示托盘图标
			} catch (AWTException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
	        
	        trayIcon.addMouseListener(new MouseAdapter() {         	  
	            public void mouseClicked(MouseEvent e) {  
	  
	                if (e.getClickCount() == 1) {// 单击 1 双击 2  
	                    setVisible(true);  
	                    setExtendedState(JFrame.NORMAL);  
	                    toFront(); //此窗口可见 
	                }  
	            }    
	        }); 
}

然后老师上课讲了数据库的存储过程,触发器,视图,索引(key),还有函数没有说,嗯,是这样的,还有数据库的事务:

package pm;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class DatabaseCommit {
    public static void main(String[] args) {
		Connection connection = null;
		PreparedStatement ppst =null;
		String sql1="";
		String sql2="";
		try {
			CallableStatement callableStatement = connection.prepareCall("call new_pre()");//调用存储过程
		} catch (SQLException e2) {
			// TODO Auto-generated catch block
			e2.printStackTrace();
		}
		try {
			try {
				connection=JDBCUtil.getConnection();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			connection.setAutoCommit(false);//取消自动提交
			ppst=connection.prepareStatement(sql1);
			ppst.executeUpdate();
			ppst=connection.prepareStatement(sql2);
			ppst.executeUpdate();
			connection.commit();
		}catch (SQLException e) {
			// TODO: handle exception
			System.out.println("roollback");
			try {
				connection.rollback();//失败回滚
			} catch (SQLException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		}
		
	
	try {
		connection.setAutoCommit(false);
	
		for(int i = 1;i<100;i++) {
				ppst.setInt(1, 1);
				ppst.setInt(2, 2);
				ppst.addBatch();//批量操作
		}
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
		try {
			int[] count =ppst.executeBatch();//批量操作

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			ppst.clearBatch();//批量操作
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}

还有单个方法运行:

package pm;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.jupiter.api.Test;

public class TestJunit {
    @Test
    public void ss1() {
    	System.out.println("dddd");
    }
    @BeforeClass
    @Before
    @After
    @AfterClass
    public void ss2() {
    	
    }
}
然后算是就没有什么了,嗯,就这样了,毕竟实在是没有什么好说的了,一天天也就是这样过去,也没有什么好的办法,嗯是这样的,好了,行吧,没有别的什么了,结束。


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值