三国武将查询系统//Java访问数据库(一)

2015-07-24 10:44:43 · 作者: · 浏览: 21
import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;
import javax.swing.JTextArea;
import javax.swing.JLabel;
import java.awt.Color;
import java.sql.*;
import java.applet.Applet;
import java.applet.AudioClip;
import java.io.File;
import java.net.URL;

public class start extends JFrame {
	private String s=new String();
	private JTextField input = new JTextField();	
	private JTextArea myJTextField = new JTextArea();
	static Connection connection;
	static Statement statement ;
	private JScrollPane scrollBar;
	private final JLabel lblNewLabel_1 = new JLabel("");
	private final JButton btnNewButton_1 = new JButton("\u6309\u667A\u529B\u6392\u5E8F");
	private final JButton button = new JButton("\u6309\u6B66\u529B\u6392\u5E8F");
	public start()
	{
		setIconImage(Toolkit.getDefaultToolkit().getImage("D:\\app\\Administrator\\oradata\\mysg\\\u56FE\u6807.png"));
		
		setBounds(80, 20, 1240, 700);
		getContentPane().setLayout(null);
		button.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u6309\u6B66\u529B\u6392\u5E8F.jpg"));
		button.setFont(new Font("楷体", Font.PLAIN, 18));
		button.setBounds(689, 10, 127, 41);
		
		getContentPane().add(button);
		btnNewButton_1.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u6309\u667A\u529B\u6392\u5E8F.jpg"));
		btnNewButton_1.setFont(new Font("楷体", Font.ITALIC, 18));
		btnNewButton_1.setBounds(482, 10, 127, 41);
		button.addActionListener(
new orderlistener()); btnNewButton_1.addActionListener(new orderlistener2()); getContentPane().add(btnNewButton_1); input.setBounds(147, 10, 226, 41); getContentPane().add(input); input.addActionListener(new inputlistener()); myJTextField.setForeground(new Color(255, 0, 0)); myJTextField.setFont(new Font("Monospaced", Font.PLAIN, 13)); myJTextField.setBackground(new Color(255, 255, 102)); myJTextField.setBounds(1, 1, 1000, 600); getContentPane().add(myJTextField); myJTextField.setOpaque(false); JLabel lblNewLabel = new JLabel("\u6B66\u5C06\uFF1A"); lblNewLabel.setFont(new Font("长城行楷体", Font.ITALIC, 28)); lblNewLabel.setBounds(33, 10, 112, 37); getContentPane().add(lblNewLabel); scrollBar = new JScrollPane(myJTextField); scrollBar.setBounds(10, 61, 1000, 600); getContentPane().add(scrollBar); scrollBar.setOpaque(false); scrollBar.getViewport().setOpaque(false); JButton btnNewButton = new JButton("BACK"); btnNewButton.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u8FD4\u56DE.jpg")); btnNewButton.setFont(new Font("长城行楷体", Font.ITALIC, 22)); btnNewButton.setBounds(898, 13, 94, 30); getContentPane().add(btnNewButton); lblNewLabel_1.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u80CC\u666F.jpg")); lblNewLabel_1.setBounds(0, 0, 1240, 700); getContentPane().add(lblNewLabel_1); btnNewButton.addActionListener(new backlistener()); myJTextField.append("姓"+"\t\t"+"字"+"\t\t"+"武力"+"\t\t"+"智力"+"\t\t"+"德行"+"\t\t"+"兵器"