Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gui;
- import java.sql.*;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- public class test {
- private JFrame frame; //My code
- private Connection con;//
- private Statement st;//
- private ResultSet rs;//
- private PreparedStatement prep;//
- private String query;//
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- test window = new test();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public test() throws Exception {
- Class.forName("com.mysql.jdbc.Driver"); //this is my code(go in reference library)
- con= DriverManager.getConnection("jdbc:mysql://localhost/test?user=root"); //
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frame = new JFrame();
- frame.setBounds(100, 100, 450, 300);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- }
Add Comment
Please, Sign In to add comment