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"+"兵器"+"\t\t"+"招募地"+"\t\t"+"坐骑\n");
} class inputlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
myJTextField.setText("姓"+"\t\t"+"字"+"\t\t"+"武力"+"\t\t"+"智力"+"\t\t"+"德行"+"\t\t"+"兵器"+"\t\t"+"招募地"+"\t\t"+"坐骑\n");
try{
s=input.getText();
String temps=new String();
if(s.equals("all"))
{
temps="select * from v_hero ";
}
else
{
temps="select * from v_hero where 姓名='"+s+"'";
}
//System.out.println(temps);
ResultSet res=statement.executeQuery(temps);
while(res.next())
{
myJTextField.append(res.getString(1)+"\t"+res.getString(2)+"\t\t"+res.getString(3)+"\t\t"+res.getString(4)+"\t\t"+res.getString(5)+"\t"+res.getString(6)+"\t"+res.getString(7)+"\t"+res.getString(8)+"\n");
} }catch(SQLException ss )
{
myJTextField.append("error!");
}
}
}
class orderlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
myJTextField.setText("姓"+"\t\t"+"字"+"\t\t"+"武力"+"\t\t"+"智力"+"\t\t"+"德行"+"\t\t"+"兵器"+"\t\t"+"招募地"+"\t\t"+"坐骑\n");
try{ String temps=new String();
temps="select * from v_hero order by 武力 desc";
ResultSet res=statement.executeQuery(temps);
while(res.next())
{
myJTextField.append(res.getString(1)+"\t"+res.getString(2)+"\t\t"+res.getString(3)+"\t\t"+res.getString(4)+"\t\t"+res.getString(5)+"\t"+res.getString(6)+"\t"+res.getString(7)+"\t"+res.getString(8)+"\n");
}
}catch(SQLException ss )
{
myJTextField.append("error!");
}
}
}
class orderlistener2 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
myJTextField.setText("姓"+"\t\t"+"字"+"\t\t"+"武力"+"\t\t"+"智力"+"\t\t"+"德行"+"\t\t"+"兵器"+"\t\t"+"招募地"+"\t\t"+"坐骑\n");
try{
String temps=new String();
temps="select * from v_hero order by 智力 desc";
ResultSet res=statement.executeQuery(temps);
while(res.next())
{
myJTextField.append(res.getString(1)+"\t"+res.getString(2)+"\t\t"+res.getString(3)+"\t\t"+res.getString(4)+"\t\t"+res.getString(5)+"\t"+res.getString(6)+"\t"+res.getString(7)+"\t"+res.getString(8)+"\n");
}
}catch(SQLException ss )
{
myJTextField.append("error!");
}
}
}
class backlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
start.this.setVisible(false);
Login f9=new Login();
f9.setVisible(true);
}
} public static void main(String[] args)
throws SQLException,ClassNotFoundException
{
//new music(); // System.out.println("ssss");
Class.forName("oracle.jdbc.driver.OracleDriver");
connection =DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:MYSG","scott","scott");
statement =connection.createStatement(); Login log=new Login();
log.setVisible(true);
new music().play(new File("F:\\cc.wav"));
//start one= new start(); //one.setVisible(true);
}
}


