Advertisement
Guest User

Untitled

a guest
May 19th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 139.24 KB | None | 0 0
  1. package Exersare.Tabela_unica;
  2. import Exersare.Clasament_actual;
  3.  
  4. import javax.imageio.ImageIO;
  5. import javax.swing.*;
  6. import java.awt.*;
  7. import java.awt.event.ActionEvent;
  8. import java.awt.event.ActionListener;
  9. import java.awt.event.WindowEvent;
  10. import java.awt.event.*;
  11. import java.sql.*;
  12. import java.util.logging.Level;
  13. import java.util.logging.Logger;
  14.  
  15.  
  16. public class Tabela_unica extends JFrame implements ActionListener {
  17.     private JPanel p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11;//panel intrebari 1-10+cel cu toate intrebarile
  18.     private JButton button1, button2, button3, button4, button5, button6, button7, button8, button9, button10, button11, button12;
  19.     private JButton button13, button14, button15, buttoniesire;//butoane intrebare1
  20.     private JButton button16, button17, button18, buttoniesire2;//butoane intrebare2
  21.     private JButton button19, button20, button21, buttoniesire3;//butoane intrebare3
  22.     private JButton button22, button23, button24, buttoniesire4;//butoane intrebare4
  23.     private JButton button25, button26, button27, buttoniesire5;//butoane intrebare5
  24.     private JButton button28, button29, button30, buttoniesire6;//butoane intrebare6
  25.     private JButton button31, button32, button33, buttoniesire7;//butoane intrebare7
  26.     private JButton button34, button35, button36, buttoniesire8;//butoane intrebare8
  27.     private JButton button37, button38, button39, buttoniesire9;//butoane intrebare9
  28.     private JButton button40, button41, button42, buttoniesire10;//butoane intrebare10
  29.     private JButton rejucare,ierarhie;
  30.     private JLabel l2, l3, l4, l5, l6, l7, l8, l9, l10, l11;//label intrebari1-10
  31.     private JLabel fundali1,fundali2,fundali3,fundali4,fundali5,fundali6,fundali7,fundali8,fundali9,fundali10,fundali11;
  32.     private int nr_click, nr_click2, nr_click3, nr_click4, nr_click5, nr_click6, nr_click7, nr_click8, nr_click9, nr_click10, nr_click11, nr_click12;
  33.     private int nr_click13, nr_click14, nr_click15, nr_click16, nr_click17, nr_click18, nr_click19, nr_click20, nr_click21;//acces button int 1-3
  34.     private int nr_click22, nr_click23, nr_click24, nr_click25, nr_click26, nr_click27, nr_click28, nr_click29, nr_click30;//acces button int 4-6
  35.     private int nr_click31, nr_click32, nr_click33, nr_click34, nr_click35, nr_click36, nr_click37, nr_click38, nr_click39;//acces button int 7-9
  36.     private int nr_click40, nr_click41, nr_click42;//acces button int 10
  37.     private static JLabel l1;
  38.     private static int punctaj, id, punctajbd;
  39.     private String dom, intr1, rasp1, rasp2, rasp3;
  40.     private int corect, corect1, corect2, corect3, corect4, corect5, corect6, corect7, corect8, corect9, corect10;
  41.     private int jocuri, i = 0;
  42.     private int array[] = new int[10];
  43.     boolean gasit = false, semafor = false;
  44.     static boolean salvare_punctaj=false;
  45.     public static JLabel ltimp;
  46.     public static int sfarsit;
  47.     private JButton like1,like2,like3,like4,like5,like6,like7,like8,like9,like10;
  48.     private JButton dlike1,dlike2,dlike3,dlike4,dlike5,dlike6,dlike7,dlike8,dlike9,dlike10;
  49.     private JLabel rate1,rate2,rate3,rate4,rate5,rate6,rate7,rate8,rate9,rate10;
  50.     private int id_set_intrebari_adaugate,rating_bd;
  51.     private boolean semafor_like1=false,semafor_like2=false,semafor_like3=false,semafor_like4=false,semafor_like5=false;
  52.     private boolean semafor_like6=false,semafor_like7=false,semafor_like8=false,semafor_like9=false,semafor_like10=false;
  53.     private boolean semafor_dlike1=false,semafor_dlike2=false,semafor_dlike3=false,semafor_dlike4=false,semafor_dlike5=false;
  54.     private boolean semafor_dlike6=false,semafor_dlike7=false,semafor_dlike8=false,semafor_dlike9=false,semafor_dlike10=false;
  55.     private int contor_ia,contor_im,contor_id;
  56.  
  57.  
  58.     public Tabela_unica() {
  59.         super("Crezi ca stii?");
  60.  
  61.  
  62.         //adaugam panel-ul principal
  63.         p1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  64.         p1.setLayout(null);
  65.         p1.setVisible(true);
  66.         add(p1);
  67.  
  68.         fundali1=new JLabel();
  69.         ImagePanel2 fundali1 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Family.jpg").getImage());
  70.         p1.add(fundali1);
  71.         fundali1.setBounds(1,1,752,502);
  72.         fundali1.setLayout(null);
  73.  
  74.         //adaugam I-ul buton
  75.         button1 = new JButton();
  76.         button1.setBounds(1, 1, 120, 80);
  77.         fundali1.add(button1);
  78.         button1.addActionListener(this);
  79.  
  80.  
  81.         //adaugam II-lea buton
  82.         button2 = new JButton();
  83.         button2.setBounds(122, 1, 120, 80);
  84.         fundali1.add(button2);
  85.         button2.addActionListener(this);
  86.  
  87.         //adaugam III-lea buton
  88.         button3 = new JButton();
  89.         button3.setBounds(243, 1, 120, 80);
  90.         fundali1.add(button3);
  91.         button3.addActionListener(this);
  92.  
  93.  
  94.         //adaugam IV-lea buton
  95.         button4 = new JButton();
  96.         button4.setBounds(364, 1, 120, 80);
  97.         fundali1.add(button4);
  98.         button4.addActionListener(this);
  99.  
  100.         //adaugam al V-lea buton
  101.         button5 = new JButton();
  102.         button5.setBounds(485, 1, 120, 80);
  103.         fundali1.add(button5);
  104.         button5.addActionListener(this);
  105.  
  106.         //adaugam al VI-lea buton
  107.         button6 = new JButton();
  108.         button6.setBounds(1, 81, 120, 80);
  109.         fundali1.add(button6);
  110.         button6.addActionListener(this);
  111.  
  112.         //adaugam al VII-lea buton
  113.         button7 = new JButton();
  114.         button7.setBounds(122, 81, 120, 80);
  115.         fundali1.add(button7);
  116.         button7.addActionListener(this);
  117.  
  118.         //adaugam al VIII-lea buton
  119.         button8 = new JButton();
  120.         button8.setBounds(243, 81, 120, 80);
  121.         fundali1.add(button8);
  122.         button8.addActionListener(this);
  123.  
  124.         //adaugam al IX-lea buton
  125.         button9 = new JButton();
  126.         button9.setBounds(364, 81, 120, 80);
  127.         fundali1.add(button9);
  128.         button9.addActionListener(this);
  129.  
  130.         //adaugam al X-lea buton
  131.         button10 = new JButton();
  132.         button10.setBounds(485, 81, 120, 80);
  133.         fundali1.add(button10);
  134.         button10.addActionListener(this);
  135.  
  136.  
  137.         //formam al doilea panel+ label+ intrebarile
  138.         p2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  139.         p2.setLayout(null);
  140.  
  141.  
  142.         fundali2=new JLabel();
  143.         ImagePanel2 fundali2 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Log_In2.jpg").getImage());
  144.         p2.add(fundali2);
  145.         fundali2.setBounds(1,1,752,500);
  146.         fundali2.setLayout(null);
  147.  
  148.         l2 = new JLabel("", SwingConstants.CENTER);
  149.         l2.setBounds(1, 1, 600, 30);
  150.         l2.setOpaque(true);
  151.         l2.setBackground(Color.GRAY);
  152.         l2.setForeground(Color.WHITE);
  153.         fundali2.add(l2);
  154.  
  155.         like1=new JButton("+1");
  156.         like1.setOpaque(false);
  157.         like1.setFont(new Font("Arial Black", Font.PLAIN, 15));
  158.         like1.setContentAreaFilled(false);
  159.         like1.setBorderPainted(false);
  160.         like1.setBounds(394,150,70,30);
  161.         like1.setLayout(null);
  162.         like1.addActionListener(this);
  163.         fundali2.add(like1);
  164.         like1.setVisible(false);
  165.  
  166.  
  167.         rate1=new JLabel("Cum vi s-a parut intrebarea?");
  168.         rate1.setBounds(212,150,188,30);
  169.         rate1.setFont(new Font("Arial Black", Font.PLAIN, 12));
  170.         rate1.setOpaque(true);
  171.         rate1.setBackground(Color.GRAY);
  172.         rate1.setForeground(Color.WHITE);
  173.         fundali2.add(rate1);
  174.         rate1.setVisible(false);
  175.  
  176.  
  177.         dlike1=new JButton("-1");
  178.         dlike1.setBounds(153,150,70,30);
  179.         dlike1.setOpaque(false);
  180.         dlike1.setFont(new Font("Arial Black", Font.PLAIN, 15));
  181.         dlike1.setContentAreaFilled(false);
  182.         dlike1.setBorderPainted(false);
  183.         dlike1.addActionListener(this);
  184.         fundali2.add(dlike1);
  185.         dlike1.setVisible(false);
  186.  
  187.  
  188.         button13 = new JButton();
  189.         button13.setBounds(1, 31, 600, 31);
  190.         fundali2.add(button13);
  191.         button13.addActionListener(this);
  192.  
  193.  
  194.         button14 = new JButton();
  195.         button14.setBounds(1, 62, 600, 31);
  196.         fundali2.add(button14);
  197.         button14.addActionListener(this);
  198.  
  199.         button15 = new JButton();
  200.         button15.setBounds(1, 93, 600, 31);
  201.         fundali2.add(button15);
  202.         button15.addActionListener(this);
  203.  
  204.         buttoniesire = new JButton("Inapoi");
  205.         buttoniesire.setBackground(Color.RED);
  206.         fundali2.add(buttoniesire);
  207.         buttoniesire.setBounds(250, 380, 100, 30);
  208.         buttoniesire.addActionListener(this);
  209.  
  210.  
  211.         //formam al II-lea panel+ label+ intrebarile
  212.         p3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  213.         p3.setLayout(null);
  214.  
  215.         fundali3=new JLabel();
  216.         ImagePanel2 fundali3 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Log_In2.jpg").getImage());
  217.         p3.add(fundali3);
  218.         fundali3.setBounds(1,1,752,500);
  219.         fundali3.setLayout(null);
  220.  
  221.  
  222.         like2=new JButton("+1");
  223.         like2.setOpaque(false);
  224.         like2.setFont(new Font("Arial Black", Font.PLAIN, 15));
  225.         like2.setContentAreaFilled(false);
  226.         like2.setBorderPainted(false);
  227.         like2.setBounds(394,150,70,30);
  228.         like2.setLayout(null);
  229.         like2.addActionListener(this);
  230.         fundali3.add(like2);
  231.         like2.setVisible(false);
  232.  
  233.  
  234.         rate2=new JLabel("Cum vi s-a parut intrebarea?");
  235.         rate2.setBounds(212,150,188,30);
  236.         rate2.setFont(new Font("Arial Black", Font.PLAIN, 12));
  237.         rate2.setOpaque(true);
  238.         rate2.setBackground(Color.GRAY);
  239.         rate2.setForeground(Color.WHITE);
  240.         fundali3.add(rate2);
  241.         rate2.setVisible(false);
  242.  
  243.  
  244.         dlike2=new JButton("-1");
  245.         dlike2.setBounds(153,150,70,30);
  246.         dlike2.setOpaque(false);
  247.         dlike2.setFont(new Font("Arial Black", Font.PLAIN, 15));
  248.         dlike2.setContentAreaFilled(false);
  249.         dlike2.setBorderPainted(false);
  250.         dlike2.addActionListener(this);
  251.         fundali3.add(dlike2);
  252.         dlike2.setVisible(false);
  253.  
  254.  
  255.         l3 = new JLabel("", SwingConstants.CENTER);
  256.         l3.setBounds(1, 1, 600, 30);
  257.         l3.setOpaque(true);
  258.         l3.setBackground(Color.GRAY);
  259.         l3.setForeground(Color.WHITE);
  260.         fundali3.add(l3);
  261.  
  262.  
  263.         button16 = new JButton();
  264.         button16.setBounds(1, 31, 600, 31);
  265.         fundali3.add(button16);
  266.         button16.addActionListener(this);
  267.  
  268.  
  269.         button17 = new JButton();
  270.         button17.setBounds(1, 62, 600, 31);
  271.         fundali3.add(button17);
  272.         button17.addActionListener(this);
  273.  
  274.         button18 = new JButton();
  275.         button18.setBounds(1, 93, 600, 31);
  276.         fundali3.add(button18);
  277.         button18.addActionListener(this);
  278.  
  279.         buttoniesire2 = new JButton("Inapoi");
  280.         buttoniesire2.setBackground(Color.RED);
  281.         fundali3.add(buttoniesire2);
  282.         buttoniesire2.setBounds(250, 380, 100, 30);
  283.         buttoniesire2.addActionListener(this);
  284.  
  285.  
  286.         //formam al III-lea panel+ label+ intrebarile
  287.         p4 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  288.         p4.setLayout(null);
  289.  
  290.         fundali4=new JLabel();
  291.         ImagePanel2 fundali4 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Log_In2.jpg").getImage());
  292.         p4.add(fundali4);
  293.         fundali4.setBounds(1,1,752,500);
  294.         fundali4.setLayout(null);
  295.  
  296.  
  297.  
  298.         like3=new JButton("+1");
  299.         like3.setOpaque(false);
  300.         like3.setFont(new Font("Arial Black", Font.PLAIN, 15));
  301.         like3.setContentAreaFilled(false);
  302.         like3.setBorderPainted(false);
  303.         like3.setBounds(394,150,70,30);
  304.         like3.setLayout(null);
  305.         like3.addActionListener(this);
  306.         fundali4.add(like3);
  307.         like3.setVisible(false);
  308.  
  309.  
  310.         rate3=new JLabel("Cum vi s-a parut intrebarea?");
  311.         rate3.setBounds(212,150,188,30);
  312.         rate3.setFont(new Font("Arial Black", Font.PLAIN, 12));
  313.         rate3.setOpaque(true);
  314.         rate3.setBackground(Color.GRAY);
  315.         rate3.setForeground(Color.WHITE);
  316.         fundali4.add(rate3);
  317.         rate3.setVisible(false);
  318.  
  319.  
  320.         dlike3=new JButton("-1");
  321.         dlike3.setBounds(153,150,70,30);
  322.         dlike3.setOpaque(false);
  323.         dlike3.setFont(new Font("Arial Black", Font.PLAIN, 15));
  324.         dlike3.setContentAreaFilled(false);
  325.         dlike3.setBorderPainted(false);
  326.         dlike3.addActionListener(this);
  327.         fundali4.add(dlike3);
  328.         dlike3.setVisible(false);
  329.  
  330.         l4 = new JLabel("", SwingConstants.CENTER);
  331.         l4.setBounds(1, 1, 600, 30);
  332.         l4.setOpaque(true);
  333.         l4.setBackground(Color.GRAY);
  334.         l4.setForeground(Color.WHITE);
  335.         fundali4.add(l4);
  336.  
  337.  
  338.         button19 = new JButton();
  339.         button19.setBounds(1, 31, 600, 31);
  340.         fundali4.add(button19);
  341.         button19.addActionListener(this);
  342.  
  343.  
  344.         button20 = new JButton();
  345.         button20.setBounds(1, 62, 600, 31);
  346.         fundali4.add(button20);
  347.         button20.addActionListener(this);
  348.  
  349.         button21 = new JButton();
  350.         button21.setBounds(1, 93, 600, 31);
  351.         fundali4.add(button21);
  352.         button21.addActionListener(this);
  353.  
  354.         buttoniesire3 = new JButton("Inapoi");
  355.         buttoniesire3.setBackground(Color.RED);
  356.         fundali4.add(buttoniesire3);
  357.         buttoniesire3.setBounds(250, 380, 100, 30);
  358.         buttoniesire3.addActionListener(this);
  359.  
  360.  
  361.         //formam al IV-lea panel+ label+ intrebarile
  362.         p5 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  363.         p5.setLayout(null);
  364.  
  365.         fundali5=new JLabel();
  366.         ImagePanel2 fundali5 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Log_In2.jpg").getImage());
  367.         p5.add(fundali5);
  368.         fundali5.setBounds(1,1,752,500);
  369.         fundali5.setLayout(null);
  370.  
  371.  
  372.         like4=new JButton("+1");
  373.         like4.setOpaque(false);
  374.         like4.setFont(new Font("Arial Black", Font.PLAIN, 15));
  375.         like4.setContentAreaFilled(false);
  376.         like4.setBorderPainted(false);
  377.         like4.setBounds(394,150,70,30);
  378.         like4.setLayout(null);
  379.         like4.addActionListener(this);
  380.         fundali5.add(like4);
  381.         like4.setVisible(false);
  382.  
  383.  
  384.         rate4=new JLabel("Cum vi s-a parut intrebarea?");
  385.         rate4.setBounds(212,150,188,30);
  386.         rate4.setFont(new Font("Arial Black", Font.PLAIN, 12));
  387.         rate4.setOpaque(true);
  388.         rate4.setBackground(Color.GRAY);
  389.         rate4.setForeground(Color.WHITE);
  390.         fundali5.add(rate4);
  391.         rate4.setVisible(false);
  392.  
  393.  
  394.         dlike4=new JButton("-1");
  395.         dlike4.setBounds(153,150,70,30);
  396.         dlike4.setOpaque(false);
  397.         dlike4.setFont(new Font("Arial Black", Font.PLAIN, 15));
  398.         dlike4.setContentAreaFilled(false);
  399.         dlike4.setBorderPainted(false);
  400.         dlike4.addActionListener(this);
  401.         fundali5.add(dlike4);
  402.         dlike4.setVisible(false);
  403.  
  404.  
  405.         l5 = new JLabel("", SwingConstants.CENTER);
  406.         l5.setBounds(1, 1, 600, 30);
  407.         l5.setOpaque(true);
  408.         l5.setBackground(Color.GRAY);
  409.         l5.setForeground(Color.WHITE);
  410.         fundali5.add(l5);
  411.  
  412.  
  413.         button22 = new JButton();
  414.         button22.setBounds(1, 31, 600, 31);
  415.         fundali5.add(button22);
  416.         button22.addActionListener(this);
  417.  
  418.  
  419.         button23 = new JButton();
  420.         button23.setBounds(1, 62, 600, 31);
  421.         fundali5.add(button23);
  422.         button23.addActionListener(this);
  423.  
  424.         button24 = new JButton();
  425.         button24.setBounds(1, 93, 600, 31);
  426.         fundali5.add(button24);
  427.         button24.addActionListener(this);
  428.  
  429.         buttoniesire4 = new JButton("Inapoi");
  430.         buttoniesire4.setBackground(Color.RED);
  431.         fundali5.add(buttoniesire4);
  432.         buttoniesire4.setBounds(250, 380, 100, 30);
  433.         buttoniesire4.addActionListener(this);
  434.  
  435.  
  436.         //formam al V-lea panel+ label+ intrebarile
  437.         p6 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  438.         p6.setLayout(null);
  439.  
  440.         fundali6=new JLabel();
  441.         ImagePanel2 fundali6 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Log_In2.jpg").getImage());
  442.         p6.add(fundali6);
  443.         fundali6.setBounds(1,1,752,500);
  444.         fundali6.setLayout(null);
  445.  
  446.  
  447.         like5=new JButton("+1");
  448.         like5.setOpaque(false);
  449.         like5.setFont(new Font("Arial Black", Font.PLAIN, 15));
  450.         like5.setContentAreaFilled(false);
  451.         like5.setBorderPainted(false);
  452.         like5.setBounds(394,150,70,30);
  453.         like5.setLayout(null);
  454.         like5.addActionListener(this);
  455.         fundali6.add(like5);
  456.         like5.setVisible(false);
  457.  
  458.  
  459.         rate5=new JLabel("Cum vi s-a parut intrebarea?");
  460.         rate5.setBounds(212,150,188,30);
  461.         rate5.setFont(new Font("Arial Black", Font.PLAIN, 12));
  462.         rate5.setOpaque(true);
  463.         rate5.setBackground(Color.GRAY);
  464.         rate5.setForeground(Color.WHITE);
  465.         fundali6.add(rate5);
  466.         rate5.setVisible(false);
  467.  
  468.  
  469.         dlike5=new JButton("-1");
  470.         dlike5.setBounds(153,150,70,30);
  471.         dlike5.setOpaque(false);
  472.         dlike5.setFont(new Font("Arial Black", Font.PLAIN, 15));
  473.         dlike5.setContentAreaFilled(false);
  474.         dlike5.setBorderPainted(false);
  475.         dlike5.addActionListener(this);
  476.         fundali6.add(dlike5);
  477.         dlike5.setVisible(false);
  478.  
  479.  
  480.  
  481.         l6 = new JLabel("", SwingConstants.CENTER);
  482.         l6.setBounds(1, 1, 600, 30);
  483.         l6.setOpaque(true);
  484.         l6.setBackground(Color.GRAY);
  485.         l6.setForeground(Color.WHITE);
  486.         fundali6.add(l6);
  487.  
  488.  
  489.         button25 = new JButton();
  490.         button25.setBounds(1, 31, 600, 31);
  491.         fundali6.add(button25);
  492.         button25.addActionListener(this);
  493.  
  494.  
  495.         button26 = new JButton();
  496.         button26.setBounds(1, 62, 600, 31);
  497.         fundali6.add(button26);
  498.         button26.addActionListener(this);
  499.  
  500.         button27 = new JButton();
  501.         button27.setBounds(1, 93, 600, 31);
  502.         fundali6.add(button27);
  503.         button27.addActionListener(this);
  504.  
  505.         buttoniesire5 = new JButton("Inapoi");
  506.         buttoniesire5.setBackground(Color.RED);
  507.         fundali6.add(buttoniesire5);
  508.         buttoniesire5.setBounds(250, 380, 100, 30);
  509.         buttoniesire5.addActionListener(this);
  510.  
  511.  
  512.         //formam al VI-lea panel+ label+ intrebarile
  513.         p7 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  514.         p7.setLayout(null);
  515.  
  516.  
  517.         fundali7=new JLabel();
  518.         ImagePanel2 fundali7 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Log_In2.jpg").getImage());
  519.         p7.add(fundali7);
  520.         fundali7.setBounds(1,1,752,500);
  521.         fundali7.setLayout(null);
  522.  
  523.  
  524.         like6=new JButton("+1");
  525.         like6.setOpaque(false);
  526.         like6.setFont(new Font("Arial Black", Font.PLAIN, 15));
  527.         like6.setContentAreaFilled(false);
  528.         like6.setBorderPainted(false);
  529.         like6.setBounds(394,150,70,30);
  530.         like6.setLayout(null);
  531.         like6.addActionListener(this);
  532.         fundali7.add(like6);
  533.         like6.setVisible(false);
  534.  
  535.  
  536.         rate6=new JLabel("Cum vi s-a parut intrebarea?");
  537.         rate6.setBounds(212,150,188,30);
  538.         rate6.setFont(new Font("Arial Black", Font.PLAIN, 12));
  539.         rate6.setOpaque(true);
  540.         rate6.setBackground(Color.GRAY);
  541.         rate6.setForeground(Color.WHITE);
  542.         fundali7.add(rate6);
  543.         rate6.setVisible(false);
  544.  
  545.  
  546.         dlike6=new JButton("-1");
  547.         dlike6.setBounds(153,150,70,30);
  548.         dlike6.setOpaque(false);
  549.         dlike6.setFont(new Font("Arial Black", Font.PLAIN, 15));
  550.         dlike6.setContentAreaFilled(false);
  551.         dlike6.setBorderPainted(false);
  552.         dlike6.addActionListener(this);
  553.         fundali7.add(dlike6);
  554.         dlike6.setVisible(false);
  555.  
  556.  
  557.  
  558.         l7 = new JLabel("", SwingConstants.CENTER);
  559.         l7.setBounds(1, 1, 600, 30);
  560.         l7.setOpaque(true);
  561.         l7.setBackground(Color.GRAY);
  562.         l7.setForeground(Color.WHITE);
  563.         fundali7.add(l7);
  564.  
  565.  
  566.         button28 = new JButton();
  567.         button28.setBounds(1, 31, 600, 31);
  568.         fundali7.add(button28);
  569.         button28.addActionListener(this);
  570.  
  571.  
  572.         button29 = new JButton();
  573.         button29.setBounds(1, 62, 600, 31);
  574.         fundali7.add(button29);
  575.         button29.addActionListener(this);
  576.  
  577.         button30 = new JButton();
  578.         button30.setBounds(1, 93, 600, 31);
  579.         fundali7.add(button30);
  580.         button30.addActionListener(this);
  581.  
  582.         buttoniesire6 = new JButton("Inapoi");
  583.         buttoniesire6.setBackground(Color.RED);
  584.         fundali7.add(buttoniesire6);
  585.         buttoniesire6.setBounds(250, 380, 100, 30);
  586.         buttoniesire6.addActionListener(this);
  587.  
  588.  
  589.         //formam al VII-lea panel+ label+ intrebarile
  590.         p8 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  591.         p8.setLayout(null);
  592.  
  593.         fundali8=new JLabel();
  594.         ImagePanel2 fundali8 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Log_In2.jpg").getImage());
  595.         p8.add(fundali8);
  596.         fundali8.setBounds(1,1,752,500);
  597.         fundali8.setLayout(null);
  598.  
  599.  
  600.         like7=new JButton("+1");
  601.         like7.setOpaque(false);
  602.         like7.setFont(new Font("Arial Black", Font.PLAIN, 15));
  603.         like7.setContentAreaFilled(false);
  604.         like7.setBorderPainted(false);
  605.         like7.setBounds(394,150,70,30);
  606.         like7.setLayout(null);
  607.         like7.addActionListener(this);
  608.         fundali8.add(like7);
  609.         like7.setVisible(false);
  610.  
  611.  
  612.         rate7=new JLabel("Cum vi s-a parut intrebarea?");
  613.         rate7.setBounds(212,150,188,30);
  614.         rate7.setFont(new Font("Arial Black", Font.PLAIN, 12));
  615.         rate7.setOpaque(true);
  616.         rate7.setBackground(Color.GRAY);
  617.         rate7.setForeground(Color.WHITE);
  618.         fundali8.add(rate7);
  619.         rate7.setVisible(false);
  620.  
  621.  
  622.         dlike7=new JButton("-1");
  623.         dlike7.setBounds(153,150,70,30);
  624.         dlike7.setOpaque(false);
  625.         dlike7.setFont(new Font("Arial Black", Font.PLAIN, 15));
  626.         dlike7.setContentAreaFilled(false);
  627.         dlike7.setBorderPainted(false);
  628.         dlike7.addActionListener(this);
  629.         fundali8.add(dlike7);
  630.         dlike7.setVisible(false);
  631.  
  632.  
  633.  
  634.         l8 = new JLabel("", SwingConstants.CENTER);
  635.         l8.setBounds(1, 1, 600, 30);
  636.         l8.setOpaque(true);
  637.         l8.setBackground(Color.GRAY);
  638.         l8.setForeground(Color.WHITE);
  639.         fundali8.add(l8);
  640.  
  641.  
  642.         button31 = new JButton();
  643.         button31.setBounds(1, 31, 600, 31);
  644.         fundali8.add(button31);
  645.         button31.addActionListener(this);
  646.  
  647.  
  648.         button32 = new JButton();
  649.         button32.setBounds(1, 62, 600, 31);
  650.         fundali8.add(button32);
  651.         button32.addActionListener(this);
  652.  
  653.         button33 = new JButton();
  654.         button33.setBounds(1, 93, 600, 31);
  655.         fundali8.add(button33);
  656.         button33.addActionListener(this);
  657.  
  658.         buttoniesire7 = new JButton("Inapoi");
  659.         buttoniesire7.setBackground(Color.RED);
  660.         fundali8.add(buttoniesire7);
  661.         buttoniesire7.setBounds(250, 380, 100, 30);
  662.         buttoniesire7.addActionListener(this);
  663.  
  664.  
  665.         //formam al VIII-lea panel+ label+ intrebarile
  666.         p9 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  667.         p9.setLayout(null);
  668.  
  669.         fundali9=new JLabel();
  670.         ImagePanel2 fundali9 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Log_In2.jpg").getImage());
  671.         p9.add(fundali9);
  672.         fundali9.setBounds(1,1,752,500);
  673.         fundali9.setLayout(null);
  674.  
  675.         like8=new JButton("+1");
  676.         like8.setOpaque(false);
  677.         like8.setFont(new Font("Arial Black", Font.PLAIN, 15));
  678.         like8.setContentAreaFilled(false);
  679.         like8.setBorderPainted(false);
  680.         like8.setBounds(394,150,70,30);
  681.         like8.setLayout(null);
  682.         like8.addActionListener(this);
  683.         fundali9.add(like8);
  684.         like8.setVisible(false);
  685.  
  686.  
  687.         rate8=new JLabel("Cum vi s-a parut intrebarea?");
  688.         rate8.setBounds(212,150,188,30);
  689.         rate8.setFont(new Font("Arial Black", Font.PLAIN, 12));
  690.         rate8.setOpaque(true);
  691.         rate8.setBackground(Color.GRAY);
  692.         rate8.setForeground(Color.WHITE);
  693.         fundali9.add(rate8);
  694.         rate8.setVisible(false);
  695.  
  696.  
  697.         dlike8=new JButton("-1");
  698.         dlike8.setBounds(153,150,70,30);
  699.         dlike8.setOpaque(false);
  700.         dlike8.setFont(new Font("Arial Black", Font.PLAIN, 15));
  701.         dlike8.setContentAreaFilled(false);
  702.         dlike8.setBorderPainted(false);
  703.         dlike8.addActionListener(this);
  704.         fundali9.add(dlike8);
  705.         dlike8.setVisible(false);
  706.  
  707.  
  708.         l9 = new JLabel("", SwingConstants.CENTER);
  709.         l9.setBounds(1, 1, 600, 30);
  710.         l9.setOpaque(true);
  711.         l9.setBackground(Color.GRAY);
  712.         l9.setForeground(Color.WHITE);
  713.         fundali9.add(l9);
  714.  
  715.  
  716.         button34 = new JButton();
  717.         button34.setBounds(1, 31, 600, 31);
  718.         fundali9.add(button34);
  719.         button34.addActionListener(this);
  720.  
  721.  
  722.         button35 = new JButton();
  723.         button35.setBounds(1, 62, 600, 31);
  724.         fundali9.add(button35);
  725.         button35.addActionListener(this);
  726.  
  727.         button36 = new JButton();
  728.         button36.setBounds(1, 93, 600, 31);
  729.         fundali9.add(button36);
  730.         button36.addActionListener(this);
  731.  
  732.         buttoniesire8 = new JButton("Inapoi");
  733.         buttoniesire8.setBackground(Color.RED);
  734.         fundali9.add(buttoniesire8);
  735.         buttoniesire8.setBounds(250, 380, 100, 30);
  736.         buttoniesire8.addActionListener(this);
  737.  
  738.         //formam al IX-lea panel+ label+ intrebarile
  739.         p10 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  740.         p10.setLayout(null);
  741.  
  742.         fundali10=new JLabel();
  743.         ImagePanel2 fundali10 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Log_In2.jpg").getImage());
  744.         p10.add(fundali10);
  745.         fundali10.setBounds(1,1,752,500);
  746.         fundali10.setLayout(null);
  747.  
  748.  
  749.         like9=new JButton("+1");
  750.         like9.setOpaque(false);
  751.         like9.setFont(new Font("Arial Black", Font.PLAIN, 15));
  752.         like9.setContentAreaFilled(false);
  753.         like9.setBorderPainted(false);
  754.         like9.setBounds(394,150,70,30);
  755.         like9.setLayout(null);
  756.         like9.addActionListener(this);
  757.         fundali10.add(like9);
  758.         like9.setVisible(false);
  759.  
  760.  
  761.         rate9=new JLabel("Cum vi s-a parut intrebarea?");
  762.         rate9.setBounds(212,150,188,30);
  763.         rate9.setFont(new Font("Arial Black", Font.PLAIN, 12));
  764.         rate9.setOpaque(true);
  765.         rate9.setBackground(Color.GRAY);
  766.         rate9.setForeground(Color.WHITE);
  767.         fundali10.add(rate9);
  768.         rate9.setVisible(false);
  769.  
  770.  
  771.         dlike9=new JButton("-1");
  772.         dlike9.setBounds(153,150,70,30);
  773.         dlike9.setOpaque(false);
  774.         dlike9.setFont(new Font("Arial Black", Font.PLAIN, 15));
  775.         dlike9.setContentAreaFilled(false);
  776.         dlike9.setBorderPainted(false);
  777.         dlike9.addActionListener(this);
  778.         fundali10.add(dlike9);
  779.         dlike9.setVisible(false);
  780.  
  781.  
  782.         l10 = new JLabel("", SwingConstants.CENTER);
  783.         l10.setBounds(1, 1, 600, 30);
  784.         l10.setOpaque(true);
  785.         l10.setBackground(Color.GRAY);
  786.         l10.setForeground(Color.WHITE);
  787.         fundali10.add(l10);
  788.  
  789.  
  790.         button37 = new JButton();
  791.         button37.setBounds(1, 31, 600, 31);
  792.         fundali10.add(button37);
  793.         button37.addActionListener(this);
  794.  
  795.  
  796.         button38 = new JButton();
  797.         button38.setBounds(1, 62, 600, 31);
  798.         fundali10.add(button38);
  799.         button38.addActionListener(this);
  800.  
  801.         button39 = new JButton();
  802.         button39.setBounds(1, 93, 600, 31);
  803.         fundali10.add(button39);
  804.         button39.addActionListener(this);
  805.  
  806.         buttoniesire9 = new JButton("Inapoi");
  807.         buttoniesire9.setBackground(Color.RED);
  808.         fundali10.add(buttoniesire9);
  809.         buttoniesire9.setBounds(250, 380, 100, 30);
  810.         buttoniesire9.addActionListener(this);
  811.  
  812.  
  813.         //formam al X-lea panel+ label+ intrebarile
  814.         p11 = new JPanel(new FlowLayout(FlowLayout.LEFT));
  815.         p11.setLayout(null);
  816.  
  817.         fundali11=new JLabel();
  818.         ImagePanel2 fundali11 = new ImagePanel2(new ImageIcon("C:\\Users\\GT\\Desktop\\Imagini\\Log_In2.jpg").getImage());
  819.         p11.add(fundali11);
  820.         fundali11.setBounds(1,1,752,500);
  821.         fundali11.setLayout(null);
  822.  
  823.  
  824.         like10=new JButton("+1");
  825.         like10.setOpaque(false);
  826.         like10.setFont(new Font("Arial Black", Font.PLAIN, 15));
  827.         like10.setContentAreaFilled(false);
  828.         like10.setBorderPainted(false);
  829.         like10.setBounds(394,150,70,30);
  830.         like10.setLayout(null);
  831.         fundali11.add(like10);
  832.         like10.addActionListener(this);
  833.         like10.setVisible(false);
  834.  
  835.  
  836.         rate10=new JLabel("Cum vi s-a parut intrebarea?");
  837.         rate10.setBounds(212,150,188,30);
  838.         rate10.setFont(new Font("Arial Black", Font.PLAIN, 12));
  839.         rate10.setOpaque(true);
  840.         rate10.setBackground(Color.GRAY);
  841.         rate10.setForeground(Color.WHITE);
  842.         fundali11.add(rate10);
  843.         rate10.setVisible(false);
  844.  
  845.  
  846.         dlike10=new JButton("-1");
  847.         dlike10.setBounds(153,150,70,30);
  848.         dlike10.setOpaque(false);
  849.         dlike10.setFont(new Font("Arial Black", Font.PLAIN, 15));
  850.         dlike10.setContentAreaFilled(false);
  851.         dlike10.setBorderPainted(false);
  852.         dlike10.addActionListener(this);
  853.         fundali11.add(dlike10);
  854.         dlike10.setVisible(false);
  855.  
  856.  
  857.         l11 = new JLabel("", SwingConstants.CENTER);
  858.         l11.setBounds(1, 1, 600, 30);
  859.         l11.setOpaque(true);
  860.         l11.setBackground(Color.GRAY);
  861.         l11.setForeground(Color.WHITE);
  862.         fundali11.add(l11);
  863.  
  864.  
  865.         button40 = new JButton();
  866.         button40.setBounds(1, 31, 600, 31);
  867.         fundali11.add(button40);
  868.         button40.addActionListener(this);
  869.  
  870.  
  871.         button41 = new JButton();
  872.         button41.setBounds(1, 62, 600, 31);
  873.         fundali11.add(button41);
  874.         button41.addActionListener(this);
  875.  
  876.         button42 = new JButton();
  877.         button42.setBounds(1, 93, 600, 31);
  878.         fundali11.add(button42);
  879.         button42.addActionListener(this);
  880.  
  881.         buttoniesire10 = new JButton("Inapoi");
  882.         buttoniesire10.setBackground(Color.RED);
  883.         fundali11.add(buttoniesire10);
  884.         buttoniesire10.setBounds(250, 380, 100, 30);
  885.         buttoniesire10.addActionListener(this);
  886.  
  887.  
  888.         //adaugam labelul pentru a scrie punctajul
  889.         l1 = new JLabel();
  890.         l1.setBounds(130, 425, 250, 20);
  891.         l1.setForeground(Color.WHITE);
  892.         fundali1.add(l1);
  893.  
  894.  
  895.         ltimp = new JLabel("Timp ramas :");
  896.         ltimp.setForeground(Color.WHITE);
  897.         ltimp.setBounds(10, 425, 100, 20);
  898.         fundali1.add(ltimp);
  899.  
  900.         rejucare=new JButton("Incepe alt joc");
  901.         rejucare.setBounds(10,380,150,20);
  902.         fundali1.add(rejucare);
  903.         rejucare.setVisible(false);
  904.         rejucare.addActionListener(this);
  905.  
  906.  
  907.         ierarhie=new JButton("Vezi clasament.");
  908.         ierarhie.setBounds(10,350,150,20);
  909.         fundali1.add(ierarhie);
  910.         ierarhie.setVisible(false);
  911.         ierarhie.addActionListener(this);
  912.  
  913.  
  914.  
  915.         addWindowListener(new WindowAdapter() {
  916.             public void windowClosing(WindowEvent e) {
  917.                 int confirmed = JOptionPane.showConfirmDialog(null,
  918.                         "          Sunteti sigur? ", "Iesire program",
  919.                         JOptionPane.YES_NO_OPTION);
  920.  
  921.                 if (confirmed == JOptionPane.YES_OPTION) {
  922.                     salvare_punctaj();
  923.                     dispose();
  924.                     System.exit(0);
  925.                     return;
  926.                 } else {
  927.                     setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
  928.  
  929.                 }
  930.             }
  931.         });
  932.  
  933.         interogare_joc_id_punctaj();
  934.         nr_jocuri();
  935.         setVisible(true);
  936.         new Timer_tabela(this).start();
  937.  
  938.  
  939.  
  940.         setSize(600, 500);
  941.         setLocationRelativeTo(null);
  942.         setResizable(false);
  943.  
  944.     }
  945.  
  946.     public void interogare_joc_id_punctaj() {
  947.         Connection connection;
  948.         PreparedStatement ps;
  949.         try {
  950.             connection = DriverManager.getConnection("jdbc:mysql://localhost/Aplicatie", "root", "");
  951.             ps = connection.prepareStatement("SELECT `Id`,`Jocuri`,`Punctaj` FROM `Utilizatori` WHERE `Utilizator` = ?");
  952.             ps.setString(1, Log_In.t1.getText());
  953.             ResultSet result = ps.executeQuery();
  954.             if (result.next()) {
  955.                 id = result.getInt("id");
  956.                 jocuri = result.getInt("jocuri");
  957.                 punctajbd = result.getInt("punctaj");
  958.  
  959.             } else {
  960.                 JOptionPane.showMessageDialog(null, "Utilizator inexistent !");
  961.             }
  962.         } catch (SQLException ex) {
  963.             Logger.getLogger(Log_In.class.getName()).log(Level.SEVERE, null, ex);
  964.         }
  965.     } //se executa prima
  966.  
  967.     public void nr_jocuri() {
  968.  
  969.         switch (jocuri) {
  970.             case 0:
  971.                 jocuri++;
  972.                 adaugare_nr_jocuri(jocuri, id);
  973.                 afiseaza_intrebarea(1);
  974.                 break;
  975.  
  976.  
  977.             case 1:
  978.                 jocuri++;
  979.                 adaugare_nr_jocuri(jocuri, id);
  980.                 chestionare_rezolvate();
  981.  
  982.                 if (punctajbd <= 40) {
  983.                     hai(1);
  984.                 }
  985.  
  986.                 if (punctajbd > 40 && (punctajbd) <= 70) {
  987.                     hai(4);
  988.                 }
  989.  
  990.                 if (punctajbd > 70) {
  991.                     hai(7);
  992.                 }
  993.                 break;
  994.  
  995.  
  996.             case 2:
  997.                 jocuri++;
  998.                 adaugare_nr_jocuri(jocuri, id);
  999.                 chestionare_rezolvate();
  1000.  
  1001.                 if ((punctajbd / 2) <= 40) {
  1002.                     hai(1);
  1003.                 }
  1004.  
  1005.                 if ((punctajbd / 2) > 40 && (punctajbd / 2) <= 70) {
  1006.                     hai(4);
  1007.                 }
  1008.  
  1009.                 if ((punctajbd / 2) > 70) {
  1010.                     hai(7);
  1011.                 }
  1012.                 break;
  1013.  
  1014.  
  1015.             case 3:
  1016.                 jocuri++;
  1017.                 adaugare_nr_jocuri(jocuri, id);
  1018.                 chestionare_rezolvate();
  1019.  
  1020.  
  1021.                 if ((punctajbd / 3) <= 40) {
  1022.                     hai(1);
  1023.                 }
  1024.  
  1025.                 if ((punctajbd / 3) > 40 && (punctajbd / 3) <= 70) {
  1026.                     hai(4);
  1027.                 }
  1028.  
  1029.                 if ((punctajbd / 3) > 70) {
  1030.                     hai(7);
  1031.                 }
  1032.                 break;
  1033.  
  1034.             case 4:
  1035.                 jocuri++;
  1036.                 adaugare_nr_jocuri(jocuri, id);
  1037.                 chestionare_rezolvate();
  1038.  
  1039.  
  1040.                 if ((punctajbd / 4) <= 40) {
  1041.                     hai(1);
  1042.                 }
  1043.  
  1044.                 if ((punctajbd / 4) > 40 && (punctajbd / 4) <= 70) {
  1045.                     hai(4);
  1046.                 }
  1047.  
  1048.                 if ((punctajbd / 4) > 70) {
  1049.                     hai(7);
  1050.                 }
  1051.                 break;
  1052.  
  1053.  
  1054.             case 5:
  1055.                 jocuri++;
  1056.                 adaugare_nr_jocuri(jocuri, id);
  1057.                 chestionare_rezolvate();
  1058.  
  1059.  
  1060.                 if ((punctajbd / 5) <= 40) {
  1061.                     hai(1);
  1062.                 }
  1063.  
  1064.                 if ((punctajbd / 5) > 40 && (punctajbd / 5) <= 70) {
  1065.                     hai(4);
  1066.                 }
  1067.  
  1068.                 if ((punctajbd / 5) > 70) {
  1069.                     hai(7);
  1070.                 }
  1071.                 break;
  1072.  
  1073.  
  1074.             case 6:
  1075.                 jocuri++;
  1076.                 adaugare_nr_jocuri(jocuri, id);
  1077.                 chestionare_rezolvate();
  1078.  
  1079.  
  1080.                 if ((punctajbd / 6) <= 40) {
  1081.                     hai(1);
  1082.                 }
  1083.  
  1084.                 if ((punctajbd / 6) > 40 && (punctajbd / 6) <= 70) {
  1085.                     hai(4);
  1086.                 }
  1087.  
  1088.                 if ((punctajbd / 6) > 70) {
  1089.                     hai(7);
  1090.                 }
  1091.                 break;
  1092.  
  1093.             case 7:
  1094.                 jocuri++;
  1095.                 adaugare_nr_jocuri(jocuri, id);
  1096.                 chestionare_rezolvate();
  1097.  
  1098.  
  1099.                 if ((punctajbd / 7) <= 40) {
  1100.                     hai(1);
  1101.                 }
  1102.  
  1103.                 if ((punctajbd / 7) > 40 && (punctajbd / 7) <= 70) {
  1104.                     hai(4);
  1105.                 }
  1106.  
  1107.                 if ((punctajbd / 7) > 70) {
  1108.                     hai(7);
  1109.                 }
  1110.                 break;
  1111.             case 8:
  1112.                 jocuri++;
  1113.                 adaugare_nr_jocuri(jocuri, id);
  1114.                 chestionare_rezolvate();
  1115.  
  1116.  
  1117.                 if ((punctajbd / 8) <= 40) {
  1118.                     hai(1);
  1119.                 }
  1120.  
  1121.                 if ((punctajbd / 8) > 40 && (punctajbd / 8) <= 70) {
  1122.                     hai(4);
  1123.                 }
  1124.  
  1125.                 if ((punctajbd / 8) > 70) {
  1126.                     hai(7);
  1127.                 }
  1128.                 break;
  1129.             case 9:
  1130.                 jocuri++;
  1131.                 adaugare_nr_jocuri(jocuri, id);
  1132.                 chestionare_rezolvate();
  1133.  
  1134.  
  1135.                 if ((punctajbd / 9) <= 40) {
  1136.                     hai(1);
  1137.                 }
  1138.  
  1139.                 if ((punctajbd / 9) > 40 && (punctajbd / 9) <= 70) {
  1140.                     hai(4);
  1141.                 }
  1142.  
  1143.                 if ((punctajbd / 9) > 70) {
  1144.                     hai(7);
  1145.                 }
  1146.                 break;
  1147.             case 10:
  1148.             default:
  1149.                 JOptionPane.showMessageDialog(null, "Vom adauga alte intrebari in curand. O zi buna !");
  1150.                 System.exit(0);
  1151.  
  1152.  
  1153.         }
  1154.     }    //se executa a doua
  1155.  
  1156.     public void adaugare_nr_jocuri(int b, int c) {
  1157.         try {
  1158.             theQuery2("UPDATE utilizatori SET Jocuri='" + b + "' where id='" + c + "' ");
  1159.         } catch (Exception ex) {
  1160.         }
  1161.     } // se executa pentru a adauga jocul si id-ul in bd
  1162.  
  1163.  
  1164.     public void chestionare_rezolvate() {
  1165.         Connection connection;
  1166.         PreparedStatement ps;
  1167.         try {
  1168.             connection = DriverManager.getConnection("jdbc:mysql://localhost/Aplicatie", "root", "");
  1169.             ps = connection.prepareStatement("SELECT `id_intrebare`  FROM `Intrebari_bifate`  WHERE `id_user` = '" + id + "'");
  1170.             ResultSet result = ps.executeQuery();
  1171.             while (result.next()) {
  1172.                 array[i] = result.getInt("id_intrebare");
  1173.                 i++;
  1174.             }
  1175.  
  1176.  
  1177.         } catch (SQLException ex) {
  1178.             Logger.getLogger(Tabela_unica.class.getName()).log(Level.SEVERE, null, ex);
  1179.         }
  1180.  
  1181.     } //calculeaza ce intrebari au fost puse deja
  1182.  
  1183.     public void afiseaza_intrebarea(int j) {
  1184.         if (j == 1) {
  1185.             adaugare_intrebare_utilizata(1);
  1186.             afisare(1, 1);
  1187.             afisare(2, 2);
  1188.             afisare(3, 3);
  1189.             afisare(4, 4);
  1190.             afisare(5, 5);
  1191.             afisare(6, 6);
  1192.             afisare(7, 7);
  1193.             afisare(8, 8);
  1194.             afisare(9, 9);
  1195.             afisare(10, 10);
  1196.         }
  1197.         if (j == 4) {
  1198.             adaugare_intrebare_utilizata(4);
  1199.             afisare(31, 31);
  1200.             afisare(32, 32);
  1201.             afisare(33, 33);
  1202.             afisare(34, 34);
  1203.             afisare(35, 35);
  1204.             afisare(36, 36);
  1205.             afisare(37, 37);
  1206.             afisare(38, 38);
  1207.             afisare(39, 39);
  1208.             afisare(40, 40);
  1209.         }
  1210.  
  1211.         if (j == 3) {
  1212.             adaugare_intrebare_utilizata(3);
  1213.             afisare(21, 21);
  1214.             afisare(22, 22);
  1215.             afisare(23, 23);
  1216.             afisare(24, 24);
  1217.             afisare(25, 25);
  1218.             afisare(26, 26);
  1219.             afisare(27, 27);
  1220.             afisare(28, 28);
  1221.             afisare(29, 29);
  1222.             afisare(30, 30);
  1223.         }
  1224.  
  1225.         if (j == 2) {
  1226.             adaugare_intrebare_utilizata(2);
  1227.             afisare(11, 11);
  1228.             afisare(12, 12);
  1229.             afisare(13, 13);
  1230.             afisare(14, 14);
  1231.             afisare(15, 15);
  1232.             afisare(16, 16);
  1233.             afisare(17, 17);
  1234.             afisare(18, 18);
  1235.             afisare(19, 19);
  1236.             afisare(20, 20);
  1237.         }
  1238.  
  1239.         if (j == 7) {
  1240.             adaugare_intrebare_utilizata(7);
  1241.             afisare(61, 61);
  1242.             afisare(62, 62);
  1243.             afisare(63, 63);
  1244.             afisare(64, 64);
  1245.             afisare(65, 65);
  1246.             afisare(66, 66);
  1247.             afisare(67, 67);
  1248.             afisare(68, 68);
  1249.             afisare(69, 69);
  1250.             afisare(70, 70);
  1251.         }
  1252.  
  1253.         if (j == 6) {
  1254.             adaugare_intrebare_utilizata(6);
  1255.             afisare(51, 51);
  1256.             afisare(52, 52);
  1257.             afisare(53, 53);
  1258.             afisare(54, 54);
  1259.             afisare(55, 55);
  1260.             afisare(56, 56);
  1261.             afisare(57, 57);
  1262.             afisare(58, 58);
  1263.             afisare(59, 59);
  1264.             afisare(60, 60);
  1265.         }
  1266.  
  1267.         if (j == 5) {
  1268.             adaugare_intrebare_utilizata(5);
  1269.             afisare(41, 41);
  1270.             afisare(42, 42);
  1271.             afisare(43, 43);
  1272.             afisare(44, 44);
  1273.             afisare(45, 45);
  1274.             afisare(46, 46);
  1275.             afisare(47, 47);
  1276.             afisare(48, 48);
  1277.             afisare(49, 49);
  1278.             afisare(50, 50);
  1279.         }
  1280.  
  1281.  
  1282.         if (j == 8) {
  1283.             adaugare_intrebare_utilizata(8);
  1284.             afisare(71, 71);
  1285.             afisare(72, 72);
  1286.             afisare(73, 73);
  1287.             afisare(74, 74);
  1288.             afisare(75, 75);
  1289.             afisare(76, 76);
  1290.             afisare(77, 77);
  1291.             afisare(78, 78);
  1292.             afisare(79, 79);
  1293.             afisare(80, 80);
  1294.         }
  1295.         if (j == 9) {
  1296.             adaugare_intrebare_utilizata(9);
  1297.             afisare(81, 81);
  1298.             afisare(82, 82);
  1299.             afisare(83, 83);
  1300.             afisare(84, 84);
  1301.             afisare(85, 85);
  1302.             afisare(86, 86);
  1303.             afisare(87, 87);
  1304.             afisare(88, 88);
  1305.             afisare(89, 89);
  1306.             afisare(90, 90);
  1307.         }
  1308.         if (j == 10) {
  1309.             adaugare_intrebare_utilizata(10);
  1310.             afisare(91, 91);
  1311.             afisare(92, 92);
  1312.             afisare(93, 93);
  1313.             afisare(94, 94);
  1314.             afisare(95, 95);
  1315.             afisare(96, 96);
  1316.             afisare(97, 97);
  1317.             afisare(98, 98);
  1318.             afisare(99, 99);
  1319.             afisare(100, 100);
  1320.         }
  1321.  
  1322.     } //apeleaza functia afisare
  1323.  
  1324.     public void afisare(int a, int b) {
  1325.         Connection connection;
  1326.         PreparedStatement ps;
  1327.         try {
  1328.             connection = DriverManager.getConnection("jdbc:mysql://localhost/Aplicatie", "root", "");
  1329.             ps = connection.prepareStatement("SELECT `Domeniu`,`Intrebare`,`Raspuns1`,`Raspuns2`,`Raspuns3` FROM `Intrebare1` WHERE `id` = '" + a + "'");
  1330.             ResultSet result = ps.executeQuery();
  1331.             if (result.next()) {
  1332.                 dom = result.getString("Domeniu");
  1333.                 intr1 = result.getString("Intrebare");
  1334.                 rasp1 = result.getString("Raspuns1");
  1335.                 rasp2 = result.getString("Raspuns2");
  1336.                 rasp3 = result.getString("Raspuns3");
  1337.                 corect = 1;
  1338.  
  1339.  
  1340.             } else {
  1341.                 JOptionPane.showMessageDialog(null, "Eroare DB !");
  1342.             }
  1343.         } catch (SQLException ex) {
  1344.             Logger.getLogger(Tabela_unica.class.getName()).log(Level.SEVERE, null, ex);
  1345.         }
  1346.  
  1347.  
  1348.         if (b == 1) {
  1349.             button13.setText(rasp1);
  1350.             button14.setText(rasp2);
  1351.             button15.setText(rasp3);
  1352.             l2.setText(intr1);
  1353.             button1.setText(dom);
  1354.             corect1 = 2;
  1355.         }
  1356.  
  1357.         if (b == 2) {
  1358.             button16.setText(rasp1);
  1359.             button17.setText(rasp2);
  1360.             button18.setText(rasp3);
  1361.             l3.setText(intr1);
  1362.             button2.setText(dom);
  1363.             corect2 = 1;
  1364.         }
  1365.  
  1366.         if (b == 3) {
  1367.             button19.setText(rasp1);
  1368.             button20.setText(rasp2);
  1369.             button21.setText(rasp3);
  1370.             l4.setText(intr1);
  1371.             button3.setText(dom);
  1372.             corect3 = 2;
  1373.         }
  1374.  
  1375.         if (b == 4) {
  1376.             button22.setText(rasp1);
  1377.             button23.setText(rasp2);
  1378.             button24.setText(rasp3);
  1379.             l5.setText(intr1);
  1380.             button4.setText(dom);
  1381.             corect4 = 3;
  1382.         }
  1383.  
  1384.         if (b == 5) {
  1385.             button25.setText(rasp1);
  1386.             button26.setText(rasp2);
  1387.             button27.setText(rasp3);
  1388.             l6.setText(intr1);
  1389.             button5.setText(dom);
  1390.             corect5 = 2;
  1391.         }
  1392.  
  1393.         if (b == 6) {
  1394.             button28.setText(rasp1);
  1395.             button29.setText(rasp2);
  1396.             button30.setText(rasp3);
  1397.             l7.setText(intr1);
  1398.             button6.setText(dom);
  1399.             corect6 = 1;
  1400.  
  1401.         }
  1402.  
  1403.  
  1404.         if (b == 7) {
  1405.             button31.setText(rasp1);
  1406.             button32.setText(rasp2);
  1407.             button33.setText(rasp3);
  1408.             l8.setText(intr1);
  1409.             button7.setText(dom);
  1410.             corect7 = 3;
  1411.  
  1412.         }
  1413.  
  1414.         if (b == 8) {
  1415.             button34.setText(rasp1);
  1416.             button35.setText(rasp2);
  1417.             button36.setText(rasp3);
  1418.             l9.setText(intr1);
  1419.             button8.setText(dom);
  1420.             corect8 = 3;
  1421.  
  1422.         }
  1423.  
  1424.         if (b == 9) {
  1425.             button37.setText(rasp1);
  1426.             button38.setText(rasp2);
  1427.             button39.setText(rasp3);
  1428.             l10.setText(intr1);
  1429.             button9.setText(dom);
  1430.             corect9 = 3;
  1431.  
  1432.         }
  1433.  
  1434.         if (b == 10) {
  1435.             button40.setText(rasp1);
  1436.             button41.setText(rasp2);
  1437.             button42.setText(rasp3);
  1438.             l11.setText(intr1);
  1439.             button10.setText(dom);
  1440.             corect10 = 2;
  1441.  
  1442.         }
  1443.         if (b == 11) {
  1444.             button13.setText(rasp1);
  1445.             button14.setText(rasp2);
  1446.             button15.setText(rasp3);
  1447.             l2.setText(intr1);
  1448.             button1.setText(dom);
  1449.             corect1 = 3;
  1450.         }
  1451.  
  1452.         if (b == 12) {
  1453.             button16.setText(rasp1);
  1454.             button17.setText(rasp2);
  1455.             button18.setText(rasp3);
  1456.             l3.setText(intr1);
  1457.             button2.setText(dom);
  1458.             corect2 = 2;
  1459.  
  1460.         }
  1461.  
  1462.         if (b == 13) {
  1463.             button19.setText(rasp1);
  1464.             button20.setText(rasp2);
  1465.             button21.setText(rasp3);
  1466.             l4.setText(intr1);
  1467.             button3.setText(dom);
  1468.             corect3 = 3;
  1469.  
  1470.         }
  1471.  
  1472.         if (b == 14) {
  1473.             button22.setText(rasp1);
  1474.             button23.setText(rasp2);
  1475.             button24.setText(rasp3);
  1476.             l5.setText(intr1);
  1477.             button4.setText(dom);
  1478.             corect4 = 3;
  1479.  
  1480.         }
  1481.  
  1482.         if (b == 15) {
  1483.             button25.setText(rasp1);
  1484.             button26.setText(rasp2);
  1485.             button27.setText(rasp3);
  1486.             l6.setText(intr1);
  1487.             button5.setText(dom);
  1488.             corect5 = 1;
  1489.  
  1490.         }
  1491.  
  1492.         if (b == 16) {
  1493.             button28.setText(rasp1);
  1494.             button29.setText(rasp2);
  1495.             button30.setText(rasp3);
  1496.             l7.setText(intr1);
  1497.             button6.setText(dom);
  1498.             corect6 = 3;
  1499.  
  1500.         }
  1501.  
  1502.  
  1503.         if (b == 17) {
  1504.             button31.setText(rasp1);
  1505.             button32.setText(rasp2);
  1506.             button33.setText(rasp3);
  1507.             l8.setText(intr1);
  1508.             button7.setText(dom);
  1509.             corect7 = 1;
  1510.  
  1511.         }
  1512.  
  1513.         if (b == 18) {
  1514.             button34.setText(rasp1);
  1515.             button35.setText(rasp2);
  1516.             button36.setText(rasp3);
  1517.             l9.setText(intr1);
  1518.             button8.setText(dom);
  1519.             corect8 = 2;
  1520.  
  1521.         }
  1522.  
  1523.         if (b == 19) {
  1524.             button37.setText(rasp1);
  1525.             button38.setText(rasp2);
  1526.             button39.setText(rasp3);
  1527.             l10.setText(intr1);
  1528.             button9.setText(dom);
  1529.             corect9 = 2;
  1530.  
  1531.         }
  1532.  
  1533.         if (b == 20) {
  1534.             button40.setText(rasp1);
  1535.             button41.setText(rasp2);
  1536.             button42.setText(rasp3);
  1537.             l11.setText(intr1);
  1538.             button10.setText(dom);
  1539.             corect10 = 1;
  1540.  
  1541.         }
  1542.  
  1543.         if (b == 21) {
  1544.             button13.setText(rasp1);
  1545.             button14.setText(rasp2);
  1546.             button15.setText(rasp3);
  1547.             l2.setText(intr1);
  1548.             button1.setText(dom);
  1549.             corect1 = 3;
  1550.         }
  1551.  
  1552.         if (b == 22) {
  1553.             button16.setText(rasp1);
  1554.             button17.setText(rasp2);
  1555.             button18.setText(rasp3);
  1556.             l3.setText(intr1);
  1557.             button2.setText(dom);
  1558.             corect2 = 3;
  1559.  
  1560.         }
  1561.  
  1562.         if (b == 23) {
  1563.             button19.setText(rasp1);
  1564.             button20.setText(rasp2);
  1565.             button21.setText(rasp3);
  1566.             l4.setText(intr1);
  1567.             button3.setText(dom);
  1568.             corect3 = 2;
  1569.  
  1570.         }
  1571.  
  1572.         if (b == 24) {
  1573.             button22.setText(rasp1);
  1574.             button23.setText(rasp2);
  1575.             button24.setText(rasp3);
  1576.             l5.setText(intr1);
  1577.             button4.setText(dom);
  1578.             corect4 = 1;
  1579.  
  1580.         }
  1581.  
  1582.         if (b == 25) {
  1583.             button25.setText(rasp1);
  1584.             button26.setText(rasp2);
  1585.             button27.setText(rasp3);
  1586.             l6.setText(intr1);
  1587.             button5.setText(dom);
  1588.             corect5 = 2;
  1589.  
  1590.         }
  1591.  
  1592.         if (b == 26) {
  1593.             button28.setText(rasp1);
  1594.             button29.setText(rasp2);
  1595.             button30.setText(rasp3);
  1596.             l7.setText(intr1);
  1597.             button6.setText(dom);
  1598.             corect6 = 3;
  1599.  
  1600.         }
  1601.  
  1602.  
  1603.         if (b == 27) {
  1604.             button31.setText(rasp1);
  1605.             button32.setText(rasp2);
  1606.             button33.setText(rasp3);
  1607.             l8.setText(intr1);
  1608.             button7.setText(dom);
  1609.             corect7 = 2;
  1610.  
  1611.         }
  1612.  
  1613.         if (b == 28) {
  1614.             button34.setText(rasp1);
  1615.             button35.setText(rasp2);
  1616.             button36.setText(rasp3);
  1617.             l9.setText(intr1);
  1618.             button8.setText(dom);
  1619.             corect8 = 1;
  1620.  
  1621.         }
  1622.  
  1623.         if (b == 29) {
  1624.             button37.setText(rasp1);
  1625.             button38.setText(rasp2);
  1626.             button39.setText(rasp3);
  1627.             l10.setText(intr1);
  1628.             button9.setText(dom);
  1629.             corect9 = 2;
  1630.  
  1631.         }
  1632.  
  1633.         if (b == 30) {
  1634.             button40.setText(rasp1);
  1635.             button41.setText(rasp2);
  1636.             button42.setText(rasp3);
  1637.             l11.setText(intr1);
  1638.             button10.setText(dom);
  1639.             corect10 = 3;
  1640.  
  1641.         }
  1642.  
  1643.         if (b == 31) {
  1644.             button13.setText(rasp1);
  1645.             button14.setText(rasp2);
  1646.             button15.setText(rasp3);
  1647.             l2.setText(intr1);
  1648.             button1.setText(dom);
  1649.             corect1 = 2;
  1650.         }
  1651.  
  1652.         if (b == 32) {
  1653.             button16.setText(rasp1);
  1654.             button17.setText(rasp2);
  1655.             button18.setText(rasp3);
  1656.             l3.setText(intr1);
  1657.             button2.setText(dom);
  1658.             corect2 = 2;
  1659.  
  1660.         }
  1661.  
  1662.         if (b == 33) {
  1663.             button19.setText(rasp1);
  1664.             button20.setText(rasp2);
  1665.             button21.setText(rasp3);
  1666.             l4.setText(intr1);
  1667.             button3.setText(dom);
  1668.             corect3 = 1;
  1669.  
  1670.         }
  1671.  
  1672.         if (b == 34) {
  1673.             button22.setText(rasp1);
  1674.             button23.setText(rasp2);
  1675.             button24.setText(rasp3);
  1676.             l5.setText(intr1);
  1677.             button4.setText(dom);
  1678.             corect4 = 1;
  1679.  
  1680.         }
  1681.  
  1682.         if (b == 35) {
  1683.             button25.setText(rasp1);
  1684.             button26.setText(rasp2);
  1685.             button27.setText(rasp3);
  1686.             l6.setText(intr1);
  1687.             button5.setText(dom);
  1688.             corect5 = 3;
  1689.  
  1690.         }
  1691.  
  1692.         if (b == 36) {
  1693.             button28.setText(rasp1);
  1694.             button29.setText(rasp2);
  1695.             button30.setText(rasp3);
  1696.             l7.setText(intr1);
  1697.             button6.setText(dom);
  1698.             corect6 = 2;
  1699.  
  1700.         }
  1701.  
  1702.  
  1703.         if (b == 37) {
  1704.             button31.setText(rasp1);
  1705.             button32.setText(rasp2);
  1706.             button33.setText(rasp3);
  1707.             l8.setText(intr1);
  1708.             button7.setText(dom);
  1709.             corect7 = 2;
  1710.  
  1711.         }
  1712.  
  1713.         if (b == 38) {
  1714.             button34.setText(rasp1);
  1715.             button35.setText(rasp2);
  1716.             button36.setText(rasp3);
  1717.             l9.setText(intr1);
  1718.             button8.setText(dom);
  1719.             corect8 = 3;
  1720.  
  1721.         }
  1722.  
  1723.         if (b == 39) {
  1724.             button37.setText(rasp1);
  1725.             button38.setText(rasp2);
  1726.             button39.setText(rasp3);
  1727.             l10.setText(intr1);
  1728.             button9.setText(dom);
  1729.             corect9 = 1;
  1730.  
  1731.         }
  1732.         if (b == 40) {
  1733.             button40.setText(rasp1);
  1734.             button41.setText(rasp2);
  1735.             button42.setText(rasp3);
  1736.             l11.setText(intr1);
  1737.             button10.setText(dom);
  1738.             corect10 = 3;
  1739.  
  1740.         }
  1741.  
  1742.  
  1743.         if (b == 41) {
  1744.             button13.setText(rasp1);
  1745.             button14.setText(rasp2);
  1746.             button15.setText(rasp3);
  1747.             l2.setText(intr1);
  1748.             button1.setText(dom);
  1749.             corect1 = 3;
  1750.         }
  1751.  
  1752.         if (b == 42) {
  1753.             button16.setText(rasp1);
  1754.             button17.setText(rasp2);
  1755.             button18.setText(rasp3);
  1756.             l3.setText(intr1);
  1757.             button2.setText(dom);
  1758.             corect2 = 2;
  1759.  
  1760.         }
  1761.  
  1762.         if (b == 43) {
  1763.             button19.setText(rasp1);
  1764.             button20.setText(rasp2);
  1765.             button21.setText(rasp3);
  1766.             l4.setText(intr1);
  1767.             button3.setText(dom);
  1768.             corect3 = 3;
  1769.  
  1770.         }
  1771.  
  1772.         if (b == 44) {
  1773.             button22.setText(rasp1);
  1774.             button23.setText(rasp2);
  1775.             button24.setText(rasp3);
  1776.             l5.setText(intr1);
  1777.             button4.setText(dom);
  1778.             corect4 = 2;
  1779.  
  1780.         }
  1781.  
  1782.         if (b == 45) {
  1783.             button25.setText(rasp1);
  1784.             button26.setText(rasp2);
  1785.             button27.setText(rasp3);
  1786.             l6.setText(intr1);
  1787.             button5.setText(dom);
  1788.             corect5 = 3;
  1789.  
  1790.         }
  1791.  
  1792.         if (b == 46) {
  1793.             button28.setText(rasp1);
  1794.             button29.setText(rasp2);
  1795.             button30.setText(rasp3);
  1796.             l7.setText(intr1);
  1797.             button6.setText(dom);
  1798.             corect6 = 2;
  1799.  
  1800.         }
  1801.  
  1802.  
  1803.         if (b == 47) {
  1804.             button31.setText(rasp1);
  1805.             button32.setText(rasp2);
  1806.             button33.setText(rasp3);
  1807.             l8.setText(intr1);
  1808.             button7.setText(dom);
  1809.             corect7 = 1;
  1810.  
  1811.         }
  1812.  
  1813.         if (b == 48) {
  1814.             button34.setText(rasp1);
  1815.             button35.setText(rasp2);
  1816.             button36.setText(rasp3);
  1817.             l9.setText(intr1);
  1818.             button8.setText(dom);
  1819.             corect8 = 2;
  1820.  
  1821.         }
  1822.  
  1823.         if (b == 49) {
  1824.             button37.setText(rasp1);
  1825.             button38.setText(rasp2);
  1826.             button39.setText(rasp3);
  1827.             l10.setText(intr1);
  1828.             button9.setText(dom);
  1829.             corect9 = 3;
  1830.  
  1831.         }
  1832.  
  1833.         if (b == 50) {
  1834.             button40.setText(rasp1);
  1835.             button41.setText(rasp2);
  1836.             button42.setText(rasp3);
  1837.             l11.setText(intr1);
  1838.             button10.setText(dom);
  1839.             corect10 = 1;
  1840.  
  1841.         }
  1842.  
  1843.         if (b == 51) {
  1844.             button13.setText(rasp1);
  1845.             button14.setText(rasp2);
  1846.             button15.setText(rasp3);
  1847.             l2.setText(intr1);
  1848.             button1.setText(dom);
  1849.             corect1 = 1;
  1850.         }
  1851.  
  1852.         if (b == 52) {
  1853.             button16.setText(rasp1);
  1854.             button17.setText(rasp2);
  1855.             button18.setText(rasp3);
  1856.             l3.setText(intr1);
  1857.             button2.setText(dom);
  1858.             corect2 = 1;
  1859.  
  1860.         }
  1861.  
  1862.         if (b == 53) {
  1863.             button19.setText(rasp1);
  1864.             button20.setText(rasp2);
  1865.             button21.setText(rasp3);
  1866.             l4.setText(intr1);
  1867.             button3.setText(dom);
  1868.             corect3 = 1;
  1869.  
  1870.         }
  1871.  
  1872.         if (b == 54) {
  1873.             button22.setText(rasp1);
  1874.             button23.setText(rasp2);
  1875.             button24.setText(rasp3);
  1876.             l5.setText(intr1);
  1877.             button4.setText(dom);
  1878.             corect4 = 2;
  1879.  
  1880.         }
  1881.  
  1882.         if (b == 55) {
  1883.             button25.setText(rasp1);
  1884.             button26.setText(rasp2);
  1885.             button27.setText(rasp3);
  1886.             l6.setText(intr1);
  1887.             button5.setText(dom);
  1888.             corect5 = 3;
  1889.  
  1890.         }
  1891.  
  1892.         if (b == 56) {
  1893.             button28.setText(rasp1);
  1894.             button29.setText(rasp2);
  1895.             button30.setText(rasp3);
  1896.             l7.setText(intr1);
  1897.             button6.setText(dom);
  1898.             corect6 = 3;
  1899.  
  1900.         }
  1901.  
  1902.  
  1903.         if (b == 57) {
  1904.             button31.setText(rasp1);
  1905.             button32.setText(rasp2);
  1906.             button33.setText(rasp3);
  1907.             l8.setText(intr1);
  1908.             button7.setText(dom);
  1909.             corect7 = 1;
  1910.  
  1911.         }
  1912.  
  1913.         if (b == 58) {
  1914.             button34.setText(rasp1);
  1915.             button35.setText(rasp2);
  1916.             button36.setText(rasp3);
  1917.             l9.setText(intr1);
  1918.             button8.setText(dom);
  1919.             corect8 = 3;
  1920.  
  1921.         }
  1922.  
  1923.         if (b == 59) {
  1924.             button37.setText(rasp1);
  1925.             button38.setText(rasp2);
  1926.             button39.setText(rasp3);
  1927.             l10.setText(intr1);
  1928.             button9.setText(dom);
  1929.             corect9 = 2;
  1930.  
  1931.         }
  1932.  
  1933.         if (b == 60) {
  1934.             button40.setText(rasp1);
  1935.             button41.setText(rasp2);
  1936.             button42.setText(rasp3);
  1937.             l11.setText(intr1);
  1938.             button10.setText(dom);
  1939.             corect10 = 3;
  1940.  
  1941.         }
  1942.  
  1943.         if (b == 61) {
  1944.             button13.setText(rasp1);
  1945.             button14.setText(rasp2);
  1946.             button15.setText(rasp3);
  1947.             l2.setText(intr1);
  1948.             button1.setText(dom);
  1949.             corect1 = 1;
  1950.         }
  1951.  
  1952.         if (b == 62) {
  1953.             button16.setText(rasp1);
  1954.             button17.setText(rasp2);
  1955.             button18.setText(rasp3);
  1956.             l3.setText(intr1);
  1957.             button2.setText(dom);
  1958.             corect2 = 3;
  1959.  
  1960.         }
  1961.  
  1962.         if (b == 63) {
  1963.             button19.setText(rasp1);
  1964.             button20.setText(rasp2);
  1965.             button21.setText(rasp3);
  1966.             l4.setText(intr1);
  1967.             button3.setText(dom);
  1968.             corect3 = 2;
  1969.  
  1970.         }
  1971.  
  1972.         if (b == 64) {
  1973.             button22.setText(rasp1);
  1974.             button23.setText(rasp2);
  1975.             button24.setText(rasp3);
  1976.             l5.setText(intr1);
  1977.             button4.setText(dom);
  1978.             corect4 = 3;
  1979.  
  1980.         }
  1981.  
  1982.         if (b == 65) {
  1983.             button25.setText(rasp1);
  1984.             button26.setText(rasp2);
  1985.             button27.setText(rasp3);
  1986.             l6.setText(intr1);
  1987.             button5.setText(dom);
  1988.             corect5 = 1;
  1989.  
  1990.         }
  1991.  
  1992.         if (b == 66) {
  1993.             button28.setText(rasp1);
  1994.             button29.setText(rasp2);
  1995.             button30.setText(rasp3);
  1996.             l7.setText(intr1);
  1997.             button6.setText(dom);
  1998.             corect6 = 3;
  1999.  
  2000.         }
  2001.  
  2002.  
  2003.         if (b == 67) {
  2004.             button31.setText(rasp1);
  2005.             button32.setText(rasp2);
  2006.             button33.setText(rasp3);
  2007.             l8.setText(intr1);
  2008.             button7.setText(dom);
  2009.             corect7 = 1;
  2010.  
  2011.         }
  2012.  
  2013.         if (b == 68) {
  2014.             button34.setText(rasp1);
  2015.             button35.setText(rasp2);
  2016.             button36.setText(rasp3);
  2017.             l9.setText(intr1);
  2018.             button8.setText(dom);
  2019.             corect8 = 2;
  2020.  
  2021.         }
  2022.  
  2023.         if (b == 69) {
  2024.             button37.setText(rasp1);
  2025.             button38.setText(rasp2);
  2026.             button39.setText(rasp3);
  2027.             l10.setText(intr1);
  2028.             button9.setText(dom);
  2029.             corect9 = 1;
  2030.  
  2031.         }
  2032.  
  2033.         if (b == 70) {
  2034.             button40.setText(rasp1);
  2035.             button41.setText(rasp2);
  2036.             button42.setText(rasp3);
  2037.             l11.setText(intr1);
  2038.             button10.setText(dom);
  2039.             corect10 = 2;
  2040.  
  2041.         }
  2042.  
  2043.         if (b == 71) {
  2044.             button13.setText(rasp1);
  2045.             button14.setText(rasp2);
  2046.             button15.setText(rasp3);
  2047.             l2.setText(intr1);
  2048.             button1.setText(dom);
  2049.             corect1 = 1;
  2050.         }
  2051.  
  2052.         if (b == 72) {
  2053.             button16.setText(rasp1);
  2054.             button17.setText(rasp2);
  2055.             button18.setText(rasp3);
  2056.             l3.setText(intr1);
  2057.             button2.setText(dom);
  2058.             corect2 = 3;
  2059.  
  2060.         }
  2061.  
  2062.         if (b == 73) {
  2063.             button19.setText(rasp1);
  2064.             button20.setText(rasp2);
  2065.             button21.setText(rasp3);
  2066.             l4.setText(intr1);
  2067.             button3.setText(dom);
  2068.             corect3 = 1;
  2069.  
  2070.         }
  2071.  
  2072.         if (b == 74) {
  2073.             button22.setText(rasp1);
  2074.             button23.setText(rasp2);
  2075.             button24.setText(rasp3);
  2076.             l5.setText(intr1);
  2077.             button4.setText(dom);
  2078.             corect4 = 2;
  2079.  
  2080.         }
  2081.  
  2082.         if (b == 75) {
  2083.             button25.setText(rasp1);
  2084.             button26.setText(rasp2);
  2085.             button27.setText(rasp3);
  2086.             l6.setText(intr1);
  2087.             button5.setText(dom);
  2088.             corect5 = 1;
  2089.  
  2090.         }
  2091.  
  2092.         if (b == 76) {
  2093.             button28.setText(rasp1);
  2094.             button29.setText(rasp2);
  2095.             button30.setText(rasp3);
  2096.             l7.setText(intr1);
  2097.             button6.setText(dom);
  2098.             corect6 = 3;
  2099.  
  2100.         }
  2101.  
  2102.  
  2103.         if (b == 77) {
  2104.             button31.setText(rasp1);
  2105.             button32.setText(rasp2);
  2106.             button33.setText(rasp3);
  2107.             l8.setText(intr1);
  2108.             button7.setText(dom);
  2109.             corect7 = 2;
  2110.  
  2111.         }
  2112.  
  2113.         if (b == 78) {
  2114.             button34.setText(rasp1);
  2115.             button35.setText(rasp2);
  2116.             button36.setText(rasp3);
  2117.             l9.setText(intr1);
  2118.             button8.setText(dom);
  2119.             corect8 = 1;
  2120.  
  2121.         }
  2122.  
  2123.         if (b == 79) {
  2124.             button37.setText(rasp1);
  2125.             button38.setText(rasp2);
  2126.             button39.setText(rasp3);
  2127.             l10.setText(intr1);
  2128.             button9.setText(dom);
  2129.             corect9 = 1;
  2130.  
  2131.         }
  2132.  
  2133.         if (b == 80) {
  2134.             button40.setText(rasp1);
  2135.             button41.setText(rasp2);
  2136.             button42.setText(rasp3);
  2137.             l11.setText(intr1);
  2138.             button10.setText(dom);
  2139.             corect10 = 2;
  2140.  
  2141.         }
  2142.  
  2143.         if (b == 81) {
  2144.             button13.setText(rasp1);
  2145.             button14.setText(rasp2);
  2146.             button15.setText(rasp3);
  2147.             l2.setText(intr1);
  2148.             button1.setText(dom);
  2149.             corect1 = 2;
  2150.         }
  2151.  
  2152.         if (b == 82) {
  2153.             button16.setText(rasp1);
  2154.             button17.setText(rasp2);
  2155.             button18.setText(rasp3);
  2156.             l3.setText(intr1);
  2157.             button2.setText(dom);
  2158.             corect2 = 2;
  2159.  
  2160.         }
  2161.  
  2162.         if (b == 83) {
  2163.             button19.setText(rasp1);
  2164.             button20.setText(rasp2);
  2165.             button21.setText(rasp3);
  2166.             l4.setText(intr1);
  2167.             button3.setText(dom);
  2168.             corect3 = 1;
  2169.  
  2170.         }
  2171.  
  2172.         if (b == 84) {
  2173.             button22.setText(rasp1);
  2174.             button23.setText(rasp2);
  2175.             button24.setText(rasp3);
  2176.             l5.setText(intr1);
  2177.             button4.setText(dom);
  2178.             corect4 = 2;
  2179.  
  2180.         }
  2181.  
  2182.         if (b == 85) {
  2183.             button25.setText(rasp1);
  2184.             button26.setText(rasp2);
  2185.             button27.setText(rasp3);
  2186.             l6.setText(intr1);
  2187.             button5.setText(dom);
  2188.             corect5 = 3;
  2189.  
  2190.         }
  2191.  
  2192.         if (b == 86) {
  2193.             button28.setText(rasp1);
  2194.             button29.setText(rasp2);
  2195.             button30.setText(rasp3);
  2196.             l7.setText(intr1);
  2197.             button6.setText(dom);
  2198.             corect6 = 1;
  2199.  
  2200.         }
  2201.  
  2202.  
  2203.         if (b == 87) {
  2204.             button31.setText(rasp1);
  2205.             button32.setText(rasp2);
  2206.             button33.setText(rasp3);
  2207.             l8.setText(intr1);
  2208.             button7.setText(dom);
  2209.             corect7 = 3;
  2210.  
  2211.         }
  2212.  
  2213.         if (b == 88) {
  2214.             button34.setText(rasp1);
  2215.             button35.setText(rasp2);
  2216.             button36.setText(rasp3);
  2217.             l9.setText(intr1);
  2218.             button8.setText(dom);
  2219.             corect8 = 2;
  2220.  
  2221.         }
  2222.  
  2223.         if (b == 39) {
  2224.             button37.setText(rasp1);
  2225.             button38.setText(rasp2);
  2226.             button39.setText(rasp3);
  2227.             l10.setText(intr1);
  2228.             button9.setText(dom);
  2229.             corect9 = 1;
  2230.  
  2231.         }
  2232.  
  2233.         if (b == 90) {
  2234.             button40.setText(rasp1);
  2235.             button41.setText(rasp2);
  2236.             button42.setText(rasp3);
  2237.             l11.setText(intr1);
  2238.             button10.setText(dom);
  2239.             corect10 = 3;
  2240.  
  2241.         }
  2242.  
  2243.         if (b == 91) {
  2244.             button13.setText(rasp1);
  2245.             button14.setText(rasp2);
  2246.             button15.setText(rasp3);
  2247.             l2.setText(intr1);
  2248.             button1.setText(dom);
  2249.             corect1 = 1;
  2250.         }
  2251.  
  2252.         if (b == 92) {
  2253.             button16.setText(rasp1);
  2254.             button17.setText(rasp2);
  2255.             button18.setText(rasp3);
  2256.             l3.setText(intr1);
  2257.             button2.setText(dom);
  2258.             corect2 = 3;
  2259.  
  2260.         }
  2261.  
  2262.         if (b == 93) {
  2263.             button19.setText(rasp1);
  2264.             button20.setText(rasp2);
  2265.             button21.setText(rasp3);
  2266.             l4.setText(intr1);
  2267.             button3.setText(dom);
  2268.             corect3 = 2;
  2269.  
  2270.         }
  2271.  
  2272.         if (b == 94) {
  2273.             button22.setText(rasp1);
  2274.             button23.setText(rasp2);
  2275.             button24.setText(rasp3);
  2276.             l5.setText(intr1);
  2277.             button4.setText(dom);
  2278.             corect4 = 2;
  2279.  
  2280.         }
  2281.  
  2282.         if (b == 95) {
  2283.             button25.setText(rasp1);
  2284.             button26.setText(rasp2);
  2285.             button27.setText(rasp3);
  2286.             l6.setText(intr1);
  2287.             button5.setText(dom);
  2288.             corect5 = 3;
  2289.  
  2290.         }
  2291.  
  2292.         if (b == 96) {
  2293.             button28.setText(rasp1);
  2294.             button29.setText(rasp2);
  2295.             button30.setText(rasp3);
  2296.             l7.setText(intr1);
  2297.             button6.setText(dom);
  2298.             corect6 = 1;
  2299.  
  2300.         }
  2301.  
  2302.  
  2303.         if (b == 97) {
  2304.             button31.setText(rasp1);
  2305.             button32.setText(rasp2);
  2306.             button33.setText(rasp3);
  2307.             l8.setText(intr1);
  2308.             button7.setText(dom);
  2309.             corect7 = 2;
  2310.  
  2311.         }
  2312.  
  2313.         if (b == 98) {
  2314.             button34.setText(rasp1);
  2315.             button35.setText(rasp2);
  2316.             button36.setText(rasp3);
  2317.             l9.setText(intr1);
  2318.             button8.setText(dom);
  2319.             corect8 = 3;
  2320.  
  2321.         }
  2322.  
  2323.         if (b == 99) {
  2324.             button37.setText(rasp1);
  2325.             button38.setText(rasp2);
  2326.             button39.setText(rasp3);
  2327.             l10.setText(intr1);
  2328.             button9.setText(dom);
  2329.             corect9 = 1;
  2330.  
  2331.         }
  2332.  
  2333.         if (b == 100) {
  2334.             button40.setText(rasp1);
  2335.             button41.setText(rasp2);
  2336.             button42.setText(rasp3);
  2337.             l11.setText(intr1);
  2338.             button10.setText(dom);
  2339.             corect10 = 3;
  2340.  
  2341.         }
  2342.  
  2343.     }//afiseaza intrebarile in functie de parametrii a=id, b=datele si id ul intrebarii
  2344.  
  2345.     public void hai(int p) {
  2346.         p++;
  2347.         int j = 0;
  2348.         gasit = false;
  2349.         if (p == 10) {
  2350.             p = 2;
  2351.         }
  2352.         for (int k = 0; k < array.length; k++) {
  2353.             j++;
  2354.             if (array[k] == p) {
  2355.                 gasit = true;
  2356.                 hai(p);
  2357.             } else {
  2358.                 if (j == array.length && gasit == false && semafor == false) {
  2359.                     afiseaza_intrebarea(p);
  2360.                     semafor = true;
  2361.  
  2362.                 }
  2363.             }
  2364.         }
  2365.  
  2366.  
  2367.     } //apeleaza functia afiseaza_intrebarea
  2368.  
  2369.     public void adaugare_intrebare_utilizata(int a) {
  2370.         try {
  2371.             theQuery2("insert into  intrebari_bifate (id_intrebare,id_user) values('" + a + "','" + id + "')");
  2372.         } catch (Exception ex) {
  2373.         }
  2374.         id_set_intrebari_adaugate=a;
  2375.     }//adauga in bd id_intrebare si id-ul userului
  2376.  
  2377.     public void rating_plus(int x){
  2378.         if(id_set_intrebari_adaugate==1){
  2379.         }
  2380.         if(id_set_intrebari_adaugate==2){
  2381.             x=x+10;
  2382.         }
  2383.         if(id_set_intrebari_adaugate==3){
  2384.             x=x+20;
  2385.         }
  2386.         if(id_set_intrebari_adaugate==4){
  2387.             x=x+30;
  2388.         }
  2389.         if(id_set_intrebari_adaugate==5){
  2390.             x=x+40;
  2391.         }
  2392.         if(id_set_intrebari_adaugate==6){
  2393.             x=x+50;
  2394.         }
  2395.         if(id_set_intrebari_adaugate==7){
  2396.             x=x+60;
  2397.         }
  2398.         if(id_set_intrebari_adaugate==8){
  2399.             x=x+70;
  2400.         }
  2401.         if(id_set_intrebari_adaugate==9){
  2402.             x=x+80;
  2403.         }
  2404.         if(id_set_intrebari_adaugate==10){
  2405.             x=x+90;
  2406.         }
  2407.  
  2408.         Connection connection;
  2409.         PreparedStatement ps;
  2410.         try {
  2411.             connection = DriverManager.getConnection("jdbc:mysql://localhost/Aplicatie", "root", "");
  2412.             ps = connection.prepareStatement("SELECT `Rating` FROM `Intrebare1` WHERE `id` = '" + x + "'");
  2413.             ResultSet result = ps.executeQuery();
  2414.             if (result.next()) {
  2415.                 rating_bd = result.getInt("Rating");
  2416.             } else {
  2417.                 JOptionPane.showMessageDialog(null, "Eroare DB !");
  2418.             }
  2419.         } catch (SQLException ex) {
  2420.             Logger.getLogger(Tabela_unica.class.getName()).log(Level.SEVERE, null, ex);
  2421.         }
  2422.         rating_bd++;
  2423.         adaugare_rating(rating_bd,x);
  2424.  
  2425.     }
  2426.  
  2427.     public void rating_minus(int x){
  2428.         if(id_set_intrebari_adaugate==1){
  2429.         }
  2430.         if(id_set_intrebari_adaugate==2){
  2431.             x=x+10;
  2432.         }
  2433.         if(id_set_intrebari_adaugate==3){
  2434.             x=x+20;
  2435.         }
  2436.         if(id_set_intrebari_adaugate==4){
  2437.             x=x+30;
  2438.         }
  2439.         if(id_set_intrebari_adaugate==5){
  2440.             x=x+40;
  2441.         }
  2442.         if(id_set_intrebari_adaugate==6){
  2443.             x=x+50;
  2444.         }
  2445.         if(id_set_intrebari_adaugate==7){
  2446.             x=x+60;
  2447.         }
  2448.         if(id_set_intrebari_adaugate==8){
  2449.             x=x+70;
  2450.         }
  2451.         if(id_set_intrebari_adaugate==9){
  2452.             x=x+80;
  2453.         }
  2454.         if(id_set_intrebari_adaugate==10){
  2455.             x=x+90;
  2456.         }
  2457.  
  2458.         Connection connection;
  2459.         PreparedStatement ps;
  2460.         try {
  2461.             connection = DriverManager.getConnection("jdbc:mysql://localhost/Aplicatie", "root", "");
  2462.             ps = connection.prepareStatement("SELECT `Rating` FROM `Intrebare1` WHERE `id` = '" + x + "'");
  2463.             ResultSet result = ps.executeQuery();
  2464.             if (result.next()) {
  2465.                 rating_bd = result.getInt("Rating");
  2466.             } else {
  2467.                 JOptionPane.showMessageDialog(null, "Eroare DB !");
  2468.             }
  2469.         } catch (SQLException ex) {
  2470.             Logger.getLogger(Tabela_unica.class.getName()).log(Level.SEVERE, null, ex);
  2471.         }
  2472.         rating_bd--;
  2473.         adaugare_rating(rating_bd,x);
  2474.         verificare_rating(rating_bd,x);
  2475.  
  2476.     }
  2477.  
  2478.  
  2479.     public void verificare_rating(int a,int b) {
  2480.         if (a == -5) {
  2481.             if (b <= 40) {
  2482.                 Connection connection;
  2483.                 PreparedStatement ps;
  2484.                 try {
  2485.                     connection = DriverManager.getConnection("jdbc:mysql://localhost/Aplicatie", "root", "");
  2486.                     ps = connection.prepareStatement("SELECT `Rating` FROM `Intrebare1` WHERE `id` = '" + 101 + "'");
  2487.                     ResultSet result = ps.executeQuery();
  2488.                     if (result.next()) {
  2489.                         contor_ia = result.getInt("Rating");
  2490.                     } else {
  2491.                         JOptionPane.showMessageDialog(null, "Eroare DB !");
  2492.                     }
  2493.                 } catch (SQLException ex) {
  2494.                     Logger.getLogger(Tabela_unica.class.getName()).log(Level.SEVERE, null, ex);
  2495.                 }
  2496.  
  2497.  
  2498.                 if (contor_ia >4) {
  2499.                     contor_ia++;
  2500.                     try {
  2501.                         theQuery2("update  intrebare1 set rating='" + contor_ia + "' where id='" + 101 + "'");
  2502.                     } catch (Exception ex) {
  2503.                     }
  2504.                 }
  2505.                 if (contor_ia == 4) {
  2506.                     contor_ia++;
  2507.                     try {
  2508.                         theQuery2("update  intrebare1 set id='" + 125 + "' where id='" + b + "'");
  2509.                         theQuery2("update  intrebare1 set rating='" + contor_ia + "' where id='" + 101 + "'");
  2510.                     } catch (Exception ex) {
  2511.                     }
  2512.                 }
  2513.                 if (contor_ia == 3) {
  2514.                     contor_ia++;
  2515.                     try {
  2516.                         theQuery2("update  intrebare1 set id='" + 124 + "' where id='" + b + "'");
  2517.                         theQuery2("update  intrebare1 set rating='" + contor_ia + "' where id='" + 101 + "'");
  2518.                     } catch (Exception ex) {
  2519.                     }
  2520.                 }
  2521.                 if (contor_ia == 2) {
  2522.                     contor_ia++;
  2523.                     try {
  2524.                         theQuery2("update  intrebare1 set id='" + 123 + "' where id='" + b + "'");
  2525.                         theQuery2("update  intrebare1 set rating='" + contor_ia + "' where id='" + 101 + "'");
  2526.                     } catch (Exception ex) {
  2527.                     }
  2528.                 }
  2529.                 if (contor_ia == 1) {
  2530.                     contor_ia++;
  2531.                     try {
  2532.                         theQuery2("update  intrebare1 set id='" + 122 + "' where id='" + b + "'");
  2533.                         theQuery2("update  intrebare1 set rating='" + contor_ia + "' where id='" + 101 + "'");
  2534.                     } catch (Exception ex) {
  2535.                     }
  2536.                 }
  2537.  
  2538.                 if (contor_ia == 0) {
  2539.                     contor_ia++;
  2540.                     try {
  2541.                         theQuery2("update  intrebare1 set id='" + 121 + "' where id='" + b + "'");
  2542.                         theQuery2("update  intrebare1 set rating='" + contor_ia + "' where id='" + 101 + "'");
  2543.                     } catch (Exception ex) {
  2544.                     }
  2545.                 }
  2546.             }
  2547.  
  2548.  
  2549.             if (b > 40 && b<=70) {
  2550.                 Connection connection;
  2551.                 PreparedStatement ps;
  2552.                 try {
  2553.                     connection = DriverManager.getConnection("jdbc:mysql://localhost/Aplicatie", "root", "");
  2554.                     ps = connection.prepareStatement("SELECT `Rating` FROM `Intrebare1` WHERE `id` = '" + 102 + "'");
  2555.                     ResultSet result = ps.executeQuery();
  2556.                     if (result.next()) {
  2557.                         contor_im = result.getInt("Rating");
  2558.                     } else {
  2559.                         JOptionPane.showMessageDialog(null, "Eroare DB !");
  2560.                     }
  2561.                 } catch (SQLException ex) {
  2562.                     Logger.getLogger(Tabela_unica.class.getName()).log(Level.SEVERE, null, ex);
  2563.                 }
  2564.  
  2565.  
  2566.                 if (contor_im >4) {
  2567.                     contor_im++;
  2568.                     try {
  2569.                         theQuery2("update  intrebare1 set rating='" + contor_im + "' where id='" + 102 + "'");
  2570.                     } catch (Exception ex) {
  2571.                     }
  2572.                 }
  2573.                 if (contor_im == 4) {
  2574.                     contor_im++;
  2575.                     try {
  2576.                         theQuery2("update  intrebare1 set id='" + 130 + "' where id='" + b + "'");
  2577.                         theQuery2("update  intrebare1 set rating='" + contor_im + "' where id='" + 102 + "'");
  2578.                     } catch (Exception ex) {
  2579.                     }
  2580.                 }
  2581.                 if (contor_im == 3) {
  2582.                     contor_im++;
  2583.                     try {
  2584.                         theQuery2("update  intrebare1 set id='" + 129 + "' where id='" + b + "'");
  2585.                         theQuery2("update  intrebare1 set rating='" + contor_im + "' where id='" + 102 + "'");
  2586.                     } catch (Exception ex) {
  2587.                     }
  2588.                 }
  2589.                 if (contor_im == 2) {
  2590.                     contor_im++;
  2591.                     try {
  2592.                         theQuery2("update  intrebare1 set id='" + 128 + "' where id='" + b + "'");
  2593.                         theQuery2("update  intrebare1 set rating='" + contor_im + "' where id='" + 102 + "'");
  2594.                     } catch (Exception ex) {
  2595.                     }
  2596.                 }
  2597.                 if (contor_im == 1) {
  2598.                     contor_im++;
  2599.                     try {
  2600.                         theQuery2("update  intrebare1 set id='" + 127 + "' where id='" + b + "'");
  2601.                         theQuery2("update  intrebare1 set rating='" + contor_im + "' where id='" + 102 + "'");
  2602.                     } catch (Exception ex) {
  2603.                     }
  2604.                 }
  2605.  
  2606.                 if (contor_im == 0) {
  2607.                     contor_im++;
  2608.                     try {
  2609.                         theQuery2("update  intrebare1 set id='" + 126 + "' where id='" + b + "'");
  2610.                         theQuery2("update  intrebare1 set rating='" + contor_im + "' where id='" + 102 + "'");
  2611.                     } catch (Exception ex) {
  2612.                     }
  2613.                 }
  2614.             }
  2615.  
  2616.  
  2617.             if (b > 70) {
  2618.                 Connection connection;
  2619.                 PreparedStatement ps;
  2620.                 try {
  2621.                     connection = DriverManager.getConnection("jdbc:mysql://localhost/Aplicatie", "root", "");
  2622.                     ps = connection.prepareStatement("SELECT `Rating` FROM `Intrebare1` WHERE `id` = '" + 103 + "'");
  2623.                     ResultSet result = ps.executeQuery();
  2624.                     if (result.next()) {
  2625.                         contor_id = result.getInt("Rating");
  2626.                     } else {
  2627.                         JOptionPane.showMessageDialog(null, "Eroare DB !");
  2628.                     }
  2629.                 } catch (SQLException ex) {
  2630.                     Logger.getLogger(Tabela_unica.class.getName()).log(Level.SEVERE, null, ex);
  2631.                 }
  2632.  
  2633.  
  2634.                 if (contor_id >4) {
  2635.                     contor_id++;
  2636.                     try {
  2637.                         theQuery2("update  intrebare1 set rating='" + contor_id + "' where id='" + 103 + "'");
  2638.                     } catch (Exception ex) {
  2639.                     }
  2640.                 }
  2641.                 if (contor_id == 4) {
  2642.                     contor_id++;
  2643.                     try {
  2644.                         theQuery2("update  intrebare1 set id='" + 135 + "' where id='" + b + "'");
  2645.                         theQuery2("update  intrebare1 set rating='" + contor_id + "' where id='" + 103 + "'");
  2646.                     } catch (Exception ex) {
  2647.                     }
  2648.                 }
  2649.                 if (contor_id == 3) {
  2650.                     contor_id++;
  2651.                     try {
  2652.                         theQuery2("update  intrebare1 set id='" + 134 + "' where id='" + b + "'");
  2653.                         theQuery2("update  intrebare1 set rating='" + contor_id + "' where id='" + 103 + "'");
  2654.                     } catch (Exception ex) {
  2655.                     }
  2656.                 }
  2657.                 if (contor_id == 2) {
  2658.                     contor_id++;
  2659.                     try {
  2660.                         theQuery2("update  intrebare1 set id='" + 133 + "' where id='" + b + "'");
  2661.                         theQuery2("update  intrebare1 set rating='" + contor_id + "' where id='" + 103 + "'");
  2662.                     } catch (Exception ex) {
  2663.                     }
  2664.                 }
  2665.                 if (contor_id == 1) {
  2666.                     contor_id++;
  2667.                     try {
  2668.                         theQuery2("update  intrebare1 set id='" + 132 + "' where id='" + b + "'");
  2669.                         theQuery2("update  intrebare1 set rating='" + contor_id + "' where id='" + 103 + "'");
  2670.                     } catch (Exception ex) {
  2671.                     }
  2672.                 }
  2673.  
  2674.                 if (contor_id == 0) {
  2675.                     contor_id++;
  2676.                     try {
  2677.                         theQuery2("update  intrebare1 set id='" + 131 + "' where id='" + b + "'");
  2678.                         theQuery2("update  intrebare1 set rating='" + contor_id + "' where id='" + 103 + "'");
  2679.                     } catch (Exception ex) {
  2680.                     }
  2681.                 }
  2682.             }
  2683.  
  2684.         }
  2685.     }
  2686.  
  2687.     public void adaugare_rating(int a, int b) {
  2688.         try {
  2689.             theQuery2("update  intrebare1 set rating='" + a + "' where id='" + b + "'");
  2690.         } catch (Exception ex) {
  2691.         }
  2692.     }
  2693.  
  2694.     public static void theQuery(String query) {
  2695.         Connection con = null;
  2696.         Statement st = null;
  2697.         try {
  2698.             con = DriverManager.getConnection("jdbc:mysql://localhost/Aplicatie", "root", "");
  2699.             st = con.createStatement();
  2700.             st.executeUpdate(query);
  2701.         } catch (SQLException | HeadlessException ex) {
  2702.             JOptionPane.showMessageDialog(null, ex.getMessage());
  2703.         }
  2704.     }
  2705.  
  2706.     public void actionPerformed(ActionEvent ev) {
  2707.         if (ev.getSource() == button1)
  2708.             if (nr_click >= 1)
  2709.                 JOptionPane.showMessageDialog(null, "Domeniu ales deja !");
  2710.             else {
  2711.                 add(p2);
  2712.                 remove(p1);
  2713.                 revalidate();
  2714.                 repaint();
  2715.                 nr_click++;
  2716.             }
  2717.  
  2718.  
  2719.         if (ev.getSource() == button2) {
  2720.             if (nr_click2 >= 1)
  2721.                 JOptionPane.showMessageDialog(null, "Domeniu ales deja !");
  2722.             else {
  2723.                 add(p3);
  2724.                 remove(p1);
  2725.                 revalidate();
  2726.                 repaint();
  2727.                 nr_click2++;
  2728.  
  2729.             }
  2730.         }
  2731.  
  2732.         if (ev.getSource() == button3) {
  2733.             if (nr_click3 >= 1)
  2734.                 JOptionPane.showMessageDialog(null, "Domeniu ales deja !");
  2735.             else {
  2736.                 add(p4);
  2737.                 remove(p1);
  2738.                 revalidate();
  2739.                 repaint();
  2740.                 nr_click3++;
  2741.             }
  2742.         }
  2743.  
  2744.         if (ev.getSource() == button4) {
  2745.             if (nr_click4 >= 1)
  2746.                 JOptionPane.showMessageDialog(null, "Domeniu ales deja !");
  2747.             else {
  2748.                 add(p5);
  2749.                 remove(p1);
  2750.                 revalidate();
  2751.                 repaint();
  2752.                 nr_click4++;
  2753.             }
  2754.         }
  2755.  
  2756.         if (ev.getSource() == button5) {
  2757.             if (nr_click5 >= 1)
  2758.                 JOptionPane.showMessageDialog(null, "Domeniu ales deja !");
  2759.             else {
  2760.                 add(p6);
  2761.                 remove(p1);
  2762.                 revalidate();
  2763.                 repaint();
  2764.                 nr_click5++;
  2765.             }
  2766.         }
  2767.  
  2768.         if (ev.getSource() == button6) {
  2769.             if (nr_click6 >= 1)
  2770.                 JOptionPane.showMessageDialog(null, "Domeniu ales deja !");
  2771.             else {
  2772.                 add(p7);
  2773.                 remove(p1);
  2774.                 revalidate();
  2775.                 repaint();
  2776.                 nr_click6++;
  2777.             }
  2778.         }
  2779.  
  2780.         if (ev.getSource() == button7) {
  2781.             if (nr_click7 >= 1)
  2782.                 JOptionPane.showMessageDialog(null, "Domeniu ales deja !");
  2783.             else {
  2784.                 add(p8);
  2785.                 remove(p1);
  2786.                 revalidate();
  2787.                 repaint();
  2788.                 nr_click7++;
  2789.             }
  2790.         }
  2791.  
  2792.         if (ev.getSource() == button8) {
  2793.             if (nr_click8 >= 1)
  2794.                 JOptionPane.showMessageDialog(null, "Domeniu ales deja !");
  2795.             else {
  2796.                 add(p9);
  2797.                 remove(p1);
  2798.                 revalidate();
  2799.                 repaint();
  2800.                 nr_click8++;
  2801.             }
  2802.         }
  2803.  
  2804.         if (ev.getSource() == button9) {
  2805.             if (nr_click9 >= 1)
  2806.                 JOptionPane.showMessageDialog(null, "Domeniu ales deja !");
  2807.             else {
  2808.                 add(p10);
  2809.                 remove(p1);
  2810.                 revalidate();
  2811.                 repaint();
  2812.                 nr_click9++;
  2813.             }
  2814.         }
  2815.  
  2816.         if (ev.getSource() == button10) {
  2817.             if (nr_click10 >= 1)
  2818.                 JOptionPane.showMessageDialog(null, "Domeniu ales deja !");
  2819.             else {
  2820.                 add(p11);
  2821.                 remove(p1);
  2822.                 revalidate();
  2823.                 repaint();
  2824.                 nr_click10++;
  2825.             }
  2826.         }
  2827.  
  2828.  
  2829.         if (ev.getSource() == button13) {
  2830.             nr_click13++;
  2831.             like1.setVisible(true);
  2832.             rate1.setVisible(true);
  2833.             dlike1.setVisible(true);
  2834.             buttoniesire.setBackground(Color.GREEN);
  2835.             if (corect1 == 1) {
  2836.                 if (nr_click13 == 1) {
  2837.                     button1.setBackground(Color.GREEN);
  2838.                     punctaj = punctaj + 10;
  2839.                     button13.setBackground(Color.GREEN);
  2840.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  2841.                     nr_click14++;
  2842.                     nr_click15++;
  2843.                 }
  2844.             }
  2845.             if (corect1 == 2) {
  2846.                 if (nr_click13 == 1) {
  2847.                     button1.setBackground(Color.RED);
  2848.                     button14.setBackground(Color.GREEN);
  2849.                     button13.setBackground(Color.RED);
  2850.                     button1.setForeground(Color.WHITE);
  2851.                     nr_click14++;
  2852.                     nr_click15++;
  2853.                 }
  2854.             }
  2855.  
  2856.             if (corect1 == 3) {
  2857.                 if (nr_click13 == 1) {
  2858.                     button1.setBackground(Color.RED);
  2859.                     button15.setBackground(Color.GREEN);
  2860.                     button13.setBackground(Color.RED);
  2861.                     button1.setForeground(Color.WHITE);
  2862.                     nr_click14++;
  2863.                     nr_click15++;
  2864.                 }
  2865.             }
  2866.         }
  2867.  
  2868.         if (ev.getSource() == button14) {
  2869.             buttoniesire.setBackground(Color.GREEN);
  2870.             nr_click14++;
  2871.             like1.setVisible(true);
  2872.             rate1.setVisible(true);
  2873.             dlike1.setVisible(true);
  2874.             if (corect1 == 1) {
  2875.                 if (nr_click14 == 1) {
  2876.                     button1.setForeground(Color.WHITE);
  2877.                     button1.setBackground(Color.RED);
  2878.                     button13.setBackground(Color.GREEN);
  2879.                     button14.setBackground(Color.RED);
  2880.                     nr_click13++;
  2881.                     nr_click15++;
  2882.                 }
  2883.             }
  2884.  
  2885.             if (corect1 == 2) {
  2886.                 if (nr_click14 == 1) {
  2887.                     button1.setBackground(Color.GREEN);
  2888.                     button14.setBackground(Color.GREEN);
  2889.                     punctaj = punctaj + 10;
  2890.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  2891.                     nr_click13++;
  2892.                     nr_click15++;
  2893.                 }
  2894.             }
  2895.  
  2896.             if (corect1 == 3) {
  2897.                 if (nr_click14 == 1) {
  2898.                     button1.setForeground(Color.WHITE);
  2899.                     button1.setBackground(Color.RED);
  2900.                     button15.setBackground(Color.GREEN);
  2901.                     button14.setBackground(Color.RED);
  2902.                     nr_click13++;
  2903.                     nr_click15++;
  2904.                 }
  2905.             }
  2906.  
  2907.         }
  2908.  
  2909.         if (ev.getSource() == button15) {
  2910.             nr_click15++;
  2911.             like1.setVisible(true);
  2912.             rate1.setVisible(true);
  2913.             dlike1.setVisible(true);
  2914.             buttoniesire.setBackground(Color.GREEN);
  2915.             if (corect1 == 1) {
  2916.                 if (nr_click15 == 1) {
  2917.                     button1.setForeground(Color.WHITE);
  2918.                     button1.setBackground(Color.RED);
  2919.                     button13.setBackground(Color.GREEN);
  2920.                     button15.setBackground(Color.RED);
  2921.                     nr_click13++;
  2922.                     nr_click14++;
  2923.                 }
  2924.             }
  2925.  
  2926.             if (corect1 == 2) {
  2927.                 if (nr_click15 == 1) {
  2928.                     button1.setForeground(Color.WHITE);
  2929.                     button1.setBackground(Color.RED);
  2930.                     button14.setBackground(Color.GREEN);
  2931.                     button15.setBackground(Color.RED);
  2932.                     nr_click13++;
  2933.                     nr_click14++;
  2934.                 }
  2935.             }
  2936.  
  2937.             if (corect1 == 3) {
  2938.                 if (nr_click15 == 1) {
  2939.                     button1.setBackground(Color.GREEN);
  2940.                     button15.setBackground(Color.GREEN);
  2941.                     punctaj = punctaj + 10;
  2942.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  2943.                     nr_click13++;
  2944.                     nr_click14++;
  2945.                 }
  2946.             }
  2947.         }
  2948.  
  2949.         if (ev.getSource() == buttoniesire) {
  2950.             if (nr_click13 > 0 || nr_click14 > 0 || nr_click15 > 0) {
  2951.                 add(p1);
  2952.                 remove(p2);
  2953.                 revalidate();
  2954.                 repaint();
  2955.                 sfarsit++;
  2956.             } else {
  2957.                 JOptionPane.showMessageDialog(null, "Alegeti o varianta de raspuns !");
  2958.             }
  2959.  
  2960.         }
  2961.  
  2962.         if (ev.getSource() == button16) {
  2963.             nr_click16++;
  2964.             like2.setVisible(true);
  2965.             rate2.setVisible(true);
  2966.             dlike2.setVisible(true);
  2967.             buttoniesire2.setBackground(Color.GREEN);
  2968.             if (corect2 == 1) {
  2969.                 if (nr_click16 == 1) {
  2970.                     button2.setBackground(Color.GREEN);
  2971.                     punctaj = punctaj + 10;
  2972.                     button16.setBackground(Color.GREEN);
  2973.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  2974.                     nr_click17++;
  2975.                     nr_click18++;
  2976.                 }
  2977.             }
  2978.             if (corect2 == 2) {
  2979.                 if (nr_click16 == 1) {
  2980.                     button2.setBackground(Color.RED);
  2981.                     button17.setBackground(Color.GREEN);
  2982.                     button16.setBackground(Color.RED);
  2983.                     button2.setForeground(Color.WHITE);
  2984.                     nr_click17++;
  2985.                     nr_click18++;
  2986.                 }
  2987.             }
  2988.  
  2989.             if (corect2 == 3) {
  2990.                 if (nr_click16 == 1) {
  2991.                     button2.setBackground(Color.RED);
  2992.                     button18.setBackground(Color.GREEN);
  2993.                     button16.setBackground(Color.RED);
  2994.                     button2.setForeground(Color.WHITE);
  2995.                     nr_click17++;
  2996.                     nr_click18++;
  2997.                 }
  2998.             }
  2999.         }
  3000.  
  3001.         if (ev.getSource() == button17) {
  3002.             buttoniesire2.setBackground(Color.GREEN);
  3003.             nr_click17++;
  3004.             like2.setVisible(true);
  3005.             rate2.setVisible(true);
  3006.             dlike2.setVisible(true);
  3007.             if (corect2 == 1) {
  3008.                 if (nr_click17 == 1) {
  3009.                     button2.setForeground(Color.WHITE);
  3010.                     button2.setBackground(Color.RED);
  3011.                     button16.setBackground(Color.GREEN);
  3012.                     button17.setBackground(Color.RED);
  3013.                     nr_click16++;
  3014.                     nr_click18++;
  3015.                 }
  3016.             }
  3017.  
  3018.             if (corect2 == 2) {
  3019.                 if (nr_click17 == 1) {
  3020.                     button2.setBackground(Color.GREEN);
  3021.                     button17.setBackground(Color.GREEN);
  3022.                     punctaj = punctaj + 10;
  3023.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3024.                     nr_click16++;
  3025.                     nr_click18++;
  3026.                 }
  3027.             }
  3028.  
  3029.             if (corect2 == 3) {
  3030.                 if (nr_click17 == 1) {
  3031.                     button2.setForeground(Color.WHITE);
  3032.                     button2.setBackground(Color.RED);
  3033.                     button18.setBackground(Color.GREEN);
  3034.                     button17.setBackground(Color.RED);
  3035.                     nr_click16++;
  3036.                     nr_click18++;
  3037.                 }
  3038.             }
  3039.  
  3040.  
  3041.         }
  3042.  
  3043.         if (ev.getSource() == button18) {
  3044.             nr_click18++;
  3045.             like2.setVisible(true);
  3046.             rate2.setVisible(true);
  3047.             dlike2.setVisible(true);
  3048.             buttoniesire2.setBackground(Color.GREEN);
  3049.             if (corect2 == 1) {
  3050.                 if (nr_click18 == 1) {
  3051.                     button2.setForeground(Color.WHITE);
  3052.                     button2.setBackground(Color.RED);
  3053.                     button16.setBackground(Color.GREEN);
  3054.                     button18.setBackground(Color.RED);
  3055.                     nr_click16++;
  3056.                     nr_click17++;
  3057.                 }
  3058.             }
  3059.  
  3060.             if (corect2 == 2) {
  3061.                 if (nr_click18 == 1) {
  3062.                     button2.setForeground(Color.WHITE);
  3063.                     button2.setBackground(Color.RED);
  3064.                     button17.setBackground(Color.GREEN);
  3065.                     button18.setBackground(Color.RED);
  3066.                     nr_click16++;
  3067.                     nr_click17++;
  3068.                 }
  3069.             }
  3070.  
  3071.             if (corect2 == 3) {
  3072.                 if (nr_click18 == 1) {
  3073.                     button2.setBackground(Color.GREEN);
  3074.                     button18.setBackground(Color.GREEN);
  3075.                     punctaj = punctaj + 10;
  3076.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3077.                     nr_click16++;
  3078.                     nr_click17++;
  3079.                 }
  3080.             }
  3081.         }
  3082.  
  3083.         if (ev.getSource() == buttoniesire2) {
  3084.             if (nr_click16 > 0 || nr_click17 > 0 || nr_click18 > 0) {
  3085.                 add(p1);
  3086.                 remove(p3);
  3087.                 revalidate();
  3088.                 repaint();
  3089.                 sfarsit++;
  3090.             } else {
  3091.                 JOptionPane.showMessageDialog(null, "Alegeti o varianta de raspuns !");
  3092.             }
  3093.  
  3094.         }
  3095.  
  3096.         if (ev.getSource() == button19) {
  3097.             nr_click19++;
  3098.             like3.setVisible(true);
  3099.             rate3.setVisible(true);
  3100.             dlike3.setVisible(true);
  3101.             buttoniesire3.setBackground(Color.GREEN);
  3102.             if (corect3 == 1) {
  3103.                 if (nr_click19 == 1) {
  3104.                     button3.setBackground(Color.GREEN);
  3105.                     punctaj = punctaj + 10;
  3106.                     button19.setBackground(Color.GREEN);
  3107.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3108.                     nr_click20++;
  3109.                     nr_click21++;
  3110.                 }
  3111.             }
  3112.             if (corect3 == 2) {
  3113.                 if (nr_click19 == 1) {
  3114.                     button3.setBackground(Color.RED);
  3115.                     button20.setBackground(Color.GREEN);
  3116.                     button19.setBackground(Color.RED);
  3117.                     button3.setForeground(Color.WHITE);
  3118.                     nr_click20++;
  3119.                     nr_click21++;
  3120.                 }
  3121.             }
  3122.  
  3123.             if (corect3 == 3) {
  3124.                 if (nr_click19 == 1) {
  3125.                     button3.setBackground(Color.RED);
  3126.                     button21.setBackground(Color.GREEN);
  3127.                     button19.setBackground(Color.RED);
  3128.                     button3.setForeground(Color.WHITE);
  3129.                     nr_click20++;
  3130.                     nr_click21++;
  3131.                 }
  3132.             }
  3133.         }
  3134.  
  3135.         if (ev.getSource() == button20) {
  3136.             buttoniesire3.setBackground(Color.GREEN);
  3137.             like3.setVisible(true);
  3138.             rate3.setVisible(true);
  3139.             dlike3.setVisible(true);
  3140.             nr_click20++;
  3141.             if (corect3 == 1) {
  3142.                 if (nr_click20 == 1) {
  3143.                     button3.setForeground(Color.WHITE);
  3144.                     button3.setBackground(Color.RED);
  3145.                     button19.setBackground(Color.GREEN);
  3146.                     button20.setBackground(Color.RED);
  3147.                     nr_click19++;
  3148.                     nr_click21++;
  3149.                 }
  3150.             }
  3151.  
  3152.             if (corect3 == 2) {
  3153.                 if (nr_click20 == 1) {
  3154.                     button3.setBackground(Color.GREEN);
  3155.                     button20.setBackground(Color.GREEN);
  3156.                     punctaj = punctaj + 10;
  3157.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3158.                     nr_click19++;
  3159.                     nr_click21++;
  3160.                 }
  3161.             }
  3162.  
  3163.             if (corect3 == 3) {
  3164.                 if (nr_click20 == 1) {
  3165.                     button3.setForeground(Color.WHITE);
  3166.                     button3.setBackground(Color.RED);
  3167.                     button21.setBackground(Color.GREEN);
  3168.                     button20.setBackground(Color.RED);
  3169.                     nr_click19++;
  3170.                     nr_click21++;
  3171.                 }
  3172.             }
  3173.  
  3174.  
  3175.         }
  3176.  
  3177.         if (ev.getSource() == button21) {
  3178.             nr_click21++;
  3179.             like3.setVisible(true);
  3180.             rate3.setVisible(true);
  3181.             dlike3.setVisible(true);
  3182.             buttoniesire3.setBackground(Color.GREEN);
  3183.             if (corect3 == 1) {
  3184.                 if (nr_click21 == 1) {
  3185.                     button3.setForeground(Color.WHITE);
  3186.                     button3.setBackground(Color.RED);
  3187.                     button19.setBackground(Color.GREEN);
  3188.                     button21.setBackground(Color.RED);
  3189.                     nr_click19++;
  3190.                     nr_click20++;
  3191.                 }
  3192.             }
  3193.  
  3194.             if (corect3 == 2) {
  3195.                 if (nr_click21 == 1) {
  3196.                     button3.setForeground(Color.WHITE);
  3197.                     button3.setBackground(Color.RED);
  3198.                     button20.setBackground(Color.GREEN);
  3199.                     button21.setBackground(Color.RED);
  3200.                     nr_click19++;
  3201.                     nr_click20++;
  3202.                 }
  3203.             }
  3204.  
  3205.             if (corect3 == 3) {
  3206.                 if (nr_click21 == 1) {
  3207.                     button3.setBackground(Color.GREEN);
  3208.                     button21.setBackground(Color.GREEN);
  3209.                     punctaj = punctaj + 10;
  3210.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3211.                     nr_click19++;
  3212.                     nr_click20++;
  3213.                 }
  3214.             }
  3215.         }
  3216.  
  3217.         if (ev.getSource() == buttoniesire3) {
  3218.             if (nr_click19 > 0 || nr_click20 > 0 || nr_click21 > 0) {
  3219.                 add(p1);
  3220.                 remove(p4);
  3221.                 revalidate();
  3222.                 repaint();
  3223.                 sfarsit++;
  3224.             } else {
  3225.                 JOptionPane.showMessageDialog(null, "Alegeti o varianta de raspuns !");
  3226.             }
  3227.  
  3228.         }
  3229.  
  3230.  
  3231.         if (ev.getSource() == button22) {
  3232.             nr_click22++;
  3233.             like4.setVisible(true);
  3234.             rate4.setVisible(true);
  3235.             dlike4.setVisible(true);
  3236.             buttoniesire4.setBackground(Color.GREEN);
  3237.             if (corect4 == 1) {
  3238.                 if (nr_click22 == 1) {
  3239.                     button4.setBackground(Color.GREEN);
  3240.                     punctaj = punctaj + 10;
  3241.                     button22.setBackground(Color.GREEN);
  3242.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3243.                     nr_click23++;
  3244.                     nr_click24++;
  3245.                 }
  3246.             }
  3247.             if (corect4 == 2) {
  3248.                 if (nr_click22 == 1) {
  3249.                     button4.setBackground(Color.RED);
  3250.                     button23.setBackground(Color.GREEN);
  3251.                     button22.setBackground(Color.RED);
  3252.                     button4.setForeground(Color.WHITE);
  3253.                     nr_click23++;
  3254.                     nr_click24++;
  3255.                 }
  3256.             }
  3257.  
  3258.             if (corect4 == 3) {
  3259.                 if (nr_click22 == 1) {
  3260.                     button4.setBackground(Color.RED);
  3261.                     button24.setBackground(Color.GREEN);
  3262.                     button22.setBackground(Color.RED);
  3263.                     button4.setForeground(Color.WHITE);
  3264.                     nr_click23++;
  3265.                     nr_click24++;
  3266.                 }
  3267.             }
  3268.         }
  3269.  
  3270.         if (ev.getSource() == button23) {
  3271.             buttoniesire4.setBackground(Color.GREEN);
  3272.             nr_click23++;
  3273.             like4.setVisible(true);
  3274.             rate4.setVisible(true);
  3275.             dlike4.setVisible(true);
  3276.             if (corect4 == 1) {
  3277.                 if (nr_click23 == 1) {
  3278.                     button4.setForeground(Color.WHITE);
  3279.                     button4.setBackground(Color.RED);
  3280.                     button22.setBackground(Color.GREEN);
  3281.                     button23.setBackground(Color.RED);
  3282.                     nr_click22++;
  3283.                     nr_click24++;
  3284.                 }
  3285.             }
  3286.  
  3287.             if (corect4 == 2) {
  3288.                 if (nr_click23 == 1) {
  3289.                     button4.setBackground(Color.GREEN);
  3290.                     button23.setBackground(Color.GREEN);
  3291.                     punctaj = punctaj + 10;
  3292.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3293.                     nr_click22++;
  3294.                     nr_click24++;
  3295.                 }
  3296.             }
  3297.  
  3298.             if (corect4 == 3) {
  3299.                 if (nr_click23 == 1) {
  3300.                     button4.setForeground(Color.WHITE);
  3301.                     button4.setBackground(Color.RED);
  3302.                     button24.setBackground(Color.GREEN);
  3303.                     button23.setBackground(Color.RED);
  3304.                     nr_click22++;
  3305.                     nr_click24++;
  3306.                 }
  3307.             }
  3308.         }
  3309.  
  3310.         if (ev.getSource() == button24) {
  3311.             nr_click24++;
  3312.             like4.setVisible(true);
  3313.             rate4.setVisible(true);
  3314.             dlike4.setVisible(true);
  3315.             buttoniesire4.setBackground(Color.GREEN);
  3316.             if (corect4 == 1) {
  3317.                 if (nr_click24 == 1) {
  3318.                     button4.setForeground(Color.WHITE);
  3319.                     button4.setBackground(Color.RED);
  3320.                     button22.setBackground(Color.GREEN);
  3321.                     button24.setBackground(Color.RED);
  3322.                     nr_click22++;
  3323.                     nr_click23++;
  3324.                 }
  3325.             }
  3326.  
  3327.             if (corect4 == 2) {
  3328.                 if (nr_click24 == 1) {
  3329.                     button4.setForeground(Color.WHITE);
  3330.                     button4.setBackground(Color.RED);
  3331.                     button23.setBackground(Color.GREEN);
  3332.                     button24.setBackground(Color.RED);
  3333.                     nr_click22++;
  3334.                     nr_click23++;
  3335.                 }
  3336.             }
  3337.  
  3338.             if (corect4 == 3) {
  3339.                 if (nr_click24 == 1) {
  3340.                     button4.setBackground(Color.GREEN);
  3341.                     button24.setBackground(Color.GREEN);
  3342.                     punctaj = punctaj + 10;
  3343.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3344.                     nr_click22++;
  3345.                     nr_click23++;
  3346.                 }
  3347.             }
  3348.         }
  3349.         if (ev.getSource() == buttoniesire4) {
  3350.             if (nr_click22 > 0 || nr_click23 > 0 || nr_click24 > 0) {
  3351.                 add(p1);
  3352.                 remove(p5);
  3353.                 revalidate();
  3354.                 repaint();
  3355.                 sfarsit++;
  3356.             } else {
  3357.                 JOptionPane.showMessageDialog(null, "Alegeti o varianta de raspuns !");
  3358.             }
  3359.  
  3360.         }
  3361.  
  3362.  
  3363.         if (ev.getSource() == button25) {
  3364.             nr_click25++;
  3365.             like5.setVisible(true);
  3366.             rate5.setVisible(true);
  3367.             dlike5.setVisible(true);
  3368.             buttoniesire5.setBackground(Color.GREEN);
  3369.             if (corect5 == 1) {
  3370.                 if (nr_click25 == 1) {
  3371.                     button5.setBackground(Color.GREEN);
  3372.                     punctaj = punctaj + 10;
  3373.                     button25.setBackground(Color.GREEN);
  3374.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3375.                     nr_click26++;
  3376.                     nr_click27++;
  3377.                 }
  3378.             }
  3379.             if (corect5 == 2) {
  3380.                 if (nr_click25 == 1) {
  3381.                     button5.setBackground(Color.RED);
  3382.                     button26.setBackground(Color.GREEN);
  3383.                     button25.setBackground(Color.RED);
  3384.                     button5.setForeground(Color.WHITE);
  3385.                     nr_click26++;
  3386.                     nr_click27++;
  3387.                 }
  3388.             }
  3389.  
  3390.             if (corect5 == 3) {
  3391.                 if (nr_click25 == 1) {
  3392.                     button5.setBackground(Color.RED);
  3393.                     button27.setBackground(Color.GREEN);
  3394.                     button25.setBackground(Color.RED);
  3395.                     button5.setForeground(Color.WHITE);
  3396.                     nr_click26++;
  3397.                     nr_click27++;
  3398.                 }
  3399.             }
  3400.         }
  3401.  
  3402.         if (ev.getSource() == button26) {
  3403.             buttoniesire5.setBackground(Color.GREEN);
  3404.             nr_click26++;
  3405.             like5.setVisible(true);
  3406.             rate5.setVisible(true);
  3407.             dlike5.setVisible(true);
  3408.             if (corect5 == 1) {
  3409.                 if (nr_click26 == 1) {
  3410.                     button5.setForeground(Color.WHITE);
  3411.                     button5.setBackground(Color.RED);
  3412.                     button25.setBackground(Color.GREEN);
  3413.                     button26.setBackground(Color.RED);
  3414.                     nr_click25++;
  3415.                     nr_click27++;
  3416.                 }
  3417.             }
  3418.  
  3419.             if (corect5 == 2) {
  3420.                 if (nr_click26 == 1) {
  3421.                     button5.setBackground(Color.GREEN);
  3422.                     button26.setBackground(Color.GREEN);
  3423.                     punctaj = punctaj + 10;
  3424.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3425.                     nr_click25++;
  3426.                     nr_click27++;
  3427.                 }
  3428.             }
  3429.  
  3430.             if (corect5 == 3) {
  3431.                 if (nr_click26 == 1) {
  3432.                     button5.setForeground(Color.WHITE);
  3433.                     button5.setBackground(Color.RED);
  3434.                     button27.setBackground(Color.GREEN);
  3435.                     button26.setBackground(Color.RED);
  3436.                     nr_click25++;
  3437.                     nr_click27++;
  3438.                 }
  3439.             }
  3440.         }
  3441.  
  3442.         if (ev.getSource() == button27) {
  3443.             nr_click27++;
  3444.             like5.setVisible(true);
  3445.             rate5.setVisible(true);
  3446.             dlike5.setVisible(true);
  3447.             buttoniesire5.setBackground(Color.GREEN);
  3448.             if (corect5 == 1) {
  3449.                 if (nr_click27 == 1) {
  3450.                     button5.setForeground(Color.WHITE);
  3451.                     button5.setBackground(Color.RED);
  3452.                     button25.setBackground(Color.GREEN);
  3453.                     button27.setBackground(Color.RED);
  3454.                     nr_click25++;
  3455.                     nr_click26++;
  3456.                 }
  3457.             }
  3458.  
  3459.             if (corect5 == 2) {
  3460.                 if (nr_click27 == 1) {
  3461.                     button5.setForeground(Color.WHITE);
  3462.                     button5.setBackground(Color.RED);
  3463.                     button26.setBackground(Color.GREEN);
  3464.                     button27.setBackground(Color.RED);
  3465.                     nr_click25++;
  3466.                     nr_click26++;
  3467.                 }
  3468.             }
  3469.  
  3470.             if (corect5 == 3) {
  3471.                 if (nr_click27 == 1) {
  3472.                     button5.setBackground(Color.GREEN);
  3473.                     button27.setBackground(Color.GREEN);
  3474.                     punctaj = punctaj + 10;
  3475.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3476.                     nr_click25++;
  3477.                     nr_click26++;
  3478.                 }
  3479.             }
  3480.         }
  3481.  
  3482.  
  3483.         if (ev.getSource() == buttoniesire5) {
  3484.             if (nr_click25 > 0 || nr_click26 > 0 || nr_click27 > 0) {
  3485.                 add(p1);
  3486.                 remove(p6);
  3487.                 revalidate();
  3488.                 repaint();
  3489.                 sfarsit++;
  3490.             } else {
  3491.                 JOptionPane.showMessageDialog(null, "Alegeti o varianta de raspuns !");
  3492.             }
  3493.  
  3494.         }
  3495.  
  3496.  
  3497.         if (ev.getSource() == button28) {
  3498.             nr_click28++;
  3499.             like6.setVisible(true);
  3500.             rate6.setVisible(true);
  3501.             dlike6.setVisible(true);
  3502.             buttoniesire6.setBackground(Color.GREEN);
  3503.             if (corect6 == 1) {
  3504.                 if (nr_click28 == 1) {
  3505.                     button6.setBackground(Color.GREEN);
  3506.                     punctaj = punctaj + 10;
  3507.                     button28.setBackground(Color.GREEN);
  3508.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3509.                     nr_click29++;
  3510.                     nr_click30++;
  3511.                 }
  3512.             }
  3513.             if (corect6 == 2) {
  3514.                 if (nr_click28 == 1) {
  3515.                     button6.setBackground(Color.RED);
  3516.                     button29.setBackground(Color.GREEN);
  3517.                     button28.setBackground(Color.RED);
  3518.                     button6.setForeground(Color.WHITE);
  3519.                     nr_click29++;
  3520.                     nr_click30++;
  3521.                 }
  3522.             }
  3523.  
  3524.             if (corect6 == 3) {
  3525.                 if (nr_click28 == 1) {
  3526.                     button6.setBackground(Color.RED);
  3527.                     button30.setBackground(Color.GREEN);
  3528.                     button28.setBackground(Color.RED);
  3529.                     button6.setForeground(Color.WHITE);
  3530.                     nr_click29++;
  3531.                     nr_click30++;
  3532.                 }
  3533.             }
  3534.         }
  3535.  
  3536.         if (ev.getSource() == button29) {
  3537.             buttoniesire6.setBackground(Color.GREEN);
  3538.             nr_click29++;
  3539.             like6.setVisible(true);
  3540.             rate6.setVisible(true);
  3541.             dlike6.setVisible(true);
  3542.             if (corect6 == 1) {
  3543.                 if (nr_click29 == 1) {
  3544.                     button6.setForeground(Color.WHITE);
  3545.                     button6.setBackground(Color.RED);
  3546.                     button28.setBackground(Color.GREEN);
  3547.                     button29.setBackground(Color.RED);
  3548.                     nr_click28++;
  3549.                     nr_click30++;
  3550.                 }
  3551.             }
  3552.  
  3553.             if (corect6 == 2) {
  3554.                 if (nr_click29 == 1) {
  3555.                     button6.setBackground(Color.GREEN);
  3556.                     button29.setBackground(Color.GREEN);
  3557.                     punctaj = punctaj + 10;
  3558.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3559.                     nr_click28++;
  3560.                     nr_click30++;
  3561.                 }
  3562.             }
  3563.  
  3564.             if (corect6 == 3) {
  3565.                 if (nr_click29 == 1) {
  3566.                     button6.setForeground(Color.WHITE);
  3567.                     button6.setBackground(Color.RED);
  3568.                     button30.setBackground(Color.GREEN);
  3569.                     button29.setBackground(Color.RED);
  3570.                     nr_click28++;
  3571.                     nr_click30++;
  3572.                 }
  3573.             }
  3574.         }
  3575.  
  3576.         if (ev.getSource() == button30) {
  3577.             nr_click30++;
  3578.             like6.setVisible(true);
  3579.             rate6.setVisible(true);
  3580.             dlike6.setVisible(true);
  3581.             buttoniesire6.setBackground(Color.GREEN);
  3582.             if (corect6 == 1) {
  3583.                 if (nr_click30 == 1) {
  3584.                     button6.setForeground(Color.WHITE);
  3585.                     button6.setBackground(Color.RED);
  3586.                     button28.setBackground(Color.GREEN);
  3587.                     button30.setBackground(Color.RED);
  3588.                     nr_click28++;
  3589.                     nr_click29++;
  3590.                 }
  3591.             }
  3592.  
  3593.             if (corect6 == 2) {
  3594.                 if (nr_click30 == 1) {
  3595.                     button6.setForeground(Color.WHITE);
  3596.                     button6.setBackground(Color.RED);
  3597.                     button29.setBackground(Color.GREEN);
  3598.                     button30.setBackground(Color.RED);
  3599.                     nr_click28++;
  3600.                     nr_click29++;
  3601.                 }
  3602.             }
  3603.  
  3604.             if (corect6 == 3) {
  3605.                 if (nr_click30 == 1) {
  3606.                     button6.setBackground(Color.GREEN);
  3607.                     button30.setBackground(Color.GREEN);
  3608.                     punctaj = punctaj + 10;
  3609.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3610.                     nr_click28++;
  3611.                     nr_click29++;
  3612.                 }
  3613.             }
  3614.         }
  3615.  
  3616.  
  3617.         if (ev.getSource() == buttoniesire6) {
  3618.             if (nr_click28 > 0 || nr_click29 > 0 || nr_click30 > 0) {
  3619.                 add(p1);
  3620.                 remove(p7);
  3621.                 revalidate();
  3622.                 repaint();
  3623.                 sfarsit++;
  3624.             } else {
  3625.                 JOptionPane.showMessageDialog(null, "Alegeti o varianta de raspuns !");
  3626.             }
  3627.         }
  3628.  
  3629.  
  3630.         if (ev.getSource() == button31) {
  3631.             nr_click31++;
  3632.             like7.setVisible(true);
  3633.             rate7.setVisible(true);
  3634.             dlike7.setVisible(true);
  3635.             buttoniesire7.setBackground(Color.GREEN);
  3636.             if (corect7 == 1) {
  3637.                 if (nr_click31 == 1) {
  3638.                     button7.setBackground(Color.GREEN);
  3639.                     punctaj = punctaj + 10;
  3640.                     button31.setBackground(Color.GREEN);
  3641.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3642.                     nr_click32++;
  3643.                     nr_click33++;
  3644.                 }
  3645.             }
  3646.             if (corect7 == 2) {
  3647.                 if (nr_click31 == 1) {
  3648.                     button7.setBackground(Color.RED);
  3649.                     button32.setBackground(Color.GREEN);
  3650.                     button31.setBackground(Color.RED);
  3651.                     button7.setForeground(Color.WHITE);
  3652.                     nr_click32++;
  3653.                     nr_click33++;
  3654.                 }
  3655.             }
  3656.  
  3657.             if (corect7 == 3) {
  3658.                 if (nr_click31 == 1) {
  3659.                     button7.setBackground(Color.RED);
  3660.                     button33.setBackground(Color.GREEN);
  3661.                     button31.setBackground(Color.RED);
  3662.                     button7.setForeground(Color.WHITE);
  3663.                     nr_click32++;
  3664.                     nr_click33++;
  3665.                 }
  3666.             }
  3667.         }
  3668.  
  3669.         if (ev.getSource() == button32) {
  3670.             buttoniesire7.setBackground(Color.GREEN);
  3671.             nr_click32++;
  3672.             like7.setVisible(true);
  3673.             rate7.setVisible(true);
  3674.             dlike7.setVisible(true);
  3675.             if (corect7 == 1) {
  3676.                 if (nr_click32 == 1) {
  3677.                     button7.setForeground(Color.WHITE);
  3678.                     button7.setBackground(Color.RED);
  3679.                     button31.setBackground(Color.GREEN);
  3680.                     button32.setBackground(Color.RED);
  3681.                     nr_click31++;
  3682.                     nr_click33++;
  3683.                 }
  3684.             }
  3685.  
  3686.             if (corect7 == 2) {
  3687.                 if (nr_click32 == 1) {
  3688.                     button7.setBackground(Color.GREEN);
  3689.                     button32.setBackground(Color.GREEN);
  3690.                     punctaj = punctaj + 10;
  3691.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3692.                     nr_click31++;
  3693.                     nr_click33++;
  3694.                 }
  3695.             }
  3696.  
  3697.             if (corect7 == 3) {
  3698.                 if (nr_click32 == 1) {
  3699.                     button7.setForeground(Color.WHITE);
  3700.                     button7.setBackground(Color.RED);
  3701.                     button33.setBackground(Color.GREEN);
  3702.                     button32.setBackground(Color.RED);
  3703.                     nr_click31++;
  3704.                     nr_click33++;
  3705.                 }
  3706.             }
  3707.         }
  3708.  
  3709.         if (ev.getSource() == button33) {
  3710.             nr_click33++;
  3711.             like7.setVisible(true);
  3712.             rate7.setVisible(true);
  3713.             dlike7.setVisible(true);
  3714.             buttoniesire7.setBackground(Color.GREEN);
  3715.             if (corect7 == 1) {
  3716.                 if (nr_click33 == 1) {
  3717.                     button7.setForeground(Color.WHITE);
  3718.                     button7.setBackground(Color.RED);
  3719.                     button31.setBackground(Color.GREEN);
  3720.                     button33.setBackground(Color.RED);
  3721.                     nr_click31++;
  3722.                     nr_click32++;
  3723.                 }
  3724.             }
  3725.  
  3726.             if (corect7 == 2) {
  3727.                 if (nr_click33 == 1) {
  3728.                     button7.setForeground(Color.WHITE);
  3729.                     button7.setBackground(Color.RED);
  3730.                     button32.setBackground(Color.GREEN);
  3731.                     button33.setBackground(Color.RED);
  3732.                     nr_click31++;
  3733.                     nr_click32++;
  3734.                 }
  3735.             }
  3736.  
  3737.             if (corect7 == 3) {
  3738.                 if (nr_click33 == 1) {
  3739.                     button7.setBackground(Color.GREEN);
  3740.                     button33.setBackground(Color.GREEN);
  3741.                     punctaj = punctaj + 10;
  3742.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3743.                     nr_click31++;
  3744.                     nr_click32++;
  3745.                 }
  3746.             }
  3747.         }
  3748.  
  3749.         if (ev.getSource() == buttoniesire7) {
  3750.             if (nr_click31 > 0 || nr_click32 > 0 || nr_click33 > 0) {
  3751.                 add(p1);
  3752.                 remove(p8);
  3753.                 revalidate();
  3754.                 repaint();
  3755.                 sfarsit++;
  3756.             } else {
  3757.                 JOptionPane.showMessageDialog(null, "Alegeti o varianta de raspuns !");
  3758.             }
  3759.         }
  3760.  
  3761.  
  3762.         if (ev.getSource() == button34) {
  3763.             nr_click34++;
  3764.             like8.setVisible(true);
  3765.             rate8.setVisible(true);
  3766.             dlike8.setVisible(true);
  3767.             buttoniesire8.setBackground(Color.GREEN);
  3768.             if (corect8 == 1) {
  3769.                 if (nr_click34 == 1) {
  3770.                     button8.setBackground(Color.GREEN);
  3771.                     punctaj = punctaj + 10;
  3772.                     button34.setBackground(Color.GREEN);
  3773.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3774.                     nr_click35++;
  3775.                     nr_click36++;
  3776.                 }
  3777.             }
  3778.             if (corect8 == 2) {
  3779.                 if (nr_click34 == 1) {
  3780.                     button8.setBackground(Color.RED);
  3781.                     button35.setBackground(Color.GREEN);
  3782.                     button34.setBackground(Color.RED);
  3783.                     button8.setForeground(Color.WHITE);
  3784.                     nr_click35++;
  3785.                     nr_click36++;
  3786.                 }
  3787.             }
  3788.  
  3789.             if (corect8 == 3) {
  3790.                 if (nr_click34 == 1) {
  3791.                     button8.setBackground(Color.RED);
  3792.                     button36.setBackground(Color.GREEN);
  3793.                     button34.setBackground(Color.RED);
  3794.                     button8.setForeground(Color.WHITE);
  3795.                     nr_click35++;
  3796.                     nr_click36++;
  3797.                 }
  3798.             }
  3799.         }
  3800.  
  3801.         if (ev.getSource() == button35) {
  3802.             buttoniesire8.setBackground(Color.GREEN);
  3803.             nr_click35++;
  3804.             like8.setVisible(true);
  3805.             rate8.setVisible(true);
  3806.             dlike8.setVisible(true);
  3807.             if (corect8 == 1) {
  3808.                 if (nr_click35 == 1) {
  3809.                     button8.setForeground(Color.WHITE);
  3810.                     button8.setBackground(Color.RED);
  3811.                     button34.setBackground(Color.GREEN);
  3812.                     button35.setBackground(Color.RED);
  3813.                     nr_click34++;
  3814.                     nr_click36++;
  3815.                 }
  3816.             }
  3817.  
  3818.             if (corect8 == 2) {
  3819.                 if (nr_click35 == 1) {
  3820.                     button8.setBackground(Color.GREEN);
  3821.                     button35.setBackground(Color.GREEN);
  3822.                     punctaj = punctaj + 10;
  3823.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3824.                     nr_click34++;
  3825.                     nr_click36++;
  3826.                 }
  3827.             }
  3828.  
  3829.             if (corect8 == 3) {
  3830.                 if (nr_click35 == 1) {
  3831.                     button8.setForeground(Color.WHITE);
  3832.                     button8.setBackground(Color.RED);
  3833.                     button36.setBackground(Color.GREEN);
  3834.                     button35.setBackground(Color.RED);
  3835.                     nr_click34++;
  3836.                     nr_click36++;
  3837.                 }
  3838.             }
  3839.         }
  3840.  
  3841.         if (ev.getSource() == button36) {
  3842.             nr_click36++;
  3843.             like8.setVisible(true);
  3844.             rate8.setVisible(true);
  3845.             dlike8.setVisible(true);
  3846.             buttoniesire8.setBackground(Color.GREEN);
  3847.             if (corect8 == 1) {
  3848.                 if (nr_click36 == 1) {
  3849.                     button8.setForeground(Color.WHITE);
  3850.                     button8.setBackground(Color.RED);
  3851.                     button34.setBackground(Color.GREEN);
  3852.                     button36.setBackground(Color.RED);
  3853.                     nr_click34++;
  3854.                     nr_click35++;
  3855.                 }
  3856.             }
  3857.  
  3858.             if (corect8 == 2) {
  3859.                 if (nr_click36 == 1) {
  3860.                     button8.setForeground(Color.WHITE);
  3861.                     button8.setBackground(Color.RED);
  3862.                     button35.setBackground(Color.GREEN);
  3863.                     button36.setBackground(Color.RED);
  3864.                     nr_click34++;
  3865.                     nr_click35++;
  3866.                 }
  3867.             }
  3868.  
  3869.             if (corect8 == 3) {
  3870.                 if (nr_click36 == 1) {
  3871.                     button8.setBackground(Color.GREEN);
  3872.                     button36.setBackground(Color.GREEN);
  3873.                     punctaj = punctaj + 10;
  3874.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3875.                     nr_click34++;
  3876.                     nr_click35++;
  3877.                 }
  3878.             }
  3879.         }
  3880.  
  3881.         if (ev.getSource() == buttoniesire8) {
  3882.             if (nr_click34 > 0 || nr_click35 > 0 || nr_click36 > 0) {
  3883.                 add(p1);
  3884.                 remove(p9);
  3885.                 revalidate();
  3886.                 repaint();
  3887.                 sfarsit++;
  3888.             } else {
  3889.                 JOptionPane.showMessageDialog(null, "Alegeti o varianta de raspuns !");
  3890.             }
  3891.         }
  3892.  
  3893.         if (ev.getSource() == button37) {
  3894.             nr_click37++;
  3895.             like9.setVisible(true);
  3896.             rate9.setVisible(true);
  3897.             dlike9.setVisible(true);
  3898.             buttoniesire9.setBackground(Color.GREEN);
  3899.             if (corect9 == 1) {
  3900.                 if (nr_click37 == 1) {
  3901.                     button9.setBackground(Color.GREEN);
  3902.                     punctaj = punctaj + 10;
  3903.                     button37.setBackground(Color.GREEN);
  3904.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3905.                     nr_click38++;
  3906.                     nr_click39++;
  3907.                 }
  3908.             }
  3909.             if (corect9 == 2) {
  3910.                 if (nr_click37 == 1) {
  3911.                     button9.setBackground(Color.RED);
  3912.                     button38.setBackground(Color.GREEN);
  3913.                     button37.setBackground(Color.RED);
  3914.                     button9.setForeground(Color.WHITE);
  3915.                     nr_click38++;
  3916.                     nr_click39++;
  3917.                 }
  3918.             }
  3919.  
  3920.             if (corect9 == 3) {
  3921.                 if (nr_click37 == 1) {
  3922.                     button9.setBackground(Color.RED);
  3923.                     button39.setBackground(Color.GREEN);
  3924.                     button37.setBackground(Color.RED);
  3925.                     button9.setForeground(Color.WHITE);
  3926.                     nr_click38++;
  3927.                     nr_click39++;
  3928.                 }
  3929.             }
  3930.         }
  3931.  
  3932.         if (ev.getSource() == button38) {
  3933.             buttoniesire9.setBackground(Color.GREEN);
  3934.             nr_click38++;
  3935.             like9.setVisible(true);
  3936.             rate9.setVisible(true);
  3937.             dlike9.setVisible(true);
  3938.             if (corect9 == 1) {
  3939.                 if (nr_click38 == 1) {
  3940.                     button9.setForeground(Color.WHITE);
  3941.                     button9.setBackground(Color.RED);
  3942.                     button37.setBackground(Color.GREEN);
  3943.                     button38.setBackground(Color.RED);
  3944.                     nr_click37++;
  3945.                     nr_click39++;
  3946.                 }
  3947.             }
  3948.  
  3949.             if (corect9 == 2) {
  3950.                 if (nr_click38 == 1) {
  3951.                     button9.setBackground(Color.GREEN);
  3952.                     button38.setBackground(Color.GREEN);
  3953.                     punctaj = punctaj + 10;
  3954.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  3955.                     nr_click37++;
  3956.                     nr_click39++;
  3957.                 }
  3958.             }
  3959.  
  3960.             if (corect9 == 3) {
  3961.                 if (nr_click38 == 1) {
  3962.                     button9.setForeground(Color.WHITE);
  3963.                     button9.setBackground(Color.RED);
  3964.                     button39.setBackground(Color.GREEN);
  3965.                     button38.setBackground(Color.RED);
  3966.                     nr_click37++;
  3967.                     nr_click39++;
  3968.                 }
  3969.             }
  3970.         }
  3971.  
  3972.         if (ev.getSource() == button39) {
  3973.             nr_click39++;
  3974.             like9.setVisible(true);
  3975.             rate9.setVisible(true);
  3976.             dlike9.setVisible(true);
  3977.             buttoniesire9.setBackground(Color.GREEN);
  3978.             if (corect9 == 1) {
  3979.                 if (nr_click39 == 1) {
  3980.                     button9.setForeground(Color.WHITE);
  3981.                     button9.setBackground(Color.RED);
  3982.                     button37.setBackground(Color.GREEN);
  3983.                     button39.setBackground(Color.RED);
  3984.                     nr_click37++;
  3985.                     nr_click38++;
  3986.                 }
  3987.             }
  3988.  
  3989.             if (corect9 == 2) {
  3990.                 if (nr_click39 == 1) {
  3991.                     button9.setForeground(Color.WHITE);
  3992.                     button9.setBackground(Color.RED);
  3993.                     button38.setBackground(Color.GREEN);
  3994.                     button39.setBackground(Color.RED);
  3995.                     nr_click37++;
  3996.                     nr_click38++;
  3997.                 }
  3998.             }
  3999.  
  4000.             if (corect9 == 3) {
  4001.                 if (nr_click39 == 1) {
  4002.                     button9.setBackground(Color.GREEN);
  4003.                     button39.setBackground(Color.GREEN);
  4004.                     punctaj = punctaj + 10;
  4005.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  4006.                     nr_click37++;
  4007.                     nr_click38++;
  4008.                 }
  4009.             }
  4010.         }
  4011.  
  4012.         if (ev.getSource() == buttoniesire9) {
  4013.             if (nr_click37 > 0 || nr_click38 > 0 || nr_click39 > 0) {
  4014.                 add(p1);
  4015.                 remove(p10);
  4016.                 revalidate();
  4017.                 repaint();
  4018.                 sfarsit++;
  4019.             } else {
  4020.                 JOptionPane.showMessageDialog(null, "Alegeti o varianta de raspuns !");
  4021.             }
  4022.         }
  4023.  
  4024.  
  4025.         if (ev.getSource() == button40) {
  4026.             nr_click40++;
  4027.             like10.setVisible(true);
  4028.             rate10.setVisible(true);
  4029.             dlike10.setVisible(true);
  4030.             buttoniesire10.setBackground(Color.GREEN);
  4031.             if (corect10 == 1) {
  4032.                 if (nr_click40 == 1) {
  4033.                     button10.setBackground(Color.GREEN);
  4034.                     punctaj = punctaj + 10;
  4035.                     button40.setBackground(Color.GREEN);
  4036.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  4037.                     nr_click41++;
  4038.                     nr_click42++;
  4039.                 }
  4040.             }
  4041.             if (corect10 == 2) {
  4042.                 if (nr_click40 == 1) {
  4043.                     button10.setBackground(Color.RED);
  4044.                     button41.setBackground(Color.GREEN);
  4045.                     button40.setBackground(Color.RED);
  4046.                     button10.setForeground(Color.WHITE);
  4047.                     nr_click41++;
  4048.                     nr_click42++;
  4049.                 }
  4050.             }
  4051.  
  4052.             if (corect10 == 3) {
  4053.                 if (nr_click40 == 1) {
  4054.                     button10.setBackground(Color.RED);
  4055.                     button42.setBackground(Color.GREEN);
  4056.                     button40.setBackground(Color.RED);
  4057.                     button10.setForeground(Color.WHITE);
  4058.                     nr_click41++;
  4059.                     nr_click42++;
  4060.                 }
  4061.             }
  4062.         }
  4063.  
  4064.         if (ev.getSource() == button41) {
  4065.             buttoniesire10.setBackground(Color.GREEN);
  4066.             nr_click41++;
  4067.             like10.setVisible(true);
  4068.             rate10.setVisible(true);
  4069.             dlike10.setVisible(true);
  4070.             if (corect10 == 1) {
  4071.                 if (nr_click41 == 1) {
  4072.                     button10.setForeground(Color.WHITE);
  4073.                     button10.setBackground(Color.RED);
  4074.                     button40.setBackground(Color.GREEN);
  4075.                     button41.setBackground(Color.RED);
  4076.                     nr_click40++;
  4077.                     nr_click42++;
  4078.                 }
  4079.             }
  4080.  
  4081.             if (corect10 == 2) {
  4082.                 if (nr_click41 == 1) {
  4083.                     button10.setBackground(Color.GREEN);
  4084.                     button41.setBackground(Color.GREEN);
  4085.                     punctaj = punctaj + 10;
  4086.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  4087.                     nr_click40++;
  4088.                     nr_click42++;
  4089.                 }
  4090.             }
  4091.  
  4092.             if (corect10 == 3) {
  4093.                 if (nr_click41 == 1) {
  4094.                     button10.setForeground(Color.WHITE);
  4095.                     button10.setBackground(Color.RED);
  4096.                     button42.setBackground(Color.GREEN);
  4097.                     button41.setBackground(Color.RED);
  4098.                     nr_click40++;
  4099.                     nr_click42++;
  4100.                 }
  4101.             }
  4102.         }
  4103.  
  4104.         if (ev.getSource() == button42) {
  4105.             nr_click42++;
  4106.             like10.setVisible(true);
  4107.             rate10.setVisible(true);
  4108.             dlike10.setVisible(true);
  4109.             buttoniesire10.setBackground(Color.GREEN);
  4110.             if (corect10 == 1) {
  4111.                 if (nr_click42 == 1) {
  4112.                     button10.setForeground(Color.WHITE);
  4113.                     button10.setBackground(Color.RED);
  4114.                     button40.setBackground(Color.GREEN);
  4115.                     button42.setBackground(Color.RED);
  4116.                     nr_click40++;
  4117.                     nr_click41++;
  4118.                 }
  4119.             }
  4120.  
  4121.             if (corect10 == 2) {
  4122.                 if (nr_click42 == 1) {
  4123.                     button10.setForeground(Color.WHITE);
  4124.                     button10.setBackground(Color.RED);
  4125.                     button41.setBackground(Color.GREEN);
  4126.                     button42.setBackground(Color.RED);
  4127.                     nr_click40++;
  4128.                     nr_click41++;
  4129.                 }
  4130.             }
  4131.  
  4132.             if (corect10 == 3) {
  4133.                 if (nr_click42 == 1) {
  4134.                     button10.setBackground(Color.GREEN);
  4135.                     button42.setBackground(Color.GREEN);
  4136.                     punctaj = punctaj + 10;
  4137.                     Tabela_unica.l1.setText("Aveti " + punctaj + " puncte.");
  4138.                     nr_click40++;
  4139.                     nr_click41++;
  4140.                 }
  4141.             }
  4142.         }
  4143.  
  4144.         if (ev.getSource() == buttoniesire10) {
  4145.             if (nr_click40 > 0 || nr_click41 > 0 || nr_click42 > 0) {
  4146.                 add(p1);
  4147.                 remove(p11);
  4148.                 revalidate();
  4149.                 repaint();
  4150.                 sfarsit++;
  4151.             } else {
  4152.                 JOptionPane.showMessageDialog(null, "Alegeti o varianta de raspuns !");
  4153.             }
  4154.         }
  4155.  
  4156.  
  4157.         if (sfarsit == 10) {
  4158.             JOptionPane.showMessageDialog(null, "         Jocul s-a incheiat !");
  4159.             salvare_punctaj();
  4160.             rejucare.setVisible(true);
  4161.             ierarhie.setVisible(true);
  4162.             sfarsit++;
  4163.  
  4164.         }
  4165.  
  4166.         if (ev.getSource() == rejucare) {
  4167.             JOptionPane.showMessageDialog(null, "Rejucam !");
  4168.             dispose();
  4169.             sfarsit=0;
  4170.             punctaj=0;
  4171.             Log_In.conectare();
  4172.  
  4173.         }
  4174.  
  4175.  
  4176.         if (ev.getSource() == ierarhie) {
  4177.             Clasament_actual.createGui();
  4178.         }
  4179.  
  4180.         if (ev.getSource() == like1) {
  4181.             if(semafor_like1==false){
  4182.                 rating_plus(1);
  4183.                 semafor_like1=true;
  4184.             }
  4185.         }
  4186.  
  4187.         if (ev.getSource() == dlike1) {
  4188.             if(semafor_dlike1==false){
  4189.                 rating_minus(1);
  4190.                 semafor_dlike1=true;
  4191.             }
  4192.         }
  4193.  
  4194.  
  4195.  
  4196.         if (ev.getSource() == like2) {
  4197.             if(semafor_like2==false){
  4198.                 rating_plus(2);
  4199.                 semafor_like2=true;
  4200.             }
  4201.         }
  4202.  
  4203.         if (ev.getSource() == dlike2) {
  4204.             if(semafor_dlike2==false){
  4205.                 rating_minus(2);
  4206.                 semafor_dlike2=true;
  4207.             }
  4208.         }
  4209.  
  4210.  
  4211.  
  4212.         if (ev.getSource() == like3) {
  4213.             if(semafor_like3==false){
  4214.                 rating_plus(3);
  4215.                 semafor_like3=true;
  4216.             }
  4217.         }
  4218.  
  4219.         if (ev.getSource() == dlike3) {
  4220.             if(semafor_dlike3==false){
  4221.                 rating_minus(3);
  4222.                 semafor_dlike3=true;
  4223.             }
  4224.         }
  4225.  
  4226.  
  4227.         if (ev.getSource() == like4) {
  4228.             if(semafor_like4==false){
  4229.                 rating_plus(4);
  4230.                 semafor_like4=true;
  4231.             }
  4232.         }
  4233.  
  4234.         if (ev.getSource() == dlike4) {
  4235.             if(semafor_dlike4==false){
  4236.                 rating_minus(4);
  4237.                 semafor_dlike4=true;
  4238.             }
  4239.         }
  4240.  
  4241.  
  4242.  
  4243.         if (ev.getSource() == like5) {
  4244.             if(semafor_like5==false){
  4245.                 rating_plus(5);
  4246.                 semafor_like5=true;
  4247.             }
  4248.         }
  4249.  
  4250.         if (ev.getSource() == dlike5) {
  4251.             if(semafor_dlike5==false){
  4252.                 rating_minus(5);
  4253.                 semafor_dlike5=true;
  4254.             }
  4255.         }
  4256.  
  4257.  
  4258.         if (ev.getSource() == like6) {
  4259.             if(semafor_like6==false){
  4260.                 rating_plus(6);
  4261.                 semafor_like6=true;
  4262.             }
  4263.         }
  4264.  
  4265.         if (ev.getSource() == dlike6) {
  4266.             if(semafor_dlike6==false){
  4267.                 rating_minus(6);
  4268.                 semafor_dlike6=true;
  4269.             }
  4270.         }
  4271.  
  4272.  
  4273.         if (ev.getSource() == like7) {
  4274.             if(semafor_like7==false){
  4275.                 rating_plus(7);
  4276.                 semafor_like7=true;
  4277.             }
  4278.         }
  4279.  
  4280.         if (ev.getSource() == dlike7) {
  4281.             if(semafor_dlike7==false){
  4282.                 rating_minus(7);
  4283.                 semafor_dlike7=true;
  4284.             }
  4285.         }
  4286.  
  4287.  
  4288.         if (ev.getSource() == like8) {
  4289.             if(semafor_like8==false){
  4290.                 rating_plus(8);
  4291.                 semafor_like8=true;
  4292.             }
  4293.         }
  4294.  
  4295.         if (ev.getSource() == dlike8){
  4296.             if(semafor_dlike8==false){
  4297.                 rating_minus(8);
  4298.                 semafor_dlike8=true;
  4299.             }
  4300.         }
  4301.  
  4302.  
  4303.         if (ev.getSource() == like9) {
  4304.             if(semafor_like9==false){
  4305.                 rating_plus(9);
  4306.                 semafor_like9=true;
  4307.             }
  4308.         }
  4309.  
  4310.         if (ev.getSource() == dlike9) {
  4311.             if(semafor_dlike9==false){
  4312.                 rating_minus(9);
  4313.                 semafor_dlike9=true;
  4314.             }
  4315.         }
  4316.  
  4317.         if (ev.getSource() == like10) {
  4318.             if(semafor_like10==false){
  4319.                 rating_plus(10);
  4320.                 semafor_like10=true;
  4321.             }
  4322.         }
  4323.  
  4324.         if (ev.getSource() == dlike10) {
  4325.             if(semafor_dlike10==false){
  4326.                 rating_minus(10);
  4327.                 semafor_dlike10=true;
  4328.             }
  4329.         }
  4330.  
  4331.     }
  4332.  
  4333.  
  4334.     public void theQuery2(String query) {
  4335.         Connection con = null;
  4336.         Statement st = null;
  4337.         try {
  4338.             con = DriverManager.getConnection("jdbc:mysql://localhost/Aplicatie", "root", "");
  4339.             st = con.createStatement();
  4340.             st.executeUpdate(query);
  4341.         } catch (SQLException | HeadlessException ex) {
  4342.             JOptionPane.showMessageDialog(null, ex.getMessage());
  4343.         }
  4344.     }
  4345.  
  4346.     public static void salvare_punctaj(){
  4347.         int total = punctaj + punctajbd;
  4348.         salvare_punctaj=true;
  4349.         try {
  4350.             theQuery("update Utilizatori  set punctaj= '" + total + "' where id='" + id + "'");
  4351.  
  4352.         } catch (Exception ex) {
  4353.         }
  4354.     }
  4355.  
  4356.  
  4357.     public void setCountDownLabelTime(String text) {
  4358.         ltimp.setText(text);
  4359.     }
  4360.  
  4361.  
  4362.     public static void main(String[] args) {
  4363.         new Tabela_unica();
  4364.     }
  4365. }
  4366.  
  4367.  
  4368.  
  4369. class Timer_tabela {
  4370.     private static final int TIMER_PERIOD = 1000;
  4371.     protected static final int secunde = 59;
  4372.     protected static int minute = 9;
  4373.     private Tabela_unica tabela_unica; // holds a reference to the Welcome class
  4374.     private int count;
  4375.  
  4376.     public Timer_tabela(Tabela_unica tabela_unica) {
  4377.         this.tabela_unica = tabela_unica; // initializes the reference to the Welcome class.
  4378.         String text = "Timp ramas: "+minute +":"+ (secunde - count) ;
  4379.         tabela_unica.setCountDownLabelTime(text);
  4380.     }
  4381.  
  4382.     public void start() {
  4383.         new javax.swing.Timer(TIMER_PERIOD, new ActionListener() {
  4384.             @Override
  4385.             public void actionPerformed(ActionEvent e) {
  4386.                 if ( Tabela_unica.sfarsit==10) {
  4387.                     ((javax.swing.Timer) e.getSource()).stop();
  4388.                     JOptionPane.showMessageDialog(null, "S-a oprit !");
  4389.                     minute=9;
  4390.                 } else if (count < secunde && count<=48 && Tabela_unica.sfarsit<10) {
  4391.                     count++;
  4392.                     String text ="Timp ramas: " + minute+":"+(secunde - count) ;
  4393.                     tabela_unica.setCountDownLabelTime(text); // uses the reference to Welcome
  4394.                 } else if (count < secunde && count>48 && Tabela_unica.sfarsit<10) {
  4395.                     count++;
  4396.                     String text ="Timp ramas: " + minute+":0"+(secunde - count) ;
  4397.                     tabela_unica.setCountDownLabelTime(text); // uses the reference to Welcome
  4398.                 } else if(count==secunde && minute>0 && Tabela_unica.sfarsit<10){
  4399.                     count=-1;
  4400.                     count++;
  4401.                     minute--;
  4402.                     String text ="Timp ramas: " +minute+":"+ (secunde - count) ;
  4403.                     tabela_unica.setCountDownLabelTime(text); // uses the reference to Welcome
  4404.                 } else if(minute==0 && count==secunde){
  4405.                     ((javax.swing.Timer) e.getSource()).stop();
  4406.                     JOptionPane.showMessageDialog(null, "Salut");
  4407.                     Tabela_unica.salvare_punctaj();
  4408.                     System.exit(0);
  4409.  
  4410.                 }
  4411.             }
  4412.         }).start();
  4413.     }
  4414. }
  4415.  
  4416. class ImagePanel2 extends JPanel {
  4417.  
  4418.     private Image img1;
  4419.  
  4420.     public ImagePanel2(String img1) {
  4421.         this(new ImageIcon(img1).getImage());
  4422.     }
  4423.  
  4424.     public ImagePanel2(Image img1) {
  4425.         this.img1 = img1;
  4426.  
  4427.     }
  4428.  
  4429.     public void paintComponent(Graphics g) {
  4430.         g.drawImage(img1, 0, 0, null);
  4431.     }
  4432.  
  4433. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement