Guest User

Untitled

a guest
Apr 20th, 2017
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. package gui;
  2.  
  3. import java.sql.*;
  4. import java.awt.EventQueue;
  5.  
  6. import javax.swing.JFrame;
  7.  
  8. public class test {
  9.  
  10. private JFrame frame; //My code
  11. private Connection con;//
  12. private Statement st;//
  13. private ResultSet rs;//
  14. private PreparedStatement prep;//
  15. private String query;//
  16.  
  17. /**
  18. * Launch the application.
  19. */
  20. public static void main(String[] args) {
  21. EventQueue.invokeLater(new Runnable() {
  22. public void run() {
  23. try {
  24. test window = new test();
  25. window.frame.setVisible(true);
  26. } catch (Exception e) {
  27. e.printStackTrace();
  28. }
  29. }
  30. });
  31. }
  32.  
  33. /**
  34. * Create the application.
  35. */
  36. public test() throws Exception {
  37. Class.forName("com.mysql.jdbc.Driver"); //this is my code(go in reference library)
  38. con= DriverManager.getConnection("jdbc:mysql://localhost/test?user=root"); //
  39. initialize();
  40. }
  41.  
  42. /**
  43. * Initialize the contents of the frame.
  44. */
  45. private void initialize() {
  46. frame = new JFrame();
  47. frame.setBounds(100, 100, 450, 300);
  48. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  49. }
  50.  
  51. }
Add Comment
Please, Sign In to add comment