import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JButton; import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Toolkit; public class Login extends JFrame {
private JPanel contentPane;
public Login()
{
setIconImage(Toolkit.getDefaultToolkit().getImage("D:\\app\\Administrator\\oradata\\mysg\\\u56FE\u6807.png")); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Three Kingdoms of heroes system");
setBounds(80, 20, 1240, 700);
contentPane = new JPanel();
contentPane.setBackground(new Color(240, 240, 240));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null); JButton btnNewButton = new JButton("New button");
btnNewButton.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\1308051010460_\u526F\u672C_\u526F\u672Cwww.jpg"));
btnNewButton.setBounds(46, 344, 240, 45);
contentPane.add(btnNewButton);
btnNewButton.addActionListener(new presslistener()); JButton btnNewButton_1 = new JButton("New button");
btnNewButton_1.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\1308051010460_\u526F\u672C_\u526F\u672C_\u526F\u672Cwwwg.jpg"));
btnNewButton_1.setBounds(46, 444, 240, 47);
contentPane.add(btnNewButton_1);
btnNewButton_1.addActionListener(new presslistener2()); JLabel lblNewLabel = new JLabel("");
lblNewLabel.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\13126052172554n4gg4569www.png"));
lblNewLabel.setBounds(0, 0,1240, 700);
contentPane.add(lblNewLabel);
}
class presslistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
Login.this.setVisible(false);
select f2=new select();
f2.setVisible(true); }
}
class presslistener2 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
Login.this.setVisible(false);
dba f3=new dba();
f3.setVisible(true);
}
}
}
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import java.awt.Toolkit; public class select extends JFrame { private JPanel contentPane; public select() {
setIconImage(Toolkit.getDefaultToolkit().getImage("D:\\app\\Administrator\\oradata\\mysg\\\u56FE\u6807.png"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(0, 0, 1240, 700);
setTitle("选择模式"); contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null); JButton btnNewButton = new JButton("New button");
btnNewButton.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u82F1\u96C41.jpg"));
btnNewButton.setBounds(49, 307, 180, 48);
contentPane.add(btnNewButton);
btnNewButton.addActionListener(new presslistener()); JButton btnNewButton_1 = new JButton("New button");
btnNewButton_1.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u8BF8\u4FAF1.jpg"));
btnNewButton_1.setBounds(49, 407, 180, 48);
contentPane.add(btnNewButton_1);
btnNewButton_1.addActionListener(new presslistener2()); JButton btnNewButton_2 = new JButton("New button");
btnNewButton_2.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u6218\u4E891.jpg"));
btnNewButton_2.setBounds(49, 507, 180, 48);
contentPane.add(btnNewButton_2);
btnNewButton_2.addActionListener(new presslistener3()); JLabel label = new JLabel("");
label.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\90e150338ea4ea55a65527cef1cddded_\u526F\u672C.jpg"));
label.setBounds(0, 0, 1240, 700);
contentPane.add(label); }
class presslistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
select.this.setVisible(false);
start f4=new start();
f4.setVisible(true);
}
}
class presslistener2 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
select.this.setVisible(false);
country f5=new country();
f5.setVisible(true);
}
}
class presslistener3 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
select.this.setVisible(false);
war f6=new war();
f6.setVisible(true);
}
} }
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import java.sql.SQLException; import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.ImageIcon;
import java.awt.Toolkit; public class country extends JFrame { private JPanel contentPane;
private String s=new String();
private String s2=new String();
private JTextField input = new JTextField();
private JTextField input2 = new JTextField();
private JTextArea myJTextField = new JTextArea();
private JScrollPane scrollBar;
private final JLabel label = new JLabel("\u6B66\u5C06\uFF1A");
private final JLabel label_1 = new JLabel("\u4E3B\u516C\uFF1A"); public country() {
setIconImage(Toolkit.getDefaultToolkit().getImage("D:\\app\\Administrator\\oradata\\mysg\\\u56FE\u6807.png"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("武将从属查询");
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
setBounds(80, 20, 1240, 700);
getContentPane().setLayout(null);
//myJTextField.setOpaque(false); input.setBounds(183, 10, 190, 41);
getContentPane().add(input);
input.addActionListener(new inputlistener()); input2.setBounds(480, 10, 205, 41);
getContentPane().add(input2);
input2.addActionListener(new inputlistener());
myJTextField.setForeground(new Color(255, 0, 0)); myJTextField.setFont(new Font("Monospaced", Font.PLAIN, 13));
myJTextField.setBackground(new Color(255, 245, 238));
myJTextField.setBounds(10, 61, 1000, 629);
getContentPane().add(myJTextField);
input.setBounds(147, 10, 226, 41); scrollBar = new JScrollPane(myJTextField);
scrollBar.setBounds(10, 61, 1000, 629);
getContentPane().add(scrollBar);
label.setFont(new Font("长城行楷体", Font.ITALIC, 28));
label.setBounds(42, 10, 95, 39); myJTextField.setOpaque(false);
scrollBar.setOpaque(false);
scrollBar.getViewport().setOpaque(false); contentPane.add(label);
label_1.setFont(new Font("长城行楷体", Font.ITALIC, 28));
label_1.setBounds(393, 12, 95, 39); contentPane.add(label_1); JButton btnNewButton = new JButton("BACK");
btnNewButton.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u8FD4\u56DE.jpg"));
btnNewButton.setForeground(new Color(255, 0, 0));
btnNewButton.setFont(new Font("长城行楷体", Font.ITALIC, 22));
btnNewButton.setBounds(1061, 21, 95, 30);
getContentPane().add(btnNewButton); JLabel lblNewLabel = new JLabel("");
lblNewLabel.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u57CE\u5E02.jpg"));
lblNewLabel.setBounds(0, 0, 1240, 700);
contentPane.add(lblNewLabel);
btnNewButton.addActionListener(new backlistener());
} class inputlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{ try{
s=input.getText();
s2=input2.getText();
String temps=new String();
if(s2.equals("all"))
{
myJTextField.setText("主公名"+"\t\t"+"现役武将数"+"\t\t"+"兵力\n");
temps="select hname,num_of_hero,num_of_army from country,hero where country.ono=hero.hno";
ResultSet res=start.statement.executeQuery(temps);
while(res.next())
{
myJTextField.append(res.getString(1)+"\t\t"+res.getString(2)+"\t\t"+res.getString(3)+"\t\t"+"\n");
}
}
else if(s.equals("all"))
{
myJTextField.setText("武将"+"\t\t "+"主公"+"\t\t "+"忠诚"+"\t\t "+"时期\n");
temps="select * from v_hero_owner";
ResultSet res=start.statement.executeQuery(temps);
while(res.next())
{
myJTextField.append(res.getString(1)+"\t\t"+res.getString(2)+"\t\t"+res.getString(3)+"\t\t"+res.getString(4)+"\n");
}
}
else
{
myJTextField.setText("武将"+"\t\t "+"主公"+"\t\t "+"忠诚"+"\t\t "+"时期\n");
temps="select * from v_hero_owner where 武将='"+s+"' and 主公='"+s2+"'";
ResultSet res=start.statement.executeQuery(temps);
while(res.next())
{
myJTextField.append(res.getString(1)+"\t\t"+res.getString(2)+"\t\t"+res.getString(3)+"\t\t"+res.getString(4)+"\n");
}
}
System.out.println(temps); }catch(SQLException ss )
{
myJTextField.append("error!");
}
}
}
class backlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
country.this.setVisible(false);
Login f9=new Login();
f9.setVisible(true);
}
}
}
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import java.sql.SQLException; import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.swing.ImageIcon;
import java.awt.Toolkit; public class war extends JFrame { private JPanel contentPane;
private String s=new String();
private String s2=new String();
private JTextField input = new JTextField();
private JTextField input2 = new JTextField();
private JTextArea myJTextField = new JTextArea();
private JScrollPane scrollBar;
private final JLabel label = new JLabel("\u6B66\u5C06\uFF1A");
private final JLabel label_1 = new JLabel("\u6218\u4E89\uFF1A"); public war() {
setIconImage(Toolkit.getDefaultToolkit().getImage("D:\\app\\Administrator\\oradata\\mysg\\\u56FE\u6807.png"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("战争战绩查询");
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
setBounds(80, 20, 1240, 700);
getContentPane().setLayout(null); input.setBounds(183, 10, 190, 41);
getContentPane().add(input);
input.addActionListener(new inputlistener()); input2.setBounds(491, 10, 231, 41);
getContentPane().add(input2);
input2.addActionListener(new inputlistener());
myJTextField.setForeground(new Color(255, 0, 0)); myJTextField.setFont(new Font("Monospaced", Font.PLAIN, 13));
myJTextField.setBackground(Color.YELLOW);
myJTextField.setBounds(10, 61, 1000, 600);
getContentPane().add(myJTextField);
input.setBounds(147, 10, 226, 41); scrollBar = new JScrollPane(myJTextField);
scrollBar.setBounds(10, 61, 1000, 600);
getContentPane().add(scrollBar);
label.setFont(new Font("长城行楷体", Font.ITALIC, 27));
label.setBounds(35, 10, 91, 38); contentPane.add(label);
label_1.setFont(new Font("长城行楷体", Font.ITALIC, 27));
label_1.setBounds(386, 10, 91, 38); contentPane.add(label_1); myJTextField.setOpaque(false);
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(1102, 13, 91, 30);
getContentPane().add(btnNewButton); JLabel lblNewLabel = new JLabel("");
lblNewLabel.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u6218\u4E89.jpg"));
lblNewLabel.setBounds(0, 0, 1240, 700);
contentPane.add(lblNewLabel);
btnNewButton.addActionListener(new backlistener());
}
class inputlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{ try{
s=input.getText();
s2=input2.getText();
String temps=new String();
if(s.equals("all"))
{
myJTextField.setText("武将名"+"\t\t\t"+"參加的战争"+"\t\t\t"+"主要战绩\n");
temps="select * from v_hero_war ";
ResultSet res=start.statement.executeQuery(temps);
while(res.next())
{
myJTextField.append(res.getString(1)+"\t\t"+res.getString(2)+"\t\t"+res.getString(3)+"\t\t"+"\n");
}
}
else if(s2.equals("all"))
{
myJTextField.setText("战争名"+"\t\t "+"參战阵营"+"\t\t "+"战果"+"\t\t "+"战争地点"+"\t\t\t\t"+"时间\n");
temps="select * from war";
ResultSet res=start.statement.executeQuery(temps);
while(res.next())
{
myJTextField.append(res.getString(1)+"\t\t"+res.getString(2)+"\t\t"+res.getString(3)+"\t\t"+res.getString(4)+"\t\t"+res.getString(5)+"\n");
}
}
else
{
myJTextField.setText("武将名"+"\t\t\t"+"參加的战争"+"\t\t\t"+"主要战绩\n");
temps="select * from v_hero_war where 武将='"+s+"' and 战争='"+s2+"'";
ResultSet res=start.statement.executeQuery(temps);
while(res.next())
{
myJTextField.append(res.getString(1)+"\t\t"+res.getString(2)+"\t\t"+res.getString(3)+"\n");
}
}
System.out.println(temps); }catch(SQLException ss )
{
myJTextField.append("error!");
}
}
}
class backlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
war.this.setVisible(false);
Login f9=new Login();
f9.setVisible(true);
}
}
}
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import java.awt.Font;
import java.awt.Color;
import java.awt.Toolkit; public class dba extends JFrame { private JPanel contentPane;
public dba() {
setIconImage(Toolkit.getDefaultToolkit().getImage("D:\\app\\Administrator\\oradata\\mysg\\\u56FE\u6807.png"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(80, 20, 1240, 700);
setTitle("欢迎管理");
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null); JButton btnNewButton = new JButton("\u589E\u52A0\u6B66\u5C06");
btnNewButton.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u589E\u52A0\u6B66\u5C06.jpg"));
btnNewButton.setForeground(new Color(255, 0, 0));
btnNewButton.setBackground(new Color(105, 105, 105));
btnNewButton.setFont(new Font("长城行楷体", Font.ITALIC, 28));
btnNewButton.setBounds(80, 81, 164, 42);
contentPane.add(btnNewButton);
btnNewButton.addActionListener(new addlistener()); JButton btnNewButton_1 = new JButton("\u5220\u9664\u6B66\u5C06");
btnNewButton_1.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\\u5220\u9664\u6B66\u5C06.jpg"));
btnNewButton_1.setForeground(new Color(255, 0, 0));
btnNewButton_1.setFont(new Font("长城行楷体", Font.ITALIC, 28));
btnNewButton_1.setBounds(973, 81, 164, 42);
contentPane.add(btnNewButton_1); JLabel lblNewLabel = new JLabel("");
lblNewLabel.setIcon(new ImageIcon("D:\\app\\Administrator\\oradata\\mysg\\Three_Kingdoms.jpg"));
lblNewLabel.setBounds(0, 0, 1240, 700);
contentPane.add(lblNewLabel);
btnNewButton_1.addActionListener(new deletelistener());
}
class addlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
dba.this.setVisible(false);
addhero f7=new addhero();
f7.setVisible(true);
}
}
class deletelistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
dba.this.setVisible(false);
deletehero f8=new deletehero();
f8.setVisible(true);
}
} }
import java.awt.BorderLayout;
import java.awt.EventQueue; import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import java.sql.SQLException; public class addhero extends JFrame { private JPanel contentPane;
private JTextField []textField=new JTextField[6];
//private JTextField textField_1;
//private JTextField textField_2;
//Field textField_3;
//private JTextField textField_4;
//private JTextField textField_5; JFrame tt;
public addhero() {
setTitle("添加英雄");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(50, 50, 1000, 701);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
getContentPane().setLayout(null); for(int i=0;i<6;i++)
textField[i] = new JTextField();
textField[0].setBounds(93, 24, 220, 37);
contentPane.add(textField[0]);
textField[0].setColumns(10); System.out.println("sadas");
//textField[1] = new JTextField();
textField[1].setColumns(10);
textField[1].setBounds(93, 91, 220, 37);
contentPane.add(textField[1]); //textField[2]= new JTextField();
textField[2].setColumns(10);
textField[2].setBounds(93, 158, 220, 37);
contentPane.add(textField[2]); //textField[3] = new JTextField();
textField[3].setColumns(10);
textField[3].setBounds(93, 222, 220, 37);
contentPane.add(textField[3]); //textField[4] = new JTextField();
textField[4].setColumns(10);
textField[4].setBounds(93, 283, 220, 37);
contentPane.add(textField[4]); //textField[5] = new JTextField();
textField[5].setColumns(10);
textField[5].setBounds(93, 349, 220, 37);
contentPane.add(textField[5]); for(int i=0;i<6;i++)
textField[i].addActionListener(new addlistener2()); JLabel label = new JLabel("\u6B66\u5C06\u540D");
label.setFont(new Font("长城行楷体", Font.PLAIN, 21));
label.setBounds(10, 24, 73, 37);
contentPane.add(label); JLabel label_1 = new JLabel("\u5B57");
label_1.setFont(new Font("长城行楷体", Font.PLAIN, 21));
label_1.setBounds(10, 91, 73, 37);
contentPane.add(label_1); JLabel label_2 = new JLabel("\u6B66\u529B");
label_2.setFont(new Font("长城行楷体", Font.PLAIN, 21));
label_2.setBounds(10, 158, 73, 37);
contentPane.add(label_2); JLabel label_3 = new JLabel("\u667A\u529B");
label_3.setFont(new Font("长城行楷体", Font.PLAIN, 21));
label_3.setBounds(10, 222, 73, 37);
contentPane.add(label_3); JLabel label_4 = new JLabel("\u54C1\u5FB7");
label_4.setFont(new Font("长城行楷体", Font.PLAIN, 21));
label_4.setBounds(10, 283, 73, 37);
contentPane.add(label_4); JLabel label_5 = new JLabel("\u6B66\u5668");
label_5.setFont(new Font("长城行楷体", Font.PLAIN, 21));
label_5.setBounds(10, 349, 73, 37);
contentPane.add(label_5);
}
class addlistener2 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
try{ String []s=new String[6];
for(int i=0;i<6;i++)
{
s[i]=new String();
s[i]=textField[i].getText();
} String temps=new String();
temps="insert into hero values(null,'"+s[0]+"','"+s[1]+"',"+s[2]+","+s[3]+","+s[4]+",'"+s[5]+"',null,null)"; System.out.println(temps);
ResultSet res=start.statement.executeQuery(temps);
tt=new JFrame();
tt.setBounds(100, 100, 500, 80);
JButton ta = new JButton("恭喜!武将"+s[0]+"加入成功! 点击返回");
tt.add(ta);
tt.setVisible(true);
ta.addActionListener(new backlistener());
}catch(SQLException ss )
{
textField[0].setText("error!");
}
}
}
class backlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
addhero.this.setVisible(false);
tt.setVisible(false);
dba f8=new dba();
f8.setVisible(true);
}
}
}
import java.awt.BorderLayout;
import java.awt.EventQueue; import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import java.sql.SQLException; public class deletehero extends JFrame { private JPanel contentPane;
private JTextField textField;
JFrame tt;
public deletehero() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("删除英雄");
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null); textField = new JTextField();
textField.setBounds(125, 55, 195, 63);
contentPane.add(textField);
textField.setColumns(10);
textField.addActionListener(new deletelistener()); JLabel label = new JLabel("\u6B66\u5C06\u540D");
label.setFont(new Font("长城行楷体", Font.ITALIC, 30));
label.setBounds(10, 55, 105, 63);
contentPane.add(label);
}
class deletelistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
try{ String s=new String();
s=textField.getText();
String temps=new String();
temps="delete from hero where hname='"+s+"'"; System.out.println(temps);
ResultSet res=start.statement.executeQuery(temps);
tt=new JFrame();
tt.setBounds(100, 100, 500, 80);
JButton ta = new JButton("恭喜!武将"+s+"删除成功! 点击返回");
tt.add(ta);
tt.setVisible(true);
ta.addActionListener(new backlistener());
}catch(SQLException ss )
{
textField.setText("error!");
}
}
}
class backlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
deletehero.this.setVisible(false);
tt.setVisible(false);
dba f8=new dba();
f8.setVisible(true);
}
}
}
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.SourceDataLine;
import java.io.File; public class music{
private AudioInputStream stream = null;
private AudioFormat format = null;
private SourceDataLine m_line;
public void play(File fileName)
{
try {
stream = AudioSystem.getAudioInputStream(fileName);
// At present, ALAW and ULAW encodings must be converted
// to PCM_SIGNED before it can be played
format = stream.getFormat();
if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
format = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
format.getSampleRate(),
16,
format.getChannels(),
format.getChannels() * 2,
format.getSampleRate(),
false); // big endian
stream = AudioSystem.getAudioInputStream(format, stream);
}
// Create the clip
DataLine.Info info = new DataLine.Info(SourceDataLine.class, stream.getFormat(), AudioSystem.NOT_SPECIFIED);
m_line = (SourceDataLine) AudioSystem.getLine(info);
m_line.open(stream.getFormat(),m_line.getBufferSize());
m_line.start();
int numRead = 0;
byte[] buf = new byte[m_line.getBufferSize()];
while ((numRead = stream.read(buf, 0, buf.length)) >= 0) {
int offset = 0;
while (offset < numRead) {
offset += m_line.write(buf, offset, numRead-offset);
}
}
m_line.drain();
m_line.stop();
m_line.close();
stream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public double getDuration()
{
return m_line.getBufferSize() /
(m_line.getFormat().getFrameSize() * m_line.getFormat().getFrameRate());
}
public double getDecision()
{
return m_line.getMicrosecondPosition()/1000.0;
} }

