package dao; import java.awt.Cursor; import java.awt.EventQueue; import java.awt.Image; import java.awt.Point; import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JButton; import java.awt.event.ActionListener; import java.io.FileInputStream; import java.io.IOException; import java.sql.SQLException; import java.awt.event.ActionEvent; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.ImageIcon; import javax.swing.JToggleButton; import javax.swing.JSeparator; import javax.swing.JProgressBar; import javax.swing.SwingConstants; //import sun.audio.AudioPlayer; //import sun.audio.AudioStream; import java.awt.Color; import java.awt.Font; public class LOL1 { private JFrame frame; public JTextField textField; private JButton btnNewButton; private JButton btnNewButton_1; private JButton btnNewButton_2; private JButton btnNewButton_3; private JButton btnNewButton_4; private JLabel lblNewLabel_1; private JLabel lblNewLabel; private JButton btnNewButton_6; public JFrame getFrame() { return frame; } public JTextField getTextField() { return textField; } /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { LOL1 window = new LOL1(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public LOL1() { initComponents(); } /** * Initialize the contents of the frame. */ public static class image{ public static int I=1; public static int NUM; } private void initComponents() { frame = new JFrame("符文之地英雄情报中心"); frame.setBounds(100, 100, 927, 511); frame.setIconImage(Toolkit.getDefaultToolkit().getImage(LOL1.class.getResource("/LOLimage/game.png")));//左上角图标 //frame.setUndecorated(true);// 取消窗体修饰效果 //frame.getContentPane().setLayout(null);// 窗体使用绝对布局 frame.setLocationRelativeTo(null);// 窗体居中 //frame.setAlwaysOnTop(true); //窗体最顶层显示*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); lblNewLabel_1 = new JLabel();//背景图 lblNewLabel_1.setForeground(Color.WHITE); lblNewLabel_1.setIcon(new ImageIcon(LOL1.class.getResource("/LOLimage/map3.jpg"))); lblNewLabel_1.setBounds(0, 0, 911, 485); JButton button = new JButton("\u67E5\u8BE2");//查询 button.setForeground(Color.WHITE); button.setFont(new Font("华文彩云", Font.BOLD, 22)); button.setBounds(473, 175, 100, 34); //btnNewButton.setBorderPainted(false);//不打印边框 //button.setBorder(null);//除去边框 button.setFocusPainted(false);//除去焦点的框 button.setContentAreaFilled(false);//除去默认的背景填充 button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { image.I=1; lblNewLabel_1.setIcon(new ImageIcon(LOL1.class.getResource("/LOLimage/"+textField.getText()+"-1.jpg"))); Sqljiall sqlskin=new Sqljiall(textField.getText()); try { image.NUM=sqlskin.skinnum();//返回查找到的皮肤数量 } catch (SQLException e1) { // TODO 自动生成的 catch 块 e1.printStackTrace(); } } }); frame.getContentPane().add(button); textField = new JTextField();//文本框 textField.setFont(new Font("楷体", Font.BOLD, 22)); textField.setForeground(Color.WHITE); textField.setToolTipText("\u8F93\u5165\u8981\u67E5\u8BE2\u7684\u82F1\u96C4\uFF01"); textField.setBounds(311, 175, 123, 34); frame.getContentPane().add(textField); textField.setColumns(10); textField.setOpaque(false);//设置背景透明 btnNewButton = new JButton("\u88AB\u52A8");//被动 btnNewButton.setForeground(Color.WHITE); //btnNewButton.setBorderPainted(false);//不打印边框 //btnNewButton.setBorder(null);//除去边框 btnNewButton.setFocusPainted(false);//除去焦点的框 btnNewButton.setContentAreaFilled(false);//除去默认的背景填充 btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Kill kill=new Kill("b",textField.getText());//实例化技能界面 传入键位和英雄名称 kill.initialize();//执行界面显示方法 kill.getFrame().setVisible(true); } }); btnNewButton.setBounds(87, 265, 106, 44); frame.getContentPane().add(btnNewButton); //以下 与 被动 相似 btnNewButton_1 = new JButton("Q\u6280\u80FD");//Q技能 btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Kill kill=new Kill("q",textField.getText()); kill.initialize(); kill.getFrame().setVisible(true); } }); btnNewButton_1.setForeground(Color.WHITE); btnNewButton_1.setFocusPainted(false);//除去焦点的框 btnNewButton_1.setContentAreaFilled(false);//除去默认的背景填充 btnNewButton_1.setBounds(254, 265, 106, 44); frame.getContentPane().add(btnNewButton_1); btnNewButton_2 = new JButton("W\u6280\u80FD");//W技能 btnNewButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Kill kill=new Kill("w",textField.getText()); kill.initialize(); kill.getFrame().setVisible(true); } }); btnNewButton_2.setForeground(Color.WHITE); btnNewButton_2.setFocusPainted(false);//除去焦点的框 btnNewButton_2.setContentAreaFilled(false);//除去默认的背景填充 btnNewButton_2.setBounds(411, 265, 106, 44); frame.getContentPane().add(btnNewButton_2); btnNewButton_3 = new JButton("E\u6280\u80FD");//E技能 btnNewButton_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Kill kill=new Kill("e",textField.getText()); kill.initialize(); kill.getFrame().setVisible(true); } }); btnNewButton_3.setForeground(Color.WHITE); btnNewButton_3.setFocusPainted(false);//除去焦点的框 btnNewButton_3.setContentAreaFilled(false);//除去默认的背景填充 btnNewButton_3.setBounds(577, 265, 106, 44); frame.getContentPane().add(btnNewButton_3); btnNewButton_4 = new JButton("R\u6280\u80FD");//R技能 btnNewButton_4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Kill kill=new Kill("r",textField.getText()); kill.initialize(); kill.getFrame().setVisible(true); } }); btnNewButton_4.setForeground(Color.WHITE); btnNewButton_4.setFocusPainted(false);//除去焦点的框 btnNewButton_4.setContentAreaFilled(false);//除去默认的背景填充 btnNewButton_4.setBounds(730, 265, 106, 44); frame.getContentPane().add(btnNewButton_4); JButton leftNewButton = new JButton("");//上一张 leftNewButton.setIcon(new ImageIcon(LOL1.class.getResource("/LOLimage/\u4E0A\u4E00\u5F20.png"))); leftNewButton.setFocusPainted(false);//除去焦点的框 leftNewButton.setBorder(null);//除去边框 leftNewButton.setContentAreaFilled(false);//除去默认的背景填充 leftNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { image.I--; if(image.I!=0) lblNewLabel_1.setIcon(new ImageIcon(LOL1.class.getResource("/LOLimage/"+textField.getText()+"-"+image.I+".jpg"))); else { JOptionPane.showMessageDialog(null,"这是"+textField.getText()+"的原画!"); image.I=1; } } }); leftNewButton.setToolTipText("\u4E0A\u4E00\u5F20"); leftNewButton.setBounds(10, 175, 51, 51); frame.getContentPane().add(leftNewButton); JButton rightNewButton = new JButton("");//下一张 rightNewButton.setIcon(new ImageIcon(LOL1.class.getResource("/LOLimage/\u4E0B\u4E00\u5F20 .png"))); rightNewButton.setFocusPainted(false);//除去焦点的框 rightNewButton.setBorder(null);//除去边框 rightNewButton.setContentAreaFilled(false);//除去默认的背景填充 rightNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { image.I++; if(image.I!=image.NUM+1)//image.NUM皮肤数量 lblNewLabel_1.setIcon(new ImageIcon(LOL1.class.getResource("/LOLimage/"+textField.getText()+"-"+image.I+".jpg"))); else { JOptionPane.showMessageDialog(null,"已经是"+textField.getText()+"的最后一个皮肤了!"); image.I=11; } } }); rightNewButton.setToolTipText("\u4E0B\u4E00\u5F20"); rightNewButton.setBounds(851, 175, 51, 51); frame.getContentPane().add(rightNewButton); JButton btnNewButton_5 = new JButton("");//关于 btnNewButton_5.setToolTipText("\u5173\u4E8E\u6211\u4EEC"); //btnNewButton_5.setFocusPainted(false);//除去焦点的框 //btnNewButton_5.setBorderPainted(false);//不打印边框 btnNewButton_5.setBorder(null);//除去边框 btnNewButton_5.setContentAreaFilled(false);//除去默认的背景填充 btnNewButton_5.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { About about=new About(); about.getFrame().setVisible(true); } }); btnNewButton_5.setIcon(new ImageIcon(LOL1.class.getResource("/LOLimage/\u5173\u4E8E.png"))); btnNewButton_5.setBounds(867, 429, 34, 34); frame.getContentPane().add(btnNewButton_5); btnNewButton_6 = new JButton("");//退出登录 btnNewButton_6.setIcon(new ImageIcon(LOL1.class.getResource("/LOLimage/\u9000\u51FA.png"))); btnNewButton_6.setToolTipText("\u9000\u51FA\u767B\u5F55"); //btnNewButton_6.setBorder(null);//除去边框 btnNewButton_6.setContentAreaFilled(false);//除去默认的背景填充 btnNewButton_6.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frame.setVisible(false); Login login=new Login(); login.getFrame().setVisible(true); } });//按钮事件 btnNewButton_6.setBounds(867, 10, 34, 34); frame.getContentPane().add(btnNewButton_6); frame.getContentPane().add(lblNewLabel_1); } }
最近下载更多