Guest User

Untitled

a guest
Apr 17th, 2016
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 11.99 KB | None | 0 0
  1. package millionaire;
  2. import java.sql.*;
  3. /**
  4.  *
  5.  * @author Sidharth Malhotra
  6.  */
  7. public class Questions extends javax.swing.JFrame {
  8. Connection conn;
  9.     PreparedStatement ps;
  10.     ResultSet rs;
  11.     String s = "";
  12.     Statement stmt;
  13.     int id=1;
  14.    
  15.     /**
  16.      * Creates new form Questions
  17.      * @param id
  18.      */
  19.     public void GetQuestion(int id){
  20.    
  21. }
  22.     public Questions() {
  23.         initComponents();
  24.         String driver = "com.mysql.jdbc.Driver";
  25.             Class.forName(driver);
  26.             conn = DriverManager.getConnection("jdbc:mysql://31.220.20.82/u265785190_tecno", "u265785190_sid", "zw8bGeR?p1D*]S");
  27.             System.out.println("Connected!!");
  28.     }
  29.  
  30.     /**
  31.      * This method is called from within the constructor to initialize the form.
  32.      * WARNING: Do NOT modify this code. The content of this method is always
  33.      * regenerated by the Form Editor.
  34.      */
  35.     @SuppressWarnings("unchecked")
  36.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  37.     private void initComponents() {
  38.  
  39.         jDesktopPane1 = new javax.swing.JDesktopPane();
  40.         jLabel2 = new javax.swing.JLabel();
  41.         jLabel1 = new javax.swing.JLabel();
  42.         jLabel3 = new javax.swing.JLabel();
  43.         optionA = new javax.swing.JButton();
  44.         optionB = new javax.swing.JButton();
  45.         optionD = new javax.swing.JButton();
  46.         optionC = new javax.swing.JButton();
  47.  
  48.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  49.  
  50.         jDesktopPane1.setPreferredSize(new java.awt.Dimension(1502, 1303));
  51.  
  52.         jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\Sidharth Malhotra\\Desktop\\millionaire\\QVGM_AFRIQUE_DU_SUD_DETOURE.png")); // NOI18N
  53.  
  54.         jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
  55.         jLabel1.setForeground(new java.awt.Color(255, 255, 255));
  56.         jLabel1.setText("Question:");
  57.  
  58.         jLabel3.setBackground(new java.awt.Color(255, 255, 255));
  59.         jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
  60.         jLabel3.setForeground(new java.awt.Color(255, 255, 255));
  61.         jLabel3.setText("Which of the following is the capital of India?");
  62.  
  63.         optionA.setBackground(new java.awt.Color(0, 0, 255));
  64.         optionA.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
  65.         optionA.setForeground(new java.awt.Color(255, 255, 255));
  66.         optionA.setText("Delhi");
  67.         optionA.addActionListener(new java.awt.event.ActionListener() {
  68.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  69.                 optionAActionPerformed(evt);
  70.             }
  71.         });
  72.  
  73.         optionB.setBackground(new java.awt.Color(0, 0, 255));
  74.         optionB.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
  75.         optionB.setForeground(new java.awt.Color(255, 255, 255));
  76.         optionB.setText("Jammu");
  77.         optionB.addActionListener(new java.awt.event.ActionListener() {
  78.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  79.                 optionBActionPerformed(evt);
  80.             }
  81.         });
  82.  
  83.         optionD.setBackground(new java.awt.Color(0, 0, 255));
  84.         optionD.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
  85.         optionD.setForeground(new java.awt.Color(255, 255, 255));
  86.         optionD.setText("Bangalore");
  87.         optionD.addActionListener(new java.awt.event.ActionListener() {
  88.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  89.                 optionDActionPerformed(evt);
  90.             }
  91.         });
  92.  
  93.         optionC.setBackground(new java.awt.Color(0, 0, 255));
  94.         optionC.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
  95.         optionC.setForeground(new java.awt.Color(255, 255, 255));
  96.         optionC.setText("Kolkata");
  97.         optionC.addActionListener(new java.awt.event.ActionListener() {
  98.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  99.                 optionCActionPerformed(evt);
  100.             }
  101.         });
  102.  
  103.         jDesktopPane1.setLayer(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);
  104.         jDesktopPane1.setLayer(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);
  105.         jDesktopPane1.setLayer(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);
  106.         jDesktopPane1.setLayer(optionA, javax.swing.JLayeredPane.DEFAULT_LAYER);
  107.         jDesktopPane1.setLayer(optionB, javax.swing.JLayeredPane.DEFAULT_LAYER);
  108.         jDesktopPane1.setLayer(optionD, javax.swing.JLayeredPane.DEFAULT_LAYER);
  109.         jDesktopPane1.setLayer(optionC, javax.swing.JLayeredPane.DEFAULT_LAYER);
  110.  
  111.         javax.swing.GroupLayout jDesktopPane1Layout = new javax.swing.GroupLayout(jDesktopPane1);
  112.         jDesktopPane1.setLayout(jDesktopPane1Layout);
  113.         jDesktopPane1Layout.setHorizontalGroup(
  114.             jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  115.             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jDesktopPane1Layout.createSequentialGroup()
  116.                 .addContainerGap(490, Short.MAX_VALUE)
  117.                 .addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  118.                     .addGroup(jDesktopPane1Layout.createSequentialGroup()
  119.                         .addComponent(optionC, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
  120.                         .addGap(168, 168, 168)
  121.                         .addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  122.                             .addComponent(optionD, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
  123.                             .addComponent(optionB, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)))
  124.                     .addComponent(optionA, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
  125.                     .addGroup(jDesktopPane1Layout.createSequentialGroup()
  126.                         .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
  127.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  128.                         .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 825, javax.swing.GroupLayout.PREFERRED_SIZE)))
  129.                 .addGap(61, 61, 61))
  130.             .addGroup(jDesktopPane1Layout.createSequentialGroup()
  131.                 .addGap(511, 511, 511)
  132.                 .addComponent(jLabel2)
  133.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  134.         );
  135.         jDesktopPane1Layout.setVerticalGroup(
  136.             jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  137.             .addGroup(jDesktopPane1Layout.createSequentialGroup()
  138.                 .addContainerGap()
  139.                 .addComponent(jLabel2)
  140.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  141.                 .addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  142.                     .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
  143.                     .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
  144.                 .addGap(18, 18, 18)
  145.                 .addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  146.                     .addComponent(optionA, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
  147.                     .addComponent(optionB, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))
  148.                 .addGap(29, 29, 29)
  149.                 .addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  150.                     .addComponent(optionD, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
  151.                     .addComponent(optionC, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))
  152.                 .addContainerGap(723, Short.MAX_VALUE))
  153.         );
  154.  
  155.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  156.         getContentPane().setLayout(layout);
  157.         layout.setHorizontalGroup(
  158.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  159.             .addGroup(layout.createSequentialGroup()
  160.                 .addContainerGap()
  161.                 .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1482, Short.MAX_VALUE)
  162.                 .addContainerGap())
  163.         );
  164.         layout.setVerticalGroup(
  165.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  166.             .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  167.         );
  168.  
  169.         pack();
  170.     }// </editor-fold>                        
  171.  
  172.     private void optionAActionPerformed(java.awt.event.ActionEvent evt) {                                        
  173.         // TODO add your handling code here:
  174.     }                                      
  175.  
  176.     private void optionBActionPerformed(java.awt.event.ActionEvent evt) {                                        
  177.         // TODO add your handling code here:
  178.     }                                      
  179.  
  180.     private void optionDActionPerformed(java.awt.event.ActionEvent evt) {                                        
  181.         // TODO add your handling code here:
  182.     }                                      
  183.  
  184.     private void optionCActionPerformed(java.awt.event.ActionEvent evt) {                                        
  185.         // TODO add your handling code here:
  186.     }                                      
  187.  
  188.     /**
  189.      * @param args the command line arguments
  190.      */
  191.     public static void main(String args[]) {
  192.         /* Set the Nimbus look and feel */
  193.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  194.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  195.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  196.          */
  197.         try {
  198.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  199.                 if ("Nimbus".equals(info.getName())) {
  200.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  201.                     break;
  202.                 }
  203.             }
  204.         } catch (ClassNotFoundException ex) {
  205.             java.util.logging.Logger.getLogger(Questions.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  206.         } catch (InstantiationException ex) {
  207.             java.util.logging.Logger.getLogger(Questions.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  208.         } catch (IllegalAccessException ex) {
  209.             java.util.logging.Logger.getLogger(Questions.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  210.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  211.             java.util.logging.Logger.getLogger(Questions.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  212.         }
  213.         //</editor-fold>
  214.  
  215.         /* Create and display the form */
  216.         java.awt.EventQueue.invokeLater(new Runnable() {
  217.             public void run() {
  218.                 new Questions().setVisible(true);
  219.             }
  220.         });
  221.     }
  222.  
  223.     // Variables declaration - do not modify                    
  224.     private javax.swing.JDesktopPane jDesktopPane1;
  225.     private javax.swing.JLabel jLabel1;
  226.     private javax.swing.JLabel jLabel2;
  227.     private javax.swing.JLabel jLabel3;
  228.     private javax.swing.JButton optionA;
  229.     private javax.swing.JButton optionB;
  230.     private javax.swing.JButton optionC;
  231.     private javax.swing.JButton optionD;
  232.     // End of variables declaration                  
  233. }
Add Comment
Please, Sign In to add comment