三国武将查询系统 //Java 訪问 数据库的更多相关文章

  1. 三国武将查询系统 //Java 访问 数据库

    import java.awt.*; import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event ...

  2. 假设在本地搭一个server和mysql数据库环境,假设使用java来訪问数据库

    我们能够使用speedamp来搭一个server环境,能够在http://download.csdn.net/detail/baidu_nod/7630265下载 解压后无需安装直接能够使用.点击Sp ...

  3. 使用FMDB多线程訪问数据库,及database is locked的问题

    今天最终攻克了多线程同一时候訪问数据库时,报数据库锁定的问题.错误信息是: Unknown error finalizing or resetting statement (5: database i ...

  4. JAVA訪问URL

    JAVA訪问URL: package Test; import java.io.BufferedReader; import java.io.IOException; import java.io.I ...

  5. Java 訪问权限控制:你真的了解 protected keyword吗?

    摘要: 在一个类的内部,其成员(包含成员变量和成员方法)是否能被其它类所訪问,取决于该成员的修饰词:而一个类是否能被其它类所訪问,取决于该类的修饰词.Java的类成员訪问权限修饰词有四类:privat ...

  6. VC++ 訪问数据库实例具体解释图解

    一 ADO 方式訪问 Access 新建一个对话框project,加入控件,如图: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2 ...

  7. Cassandra数据库Java訪问

    针对的时Cassandra 2.0 数据库 Java本地client訪问Cassandra,首先建立Javaproject,使用Maven进行管理. 引入依赖: <dependency> ...

  8. Hadoop HDFS (3) JAVA訪问HDFS

    如今我们来深入了解一下Hadoop的FileSystem类. 这个类是用来跟Hadoop的文件系统进行交互的.尽管我们这里主要是针对HDFS.可是我们还是应该让我们的代码仅仅使用抽象类FileSyst ...

  9. Hadoop HDFS (3) JAVA訪问HDFS之二 文件分布式读写策略

    先把上节未完毕的部分补全,再剖析一下HDFS读写文件的内部原理 列举文件 FileSystem(org.apache.hadoop.fs.FileSystem)的listStatus()方法能够列出一 ...

随机推荐

  1. ArraySegment 的使用 【转载】

    本文转载自 http://www.cnblogs.com/overred/archive/2009/01/17/1359126.html ArraySegment顾名思义就是Array区块,数组的小抽 ...

  2. 给网站设置ICO图标

    方法一:         直接在站点根目录下放入名为:favicon.ico 的图标文件(必须要为 ICO 文件,BMP 及其他格式的图片文件不行).还有将 favicon.ico 中的 favico ...

  3. ElasticSearch 5.2.2 集群环境的搭建

    在之前 ElasticSearch 搭建好之后,我们通过 elasticsearch-header 插件在查看 ES 服务的时候,发现 cluster-health 显示的是 YELLOW. Why? ...

  4. SVN无法提交,路径找不到问题的解决方案

    自己有了个云服务器,只在上面搭建了几个博客网站(小雷网等). 我自己的代码,保存在SVNChina上,每年99元.(私人的付费,开源的免费) 云服务器,闲着也是闲着,决定在上面搭建一个属于自己的SVN ...

  5. tomcat日志配置之一自带log

    问题 tomcat每次启动时,自动在logs目录下生产以下日志文件,且每天都会生成对应日期的一个文件,造成日志文件众多: localhost.2012-07-05.txt catalina.2012- ...

  6. 虚拟机上的Ubuntu开机显示“无法应用原保存的显示器配置”

    如图: 解决方法: 删除monitors.xml 文件 rm ~/.config/monitors.xml

  7. php如何读写excel

    php如何读写excel 一.总结 一句话总结:PHP操作Excel最好的方法是使用PHPExcel类, 可以到官网下载PHPExcel类库 http://phpexcel.codeplex.com ...

  8. Rpm另类用法加固Linux安全

    Rpm另类用法加固Linux安全   RPM是Red Hat Package Manager的缩写即Red Hat软件管理器.它是一个开放的包管理软件,由Red Hat公司所开发和维护,可以在Red ...

  9. BZOJ4044: [Cerc2014] Virus synthesis(回文树+DP)

    Description Viruses are usually bad for your health. How about fighting them with... other viruses? ...

  10. CSRF Failed: Referer checking failed - no Referer

    postman模拟登录出了这个错误,其实看标题就知道大概是怎么回事,网上大概找了办法,也没说到位,所以干脆自己找源码了. 问题很明显就是出在 CSRF 上,理所当然去查看 CsrfViewMiddle ...