Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. import java.awt.FlowLayout;
  2. import java.awt.GridLayout;
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5. import java.awt.event.KeyEvent;
  6. import java.awt.event.KeyListener;
  7. import java.util.ArrayList;
  8.  
  9. import javax.swing.JButton;
  10. import javax.swing.JFrame;
  11. import javax.swing.JOptionPane;
  12.  
  13.  
  14. public class EarthQuake_Trigger extends JFrame {
  15.  
  16.  
  17.  
  18. private JButton btnInsert1, btnInsert2, btnInsert3;
  19. public EarthQuake_Trigger() {
  20.  
  21. this.setSize(400,400);
  22. this.setLocationRelativeTo(null);
  23. this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  24. this.setLayout(new GridLayout(3, 2, 1,1 ));
  25. this.AddComponent();
  26.  
  27.  
  28.  
  29.  
  30. }
  31.  
  32. public void AddComponent() {
  33.  
  34. ButtonHandler rh = new ButtonHandler();
  35.  
  36. btnInsert1=new JButton("BANGLADESH");
  37. btnInsert1.addActionListener(rh);
  38. add(btnInsert1);
  39.  
  40. btnInsert2=new JButton("NEW_ZEALAND");
  41. btnInsert2.addActionListener(rh);
  42. add(btnInsert2);
  43.  
  44. btnInsert3=new JButton("INDIA");
  45. btnInsert3.addActionListener(rh);
  46. add(btnInsert3);
  47.  
  48. }
  49. public class ButtonHandler implements ActionListener
  50. {
  51.  
  52. @Override
  53. public void actionPerformed(ActionEvent e) {
  54.  
  55. if(e.getSource()==btnInsert1)
  56. {
  57. callInsert1();
  58. }
  59. }
  60.  
  61. private void callInsert1() {
  62.  
  63. boolean result= KernelDB.Insertdata1("EarthQuake");
  64. if(result)
  65.  
  66. JOptionPane.showMessageDialog(null, "Message Triggered");
  67.  
  68. else
  69. JOptionPane.showMessageDialog(null, "SEND AGAIN");
  70.  
  71.  
  72. }
  73.  
  74.  
  75.  
  76. }
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement