Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void initialize() {
- frame = new JFrame("Patikra.lt | Pagrindinis Menu");
- frame.setBounds(100, 100, 650, 450);
- frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- frame.getContentPane().setLayout(null);
- JScrollPane scrollPane = new JScrollPane();
- scrollPane.setBounds(10, 11, 259, 333);
- panel_1.add(scrollPane);
- table = new JTable();
- scrollPane.setViewportView(table);
- JButton perkrauti = new JButton("Perkrauti su0105rau0161u0105.");
- perkrauti.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection conn = null;
- conn = DriverManager.getConnection("jdbc:mysql://IP/db","root", "pass");
- System.out.print("Database is connected !");
- conn.close();
- }
- catch(Exception e1){
- System.out.print("Do not connect to DB - Error:"+e1);
- }
- }
- });
- perkrauti.setBounds(407, 377, 157, 23);
- frame.getContentPane().add(perkrauti);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement