1. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Only if the connection is open (not closed).
    What happens when the calls to connection.close() are removed?

    Can you describe what happens when the new version of the code is executed?
    Descrbe all the steps the user does and what the program does.
    What does the program do first?
    What does the user do? What does he type in and what button does he press.
    What does the program do now? What method(s) is/are called?
    What do each of the methods do as they are executed? What values are retrieved from the textfields? What values are read from the data base?
    Are the if statements true or false?
    What does the code do when they are true?
    What does the code do when they are false?



    NOTE: The posted code does not compile without many errors:


    This is too much code to work with. Where is the smaller code: NewMain.java???
    Here is the FrameBaru.java:

    Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package programtesisbaru;
    
    import java.awt.Container;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JTextField;
    
    /**
     *
     * @author Tawi
     */
    class FrameBaru extends JFrame {
         JLabel labelPerhitunganKriteria = new JLabel("Perhitungan Kriteria");  
         JLabel tampilKriteria = new JLabel("");  
         JLabel tampilKriteria1 = new JLabel("");  
         JButton ubah = new JButton("Ubah Paduk Data");  
         JButton kembali = new JButton("Kembali ke Menu Utama");  
         JButton lanjutlah = new JButton("Lanjut");  
         JButton lanjutlah1 = new JButton("Lanjut");  
         JButton perhitunganKriteria = new JButton("Perhitungan Kriteria");  
         JButton perhitunganKriteria1 = new JButton("Perhitungan Kriteria");  
         JButton kmbl = new JButton("");  
         JButton kmbl1 = new JButton("");  
         JButton update = new JButton("Update Paduk Data");  
         JButton update1 = new JButton("Update Paduk Data");  
         JLabel myocardInfarc = new JLabel("Myocardial Infarction");  
         JLabel stroke1 = new JLabel("Stroke");  
         JTextField[][] jawabKriteria1 = new JTextField[16][2];  
         JTextField[][] jawabAlternatif1 = new JTextField[25][2];  
         JLabel[][] labelLuarKriteria = new JLabel[4][2];  
         JLabel[][] labelLuarAlternatif = new JLabel[5][2];  
         JLabel[][] labelLuarAlternatif1 = new JLabel[5][2];  
        String[][] lblKriteria = new String[4][2];  
        String[][] lblAlternatif = new String[5][2];  
        JLabel labelLuarKriteria1[][] = new JLabel[4][2];  
        int xyz = 0;  
        int xyz1 = 0;  
        JButton kriteriaLanjut = new JButton("");  
        JButton kriteriaLanjut1 = new JButton("");  
        String[][] variabelTampung = new String[100][2];  
     public  FrameBaru() {  
            setTitle("Penghitungan dengan Analytic Hierarchical Process");  
            setSize(1024,768);  
            setVisible(true);  
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            setLocationRelativeTo(null);  
      
    Container isi = getContentPane();  
    isi.setLayout(null);  
    for (int ijk = 0; ijk < labelLuarKriteria.length; ijk++) {    
        for (int ikj = 0; ikj < labelLuarKriteria[ijk].length; ikj++) {    
            labelLuarKriteria[ijk][ikj] = new JLabel();    
        }    
    }  
    for (int ijbak = 0; ijbak < labelLuarAlternatif.length; ijbak++) {    
        for (int ikbaj = 0; ikbaj < labelLuarAlternatif[ijbak].length; ikbaj++) {    
            labelLuarAlternatif[ijbak][ikbaj] = new JLabel();    
        }    
    }  
    for (int ijbaki = 0; ijbaki < labelLuarAlternatif1.length; ijbaki++) {    
        for (int ikbaji = 0; ikbaji < labelLuarAlternatif1[ijbaki].length; ikbaji++) {    
            labelLuarAlternatif1[ijbaki][ikbaji] = new JLabel();    
        }    
    }  
    for (int ijak = 0; ijak < labelLuarKriteria1.length; ijak++) {    
        for (int ikaj = 0; ikaj < labelLuarKriteria1[ijak].length; ikaj++) {    
            labelLuarKriteria1[ijak][ikaj] = new JLabel();    
        }    
    }  
    for (int ijka = 0; ijka < lblKriteria.length; ijka++) {    
        for (int ikja = 0; ikja < lblKriteria[ijka].length; ikja++) {    
            lblKriteria[ijka][ikja] = new String();    
        }    
    }  
    for (int ijkab = 0; ijkab < lblAlternatif.length; ijkab++) {    
        for (int ikjab = 0; ikjab < lblAlternatif[ijkab].length; ikjab++) {    
            lblAlternatif[ijkab][ikjab] = new String();    
        }    
    }  
    for (int ijkabl = 0; ijkabl < lblAlternatif.length; ijkabl++) {    
        for (int ikjabl = 0; ikjabl < lblAlternatif[ijkabl].length; ikjabl++) {    
            lblAlternatif[ijkabl][ikjabl] = new String();    
        }    
    }  
    for (int kijk = 0; kijk < jawabKriteria1.length; kijk++) {    
        for (int kikj = 0; kikj < jawabKriteria1[kijk].length; kikj++) {    
            jawabKriteria1[kijk][kikj] = new JTextField();    
        }    
    }  
    for (int kabijk = 0; kabijk < jawabAlternatif1.length; kabijk++) {    
        for (int kabikj = 0; kabikj < jawabAlternatif1[kabijk].length; kabikj++) {    
            jawabAlternatif1[kabijk][kabikj] = new JTextField();    
        }    
    }  
    tampilKriteria.setText(lblKriteria[0][0]);  
    tampilKriteria1.setText(lblKriteria[0][0]);  
    for (int olp = 0; olp <4; olp++)  
    {  
        labelLuarKriteria[olp][0].setText(lblKriteria[olp][0]);  
        labelLuarKriteria1[olp][0].setText(lblKriteria[olp][0]);  
    }  
    for (int olt = 0; olt < 4; olt++)  
    {  
        labelLuarKriteria[olt][1].setText(lblKriteria[olt][1]);  
        labelLuarKriteria1[olt][1].setText(lblKriteria[olt][1]);  
    }  
    for (int olta = 0; olta < 5; olta++)  
    {  
        labelLuarAlternatif[olta][1].setText(lblAlternatif[olta][1]);  
        labelLuarAlternatif1[olta][1].setText(lblAlternatif[olta][1]);  
    }  
    for (int oltab = 0; oltab < 5; oltab++)  
    {  
        labelLuarAlternatif[oltab][0].setText(lblAlternatif[oltab][0]);  
        labelLuarAlternatif1[oltab][0].setText(lblAlternatif[oltab][0]);  
    }  
    myocardInfarc.setBounds(0,0,200,25);  
    labelPerhitunganKriteria.setBounds(0, 50, 200,25);  
    labelLuarKriteria[0][0].setBounds(0,150,100,25);  
    labelLuarKriteria[1][0].setBounds(0,180,100,25);  
    labelLuarKriteria[2][0].setBounds(0,210,100,25);  
    labelLuarKriteria[3][0].setBounds(0,240,100,25);  
    labelLuarKriteria1[0][0].setBounds(101,100,100,25);  
    labelLuarKriteria1[1][0].setBounds(202,100,100,25);  
    labelLuarKriteria1[2][0].setBounds(303,100,100,25);  
    labelLuarKriteria1[3][0].setBounds(404,100,100,25);  
    jawabKriteria1[0][0].setBounds(101,150,100,25);  
    jawabKriteria1[1][0].setBounds(101,180,100,25);  
    jawabKriteria1[2][0].setBounds(101,210,100,25);  
    jawabKriteria1[3][0].setBounds(101,240,100,25);  
    jawabKriteria1[4][0].setBounds(202,150,100,25);  
    jawabKriteria1[5][0].setBounds(202,180,100,25);  
    jawabKriteria1[6][0].setBounds(202,210,100,25);  
    jawabKriteria1[7][0].setBounds(202,240,100,25);  
    jawabKriteria1[8][0].setBounds(303,150,100,25);  
    jawabKriteria1[9][0].setBounds(303,180,100,25);  
    jawabKriteria1[10][0].setBounds(303,210,100,25);  
    jawabKriteria1[11][0].setBounds(303,240,100,25);  
    jawabKriteria1[12][0].setBounds(404,150,100,25);  
    jawabKriteria1[13][0].setBounds(404,180,100,25);  
    jawabKriteria1[14][0].setBounds(404,210,100,25);  
    jawabKriteria1[15][0].setBounds(404,240,100,25);  
    labelLuarAlternatif[0][0].setBounds(405,150,100,25);  
    labelLuarAlternatif[1][0].setBounds(405,180,100,25);  
    labelLuarAlternatif[2][0].setBounds(405,210,100,25);  
    labelLuarAlternatif[3][0].setBounds(405,240,100,25);  
    labelLuarAlternatif[4][0].setBounds(405,270,100,25);  
    labelLuarAlternatif1[0][0].setBounds(506,100,100,25);  
    labelLuarAlternatif1[1][0].setBounds(607,100,100,25);  
    labelLuarAlternatif1[2][0].setBounds(708,100,100,25);  
    labelLuarAlternatif1[3][0].setBounds(809,100,100,25);  
    labelLuarAlternatif1[4][0].setBounds(910,100,100,25);  
    lanjutlah.setBounds(403,270,100,25);  
    isi.add(lanjutlah);  
    jawabAlternatif1[0][0].setBounds(506,150,100,25);  
    jawabAlternatif1[1][0].setBounds(506,180,100,25);  
    jawabAlternatif1[2][0].setBounds(506,210,100,25);  
    jawabAlternatif1[3][0].setBounds(506,240,100,25);  
    jawabAlternatif1[4][0].setBounds(506,270,100,25);  
    jawabAlternatif1[5][0].setBounds(607,150,100,25);  
    jawabAlternatif1[6][0].setBounds(607,180,100,25);  
    jawabAlternatif1[7][0].setBounds(607,210,100,25);  
    jawabAlternatif1[8][0].setBounds(607,240,100,25);  
    jawabAlternatif1[9][0].setBounds(607,270,100,25);  
    jawabAlternatif1[10][0].setBounds(708,150,100,25);  
    jawabAlternatif1[11][0].setBounds(708,180,100,25);  
    jawabAlternatif1[12][0].setBounds(708,210,100,25);  
    jawabAlternatif1[13][0].setBounds(708,240,100,25);  
    jawabAlternatif1[14][0].setBounds(708,270,100,25);  
    jawabAlternatif1[15][0].setBounds(809,150,100,25);  
    jawabAlternatif1[16][0].setBounds(809,180,100,25);  
    jawabAlternatif1[17][0].setBounds(809,210,100,25);  
    jawabAlternatif1[18][0].setBounds(809,240,100,25);  
    jawabAlternatif1[19][0].setBounds(809,270,100,25);  
    jawabAlternatif1[20][0].setBounds(910,150,100,25);  
    jawabAlternatif1[21][0].setBounds(910,180,100,25);  
    jawabAlternatif1[22][0].setBounds(910,210,100,25);  
    jawabAlternatif1[23][0].setBounds(910,240,100,25);  
    jawabAlternatif1[24][0].setBounds(910,270,100,25);  
    perhitunganKriteria.setBounds(506,330,200,25);  
    update.setBounds(809,330,200,25);  
    tampilKriteria.setBounds(708,330,100,25);  
    tampilKriteria1.setBounds(708,630,100,25);  
    update.setVisible(false);  
    update1.setVisible(false);  
    tampilKriteria.setVisible(false);  
    tampilKriteria1.setVisible(false);  
    update1.setBounds(809,630,200,25);  
    kmbl.setBounds(506,300,251,25);  
    kmbl1.setBounds(506,600,251,25);  
    kriteriaLanjut.setBounds(758,300,251,25);  
    kriteriaLanjut1.setBounds(758,600,251,25);  
    kriteriaLanjut.setVisible(false);  
    kriteriaLanjut1.setVisible(false);  
    isi.add(kmbl);  
    isi.add(kmbl1);  
    isi.add(kriteriaLanjut);  
    isi.add(kriteriaLanjut1);  
    isi.add(update);  
    isi.add(update1);  
    isi.add(tampilKriteria);  
    isi.add(tampilKriteria1);  
    kmbl.setVisible(false);  
    kmbl1.setVisible(false);  
    perhitunganKriteria1.setBounds(506,630,200,25);  
    isi.add(perhitunganKriteria);  
    perhitunganKriteria.setVisible(false);  
    isi.add(perhitunganKriteria1);  
    perhitunganKriteria1.setVisible(false);  
    for (int mnjk = 0; mnjk < 25; mnjk++)  
    {  
        isi.add(jawabAlternatif1[mnjk][0]);  
        jawabAlternatif1[mnjk][0].setVisible(false);  
        isi.add(jawabAlternatif1[mnjk][1]);  
        jawabAlternatif1[mnjk][1].setVisible(false);  
    }  
    isi.add(myocardInfarc);  
    for (int yul = 0; yul < 4; yul++)  
    {  
        isi.add(labelLuarKriteria[yul][0]);  
        isi.add(labelLuarKriteria1[yul][0]);  
    }  
    for (int yulp = 0; yulp < 5; yulp++)  
    {  
        isi.add(labelLuarAlternatif[yulp][0]);  
        isi.add(labelLuarAlternatif1[yulp][0]);  
        isi.add(labelLuarAlternatif[yulp][1]);  
        isi.add(labelLuarAlternatif1[yulp][1]);  
        labelLuarAlternatif[yulp][0].setVisible(false);  
        labelLuarAlternatif1[yulp][0].setVisible(false);  
        labelLuarAlternatif[yulp][1].setVisible(false);  
        labelLuarAlternatif1[yulp][1].setVisible(false);  
    }  
    for (int s = 0; s < 16; s++)  
    {  
        isi.add(jawabKriteria1[s][0]);  
    }  
    isi.add(labelPerhitunganKriteria);  
    stroke1.setBounds(0,360,200,25);  
    labelLuarKriteria[0][1].setBounds(0,450,100,25);  
    labelLuarKriteria[1][1].setBounds(0,480,100,25);  
    labelLuarKriteria[2][1].setBounds(0,510,100,25);  
    labelLuarKriteria[3][1].setBounds(0,540,100,25);  
    labelLuarKriteria1[0][1].setBounds(101,400,100,25);  
    labelLuarKriteria1[1][1].setBounds(202,400,100,25);  
    labelLuarKriteria1[2][1].setBounds(303,400,100,25);  
    labelLuarKriteria1[3][1].setBounds(404,400,100,25);  
    jawabKriteria1[0][1].setBounds(101,450,100,25);  
    jawabKriteria1[1][1].setBounds(101,480,100,25);  
    jawabKriteria1[2][1].setBounds(101,510,100,25);  
    jawabKriteria1[3][1].setBounds(101,540,100,25);  
    jawabKriteria1[4][1].setBounds(202,450,100,25);  
    jawabKriteria1[5][1].setBounds(202,480,100,25);  
    jawabKriteria1[6][1].setBounds(202,510,100,25);  
    jawabKriteria1[7][1].setBounds(202,540,100,25);  
    jawabKriteria1[8][1].setBounds(303,450,100,25);  
    jawabKriteria1[9][1].setBounds(303,480,100,25);  
    jawabKriteria1[10][1].setBounds(303,510,100,25);  
    jawabKriteria1[11][1].setBounds(303,540,100,25);  
    jawabKriteria1[12][1].setBounds(404,450,100,25);  
    jawabKriteria1[13][1].setBounds(404,480,100,25);  
    jawabKriteria1[14][1].setBounds(404,510,100,25);  
    jawabKriteria1[15][1].setBounds(404,540,100,25);  
    labelLuarAlternatif[0][1].setBounds(405,450,100,25);  
    labelLuarAlternatif[1][1].setBounds(405,480,100,25);  
    labelLuarAlternatif[2][1].setBounds(405,510,100,25);  
    labelLuarAlternatif[3][1].setBounds(405,540,100,25);  
    labelLuarAlternatif[4][1].setBounds(405,570,100,25);  
    labelLuarAlternatif1[0][1].setBounds(506,400,100,25);  
    labelLuarAlternatif1[1][1].setBounds(607,400,100,25);  
    labelLuarAlternatif1[2][1].setBounds(708,400,100,25);  
    labelLuarAlternatif1[3][1].setBounds(809,400,100,25);  
    labelLuarAlternatif1[4][1].setBounds(910,400,100,25);  
    jawabAlternatif1[0][1].setBounds(506,450,100,25);  
    jawabAlternatif1[1][1].setBounds(506,480,100,25);  
    jawabAlternatif1[2][1].setBounds(506,510,100,25);  
    jawabAlternatif1[3][1].setBounds(506,540,100,25);  
    jawabAlternatif1[4][1].setBounds(506,570,100,25);  
    jawabAlternatif1[5][1].setBounds(607,450,100,25);  
    jawabAlternatif1[6][1].setBounds(607,480,100,25);  
    jawabAlternatif1[7][1].setBounds(607,510,100,25);  
    jawabAlternatif1[8][1].setBounds(607,540,100,25);  
    jawabAlternatif1[9][1].setBounds(607,570,100,25);  
    jawabAlternatif1[10][1].setBounds(708,450,100,25);  
    jawabAlternatif1[11][1].setBounds(708,480,100,25);  
    jawabAlternatif1[12][1].setBounds(708,510,100,25);  
    jawabAlternatif1[13][1].setBounds(708,540,100,25);  
    jawabAlternatif1[14][1].setBounds(708,570,100,25);  
    jawabAlternatif1[15][1].setBounds(809,450,100,25);  
    jawabAlternatif1[16][1].setBounds(809,480,100,25);  
    jawabAlternatif1[17][1].setBounds(809,510,100,25);  
    jawabAlternatif1[18][1].setBounds(809,540,100,25);  
    jawabAlternatif1[19][1].setBounds(809,570,100,25);  
    jawabAlternatif1[20][1].setBounds(910,450,100,25);  
    jawabAlternatif1[21][1].setBounds(910,480,100,25);  
    jawabAlternatif1[22][1].setBounds(910,510,100,25);  
    jawabAlternatif1[23][1].setBounds(910,540,100,25);  
    jawabAlternatif1[24][1].setBounds(910,570,100,25);  
    lanjutlah1.setBounds(404,570,100,25);  
    kembali.setBounds(0,700,200,25);  
    isi.add(lanjutlah1);  
    isi.add(kembali);  
    lanjutlah.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    for (int hulap = 0; hulap < 16; hulap++)  
                    {  
                        jawabKriteria1[hulap][0].setVisible(false);  
                    }  
                    for (int hulapa = 0; hulapa < 4; hulapa++)  
                    {  
                        labelLuarKriteria[hulapa][0].setVisible(false);  
                        labelLuarKriteria1[hulapa][0].setVisible(false);  
                    }  
                    for (int hulapar = 0; hulapar < 5; hulapar++)  
                    {  
                        labelLuarAlternatif[hulapar][0].setVisible(true);  
                        labelLuarAlternatif1[hulapar][0].setVisible(true);  
                    }  
                    lanjutlah.setVisible(false);  
                    perhitunganKriteria.setVisible(true);  
                    tampilKriteria.setVisible(true);  
                    kriteriaLanjut.setVisible(true);  
                    update.setVisible(true);  
                    kmbl.setVisible(true);  
                    kmbl.setEnabled(false);  
                    for (int mnjka = 0; mnjka < 25; mnjka++)  
                    {  
                        jawabAlternatif1[mnjka][0].setVisible(true);  
                    }  
                }  
        });  
    lanjutlah1.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    for (int hulapl = 0; hulapl < 16; hulapl++)  
                    {  
                        jawabKriteria1[hulapl][1].setVisible(false);  
                    }  
                    for (int hulapak = 0; hulapak < 4; hulapak++)  
                    {  
                        labelLuarKriteria[hulapak][1].setVisible(false);  
                        labelLuarKriteria1[hulapak][1].setVisible(false);  
                    }  
                    for (int hulapark = 0; hulapark < 5; hulapark++)  
                    {  
                        labelLuarAlternatif[hulapark][1].setVisible(true);  
                        labelLuarAlternatif1[hulapark][1].setVisible(true);  
                    }  
                    lanjutlah1.setVisible(false);  
                    perhitunganKriteria1.setVisible(true);  
                    tampilKriteria1.setVisible(true);  
                    update1.setVisible(true);  
                    kriteriaLanjut1.setVisible(true);  
                    kmbl1.setVisible(true);  
                    kmbl1.setEnabled(false);  
                    for (int mnjkap = 0; mnjkap < 25; mnjkap++)  
                    {  
                        jawabAlternatif1[mnjkap][1].setVisible(true);  
                    }  
                }  
        });  
    kembali.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    setTitle("Program Pemilihan Obat dengan Cara Analytic Hierarchycal Process");  
                    setSize(1024,768);  
                    setVisible(true);  
                    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
                    setLocationRelativeTo(null);  
                    /*lblNama.setVisible(false); 
                    txtNama.setVisible(false); 
                    kataSandi.setVisible(false); 
                    sandiKata.setVisible(false); 
     masuk.setVisible(false); 
     keluar.setVisible(false); 
     tombolHubungkankePadukData.setVisible(false); 
     putuskanKoneksiKePadukData.setVisible(false); 
     tombolUbahPadukData.setVisible(false); 
     tombolBatal.setVisible(false); 
     lanjut.setVisible(false); 
     jcboURL.setVisible(false); 
     jcboDriver.setVisible(false); 
     statusKoneksi.setVisible(false); 
     padukData.setVisible(false); 
     myocardialInfarction.setVisible(false); 
     stroke.setVisible(false); 
     for (int hklma = 0; hklma < kriteria.length; hklma++) {   
        for (int nyola = 0; nyola < kriteria[hklma].length; nyola++) {   
            kriteria[hklma][nyola].setVisible(true);   
        }   
    } 
     for (int hklma = 0; hklma < alternatif.length; hklma++) {   
        for (int nyola = 0; nyola < alternatif[hklma].length; nyola++) {   
            alternatif[hklma][nyola].setVisible(true);   
        }   
    } 
     statusMasuk.setVisible(false);*/  
    labelPerhitunganKriteria.setVisible(false);  
         tampilKriteria.setVisible(false);  
         tampilKriteria1.setVisible(false);  
         ubah.setVisible(false);  
         kembali.setVisible(false);  
         lanjutlah.setVisible(false);  
         lanjutlah1.setVisible(false);  
         perhitunganKriteria.setVisible(false);  
         perhitunganKriteria1.setVisible(false);  
         kmbl.setVisible(false);  
         kmbl1.setVisible(false);  
         update.setVisible(false);  
         update1.setVisible(false);  
         myocardInfarc.setVisible(false);  
         stroke1.setVisible(false);  
        for (int hklma = 0; hklma < jawabKriteria1.length; hklma++) {    
        for (int nyola = 0; nyola < jawabKriteria1[hklma].length; nyola++) {    
            jawabKriteria1[hklma][nyola].setVisible(false);    
        }    
    }  
        for (int hklma = 0; hklma < jawabAlternatif1.length; hklma++) {    
        for (int nyola = 0; nyola < jawabAlternatif1[hklma].length; nyola++) {    
            jawabAlternatif1[hklma][nyola].setVisible(false);    
        }    
    }  
         for (int hklma = 0; hklma < labelLuarKriteria.length; hklma++) {    
        for (int nyola = 0; nyola < labelLuarKriteria[hklma].length; nyola++) {    
            labelLuarKriteria[hklma][nyola].setVisible(false);    
        }    
    }  
         for (int hklma = 0; hklma < labelLuarAlternatif.length; hklma++) {    
        for (int nyola = 0; nyola < labelLuarAlternatif[hklma].length; nyola++) {    
            labelLuarAlternatif[hklma][nyola].setVisible(false);    
        }    
    }  
         for (int hklma = 0; hklma < labelLuarAlternatif1.length; hklma++) {    
        for (int nyola = 0; nyola < labelLuarAlternatif1[hklma].length; nyola++) {    
            labelLuarAlternatif1[hklma][nyola].setVisible(false);    
        }    
    }  
         for (int hklm = 0; hklm < labelLuarKriteria1.length; hklm++) {    
        for (int nyol = 0; nyol < labelLuarKriteria1[hklm].length; nyol++) {    
            labelLuarKriteria1[hklm][nyol].setVisible(false);    
        }    
    }  
         kriteriaLanjut.setVisible(false);  
         kriteriaLanjut1.setVisible(false);  
                }  
        });  
    perhitunganKriteria.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    for (int hulapr = 0; hulapr < 16; hulapr++)  
                    {  
                        jawabKriteria1[hulapr][0].setVisible(true);  
                    }  
                    for (int hulapae = 0; hulapae < 4; hulapae++)  
                    {  
                        labelLuarKriteria[hulapae][0].setVisible(true);  
                        labelLuarKriteria1[hulapae][0].setVisible(true);  
                    }  
                    for (int hulapars = 0; hulapars < 5; hulapars++)  
                    {  
                        labelLuarAlternatif[hulapars][0].setVisible(false);  
                        labelLuarAlternatif1[hulapars][0].setVisible(false);  
                    }  
                    lanjutlah.setVisible(true);  
                    perhitunganKriteria.setVisible(false);  
                    update.setVisible(false);  
                    tampilKriteria.setVisible(false);  
                    kriteriaLanjut.setVisible(false);  
                    kmbl.setVisible(false);  
                    kmbl.setEnabled(true);  
                    for (int mnjkas = 0; mnjkas < 25; mnjkas++)  
                    {  
                        jawabAlternatif1[mnjkas][0].setVisible(false);  
                    }  
                }  
        });  
    perhitunganKriteria1.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    for (int hulapla = 0; hulapla < 16; hulapla++)  
                    {  
                        jawabKriteria1[hulapla][1].setVisible(true);  
                    }  
                    for (int hulapaka = 0; hulapaka < 4; hulapaka++)  
                    {  
                        labelLuarKriteria[hulapaka][1].setVisible(true);  
                        labelLuarKriteria1[hulapaka][1].setVisible(true);  
                    }  
                    for (int hulaparka = 0; hulaparka < 5; hulaparka++)  
                    {  
                        labelLuarAlternatif[hulaparka][1].setVisible(false);  
                        labelLuarAlternatif1[hulaparka][1].setVisible(false);  
                    }  
                    lanjutlah1.setVisible(true);  
                    perhitunganKriteria1.setVisible(false);  
                    update1.setVisible(false);  
                    kriteriaLanjut1.setVisible(false);  
                    tampilKriteria1.setVisible(false);  
                    kmbl1.setVisible(false);  
                    kmbl1.setEnabled(false);  
                    for (int mnjkapa = 0; mnjkapa < 25; mnjkapa++)  
                    {  
                        jawabAlternatif1[mnjkapa][1].setVisible(false);  
                    }  
                }  
        });  
    kriteriaLanjut.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    xyz = xyz++;  
                    kriteriaLanjut.setText(lblKriteria[xyz][0]);  
                    for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        variabelTampung[dlp + ((xyz-1)*25)][0] = jawabAlternatif1[dlp][0].getText();  
                    }  
                    kmbl.setText(lblKriteria[xyz-1][0]);  
                    if (xyz > 3)  
    {  
    xyz--;  
    kmbl.setText(lblKriteria[xyz-1][0]);  
    for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        variabelTampung[dlp + ((xyz)*25)][0] = jawabAlternatif1[dlp][0].getText();  
                    }  
                        JOptionPane.showMessageDialog(null, "Akhir Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE);  
                    }  
                }  
        });  
    kmbl.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    xyz--;  
                    kriteriaLanjut.setText(lblKriteria[xyz][0]);  
                    for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        jawabAlternatif1[dlp][0].setText(variabelTampung[dlp + ((xyz * 25))][0]);  
                    }  
                    kmbl.setText(lblKriteria[xyz-1][0]);  
                    if (xyz == 0)  
                    {  
                        kmbl.setText("");  
                        xyz++;  
                        for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        jawabAlternatif1[dlp][0].setText(variabelTampung[dlp + ((xyz * 25))][0]);  
                    }  
                        JOptionPane.showMessageDialog(null, "Awal Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE);  
                    }  
                }  
        });  
    kmbl1.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    xyz1--;  
                    kriteriaLanjut1.setText(lblKriteria[xyz1][1]);  
                    for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        jawabAlternatif1[dlp][1].setText(variabelTampung[dlp + ((xyz1 * 25))][1]);  
                    }  
                    kmbl.setText(lblKriteria[xyz1-1][1]);  
                    if (xyz1 == 0)  
                    {  
                        kmbl1.setText("");  
                        xyz1++;  
                        for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        jawabAlternatif1[dlp][1].setText(variabelTampung[dlp + ((xyz1 * 25))][1]);  
                    }  
                        JOptionPane.showMessageDialog(null, "Awal Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE);  
                    }  
                }  
        });  
    kriteriaLanjut1.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    xyz1 = xyz1++;  
                    kriteriaLanjut1.setText(lblKriteria[xyz1][1]);  
                    for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        variabelTampung[dlp + ((xyz1-1)*25)][1] = jawabAlternatif1[dlp][1].getText();  
                    }  
                    kmbl1.setText(lblKriteria[xyz1-1][1]);  
                    if (xyz1 > 3)  
    {  
    xyz1--;  
    kmbl1.setText(lblKriteria[xyz1-1][1]);  
    for (int dlp = 0; dlp < 25; dlp++)  
    {  
    variabelTampung[dlp + ((xyz1)*25)][1] = jawabAlternatif1[dlp][1].getText();  
    }  
    JOptionPane.showMessageDialog(null, "Akhir Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE);  
    }  
    }  
    });  
    isi.add(stroke1);  
    for (int kul = 0; kul < 4; kul++)  
    {  
    isi.add(labelLuarKriteria[kul][1]);  
    isi.add(labelLuarKriteria1[kul][1]);  
    }  
    for (int s = 0; s < 16; s++)  
    {  
    isi.add(jawabKriteria1[s][1]);  
    }  
    }  
    }
    This is because I need to merge them in to my project so please help me to do so. I have very limited time. They almost drop me out.
  2. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Only if the connection is open (not closed).
    What happens when the calls to connection.close() are removed?

    Can you describe what happens when the new version of the code is executed?
    Descrbe all the steps the user does and what the program does.
    What does the program do first?
    What does the user do? What does he type in and what button does he press.
    What does the program do now? What method(s) is/are called?
    What do each of the methods do as they are executed? What values are retrieved from the textfields? What values are read from the data base?
    Are the if statements true or false?
    What does the code do when they are true?
    What does the code do when they are false?



    NOTE: The posted code does not compile without many errors:


    This is too much code to work with. Where is the smaller code: NewMain.java???
    I told you that con = false so? That mean that the connection is open, isn't it The code will open a window similar with the window that is opened by NewMain but this time I add the action listener for each button, so? It will behave almost the same with NewMain.java. The difference is I put action listener for each code, can you help me? How to access an action listener method from another action listener?

    Here is the FrameBaru.java:

    Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package programtesisbaru;
    
    import java.awt.Container;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JTextField;
    
    /**
     *
     * @author Tawi
     */
    class FrameBaru extends JFrame {
         JLabel labelPerhitunganKriteria = new JLabel("Perhitungan Kriteria");  
         JLabel tampilKriteria = new JLabel("");  
         JLabel tampilKriteria1 = new JLabel("");  
         JButton ubah = new JButton("Ubah Paduk Data");  
         JButton kembali = new JButton("Kembali ke Menu Utama");  
         JButton lanjutlah = new JButton("Lanjut");  
         JButton lanjutlah1 = new JButton("Lanjut");  
         JButton perhitunganKriteria = new JButton("Perhitungan Kriteria");  
         JButton perhitunganKriteria1 = new JButton("Perhitungan Kriteria");  
         JButton kmbl = new JButton("");  
         JButton kmbl1 = new JButton("");  
         JButton update = new JButton("Update Paduk Data");  
         JButton update1 = new JButton("Update Paduk Data");  
         JLabel myocardInfarc = new JLabel("Myocardial Infarction");  
         JLabel stroke1 = new JLabel("Stroke");  
         JTextField[][] jawabKriteria1 = new JTextField[16][2];  
         JTextField[][] jawabAlternatif1 = new JTextField[25][2];  
         JLabel[][] labelLuarKriteria = new JLabel[4][2];  
         JLabel[][] labelLuarAlternatif = new JLabel[5][2];  
         JLabel[][] labelLuarAlternatif1 = new JLabel[5][2];  
        String[][] lblKriteria = new String[4][2];  
        String[][] lblAlternatif = new String[5][2];  
        JLabel labelLuarKriteria1[][] = new JLabel[4][2];  
        int xyz = 0;  
        int xyz1 = 0;  
        JButton kriteriaLanjut = new JButton("");  
        JButton kriteriaLanjut1 = new JButton("");  
        String[][] variabelTampung = new String[100][2];  
     public  FrameBaru() {  
            setTitle("Penghitungan dengan Analytic Hierarchical Process");  
            setSize(1024,768);  
            setVisible(true);  
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            setLocationRelativeTo(null);  
      
    Container isi = getContentPane();  
    isi.setLayout(null);  
    for (int ijk = 0; ijk < labelLuarKriteria.length; ijk++) {    
        for (int ikj = 0; ikj < labelLuarKriteria[ijk].length; ikj++) {    
            labelLuarKriteria[ijk][ikj] = new JLabel();    
        }    
    }  
    for (int ijbak = 0; ijbak < labelLuarAlternatif.length; ijbak++) {    
        for (int ikbaj = 0; ikbaj < labelLuarAlternatif[ijbak].length; ikbaj++) {    
            labelLuarAlternatif[ijbak][ikbaj] = new JLabel();    
        }    
    }  
    for (int ijbaki = 0; ijbaki < labelLuarAlternatif1.length; ijbaki++) {    
        for (int ikbaji = 0; ikbaji < labelLuarAlternatif1[ijbaki].length; ikbaji++) {    
            labelLuarAlternatif1[ijbaki][ikbaji] = new JLabel();    
        }    
    }  
    for (int ijak = 0; ijak < labelLuarKriteria1.length; ijak++) {    
        for (int ikaj = 0; ikaj < labelLuarKriteria1[ijak].length; ikaj++) {    
            labelLuarKriteria1[ijak][ikaj] = new JLabel();    
        }    
    }  
    for (int ijka = 0; ijka < lblKriteria.length; ijka++) {    
        for (int ikja = 0; ikja < lblKriteria[ijka].length; ikja++) {    
            lblKriteria[ijka][ikja] = new String();    
        }    
    }  
    for (int ijkab = 0; ijkab < lblAlternatif.length; ijkab++) {    
        for (int ikjab = 0; ikjab < lblAlternatif[ijkab].length; ikjab++) {    
            lblAlternatif[ijkab][ikjab] = new String();    
        }    
    }  
    for (int ijkabl = 0; ijkabl < lblAlternatif.length; ijkabl++) {    
        for (int ikjabl = 0; ikjabl < lblAlternatif[ijkabl].length; ikjabl++) {    
            lblAlternatif[ijkabl][ikjabl] = new String();    
        }    
    }  
    for (int kijk = 0; kijk < jawabKriteria1.length; kijk++) {    
        for (int kikj = 0; kikj < jawabKriteria1[kijk].length; kikj++) {    
            jawabKriteria1[kijk][kikj] = new JTextField();    
        }    
    }  
    for (int kabijk = 0; kabijk < jawabAlternatif1.length; kabijk++) {    
        for (int kabikj = 0; kabikj < jawabAlternatif1[kabijk].length; kabikj++) {    
            jawabAlternatif1[kabijk][kabikj] = new JTextField();    
        }    
    }  
    tampilKriteria.setText(lblKriteria[0][0]);  
    tampilKriteria1.setText(lblKriteria[0][0]);  
    for (int olp = 0; olp <4; olp++)  
    {  
        labelLuarKriteria[olp][0].setText(lblKriteria[olp][0]);  
        labelLuarKriteria1[olp][0].setText(lblKriteria[olp][0]);  
    }  
    for (int olt = 0; olt < 4; olt++)  
    {  
        labelLuarKriteria[olt][1].setText(lblKriteria[olt][1]);  
        labelLuarKriteria1[olt][1].setText(lblKriteria[olt][1]);  
    }  
    for (int olta = 0; olta < 5; olta++)  
    {  
        labelLuarAlternatif[olta][1].setText(lblAlternatif[olta][1]);  
        labelLuarAlternatif1[olta][1].setText(lblAlternatif[olta][1]);  
    }  
    for (int oltab = 0; oltab < 5; oltab++)  
    {  
        labelLuarAlternatif[oltab][0].setText(lblAlternatif[oltab][0]);  
        labelLuarAlternatif1[oltab][0].setText(lblAlternatif[oltab][0]);  
    }  
    myocardInfarc.setBounds(0,0,200,25);  
    labelPerhitunganKriteria.setBounds(0, 50, 200,25);  
    labelLuarKriteria[0][0].setBounds(0,150,100,25);  
    labelLuarKriteria[1][0].setBounds(0,180,100,25);  
    labelLuarKriteria[2][0].setBounds(0,210,100,25);  
    labelLuarKriteria[3][0].setBounds(0,240,100,25);  
    labelLuarKriteria1[0][0].setBounds(101,100,100,25);  
    labelLuarKriteria1[1][0].setBounds(202,100,100,25);  
    labelLuarKriteria1[2][0].setBounds(303,100,100,25);  
    labelLuarKriteria1[3][0].setBounds(404,100,100,25);  
    jawabKriteria1[0][0].setBounds(101,150,100,25);  
    jawabKriteria1[1][0].setBounds(101,180,100,25);  
    jawabKriteria1[2][0].setBounds(101,210,100,25);  
    jawabKriteria1[3][0].setBounds(101,240,100,25);  
    jawabKriteria1[4][0].setBounds(202,150,100,25);  
    jawabKriteria1[5][0].setBounds(202,180,100,25);  
    jawabKriteria1[6][0].setBounds(202,210,100,25);  
    jawabKriteria1[7][0].setBounds(202,240,100,25);  
    jawabKriteria1[8][0].setBounds(303,150,100,25);  
    jawabKriteria1[9][0].setBounds(303,180,100,25);  
    jawabKriteria1[10][0].setBounds(303,210,100,25);  
    jawabKriteria1[11][0].setBounds(303,240,100,25);  
    jawabKriteria1[12][0].setBounds(404,150,100,25);  
    jawabKriteria1[13][0].setBounds(404,180,100,25);  
    jawabKriteria1[14][0].setBounds(404,210,100,25);  
    jawabKriteria1[15][0].setBounds(404,240,100,25);  
    labelLuarAlternatif[0][0].setBounds(405,150,100,25);  
    labelLuarAlternatif[1][0].setBounds(405,180,100,25);  
    labelLuarAlternatif[2][0].setBounds(405,210,100,25);  
    labelLuarAlternatif[3][0].setBounds(405,240,100,25);  
    labelLuarAlternatif[4][0].setBounds(405,270,100,25);  
    labelLuarAlternatif1[0][0].setBounds(506,100,100,25);  
    labelLuarAlternatif1[1][0].setBounds(607,100,100,25);  
    labelLuarAlternatif1[2][0].setBounds(708,100,100,25);  
    labelLuarAlternatif1[3][0].setBounds(809,100,100,25);  
    labelLuarAlternatif1[4][0].setBounds(910,100,100,25);  
    lanjutlah.setBounds(403,270,100,25);  
    isi.add(lanjutlah);  
    jawabAlternatif1[0][0].setBounds(506,150,100,25);  
    jawabAlternatif1[1][0].setBounds(506,180,100,25);  
    jawabAlternatif1[2][0].setBounds(506,210,100,25);  
    jawabAlternatif1[3][0].setBounds(506,240,100,25);  
    jawabAlternatif1[4][0].setBounds(506,270,100,25);  
    jawabAlternatif1[5][0].setBounds(607,150,100,25);  
    jawabAlternatif1[6][0].setBounds(607,180,100,25);  
    jawabAlternatif1[7][0].setBounds(607,210,100,25);  
    jawabAlternatif1[8][0].setBounds(607,240,100,25);  
    jawabAlternatif1[9][0].setBounds(607,270,100,25);  
    jawabAlternatif1[10][0].setBounds(708,150,100,25);  
    jawabAlternatif1[11][0].setBounds(708,180,100,25);  
    jawabAlternatif1[12][0].setBounds(708,210,100,25);  
    jawabAlternatif1[13][0].setBounds(708,240,100,25);  
    jawabAlternatif1[14][0].setBounds(708,270,100,25);  
    jawabAlternatif1[15][0].setBounds(809,150,100,25);  
    jawabAlternatif1[16][0].setBounds(809,180,100,25);  
    jawabAlternatif1[17][0].setBounds(809,210,100,25);  
    jawabAlternatif1[18][0].setBounds(809,240,100,25);  
    jawabAlternatif1[19][0].setBounds(809,270,100,25);  
    jawabAlternatif1[20][0].setBounds(910,150,100,25);  
    jawabAlternatif1[21][0].setBounds(910,180,100,25);  
    jawabAlternatif1[22][0].setBounds(910,210,100,25);  
    jawabAlternatif1[23][0].setBounds(910,240,100,25);  
    jawabAlternatif1[24][0].setBounds(910,270,100,25);  
    perhitunganKriteria.setBounds(506,330,200,25);  
    update.setBounds(809,330,200,25);  
    tampilKriteria.setBounds(708,330,100,25);  
    tampilKriteria1.setBounds(708,630,100,25);  
    update.setVisible(false);  
    update1.setVisible(false);  
    tampilKriteria.setVisible(false);  
    tampilKriteria1.setVisible(false);  
    update1.setBounds(809,630,200,25);  
    kmbl.setBounds(506,300,251,25);  
    kmbl1.setBounds(506,600,251,25);  
    kriteriaLanjut.setBounds(758,300,251,25);  
    kriteriaLanjut1.setBounds(758,600,251,25);  
    kriteriaLanjut.setVisible(false);  
    kriteriaLanjut1.setVisible(false);  
    isi.add(kmbl);  
    isi.add(kmbl1);  
    isi.add(kriteriaLanjut);  
    isi.add(kriteriaLanjut1);  
    isi.add(update);  
    isi.add(update1);  
    isi.add(tampilKriteria);  
    isi.add(tampilKriteria1);  
    kmbl.setVisible(false);  
    kmbl1.setVisible(false);  
    perhitunganKriteria1.setBounds(506,630,200,25);  
    isi.add(perhitunganKriteria);  
    perhitunganKriteria.setVisible(false);  
    isi.add(perhitunganKriteria1);  
    perhitunganKriteria1.setVisible(false);  
    for (int mnjk = 0; mnjk < 25; mnjk++)  
    {  
        isi.add(jawabAlternatif1[mnjk][0]);  
        jawabAlternatif1[mnjk][0].setVisible(false);  
        isi.add(jawabAlternatif1[mnjk][1]);  
        jawabAlternatif1[mnjk][1].setVisible(false);  
    }  
    isi.add(myocardInfarc);  
    for (int yul = 0; yul < 4; yul++)  
    {  
        isi.add(labelLuarKriteria[yul][0]);  
        isi.add(labelLuarKriteria1[yul][0]);  
    }  
    for (int yulp = 0; yulp < 5; yulp++)  
    {  
        isi.add(labelLuarAlternatif[yulp][0]);  
        isi.add(labelLuarAlternatif1[yulp][0]);  
        isi.add(labelLuarAlternatif[yulp][1]);  
        isi.add(labelLuarAlternatif1[yulp][1]);  
        labelLuarAlternatif[yulp][0].setVisible(false);  
        labelLuarAlternatif1[yulp][0].setVisible(false);  
        labelLuarAlternatif[yulp][1].setVisible(false);  
        labelLuarAlternatif1[yulp][1].setVisible(false);  
    }  
    for (int s = 0; s < 16; s++)  
    {  
        isi.add(jawabKriteria1[s][0]);  
    }  
    isi.add(labelPerhitunganKriteria);  
    stroke1.setBounds(0,360,200,25);  
    labelLuarKriteria[0][1].setBounds(0,450,100,25);  
    labelLuarKriteria[1][1].setBounds(0,480,100,25);  
    labelLuarKriteria[2][1].setBounds(0,510,100,25);  
    labelLuarKriteria[3][1].setBounds(0,540,100,25);  
    labelLuarKriteria1[0][1].setBounds(101,400,100,25);  
    labelLuarKriteria1[1][1].setBounds(202,400,100,25);  
    labelLuarKriteria1[2][1].setBounds(303,400,100,25);  
    labelLuarKriteria1[3][1].setBounds(404,400,100,25);  
    jawabKriteria1[0][1].setBounds(101,450,100,25);  
    jawabKriteria1[1][1].setBounds(101,480,100,25);  
    jawabKriteria1[2][1].setBounds(101,510,100,25);  
    jawabKriteria1[3][1].setBounds(101,540,100,25);  
    jawabKriteria1[4][1].setBounds(202,450,100,25);  
    jawabKriteria1[5][1].setBounds(202,480,100,25);  
    jawabKriteria1[6][1].setBounds(202,510,100,25);  
    jawabKriteria1[7][1].setBounds(202,540,100,25);  
    jawabKriteria1[8][1].setBounds(303,450,100,25);  
    jawabKriteria1[9][1].setBounds(303,480,100,25);  
    jawabKriteria1[10][1].setBounds(303,510,100,25);  
    jawabKriteria1[11][1].setBounds(303,540,100,25);  
    jawabKriteria1[12][1].setBounds(404,450,100,25);  
    jawabKriteria1[13][1].setBounds(404,480,100,25);  
    jawabKriteria1[14][1].setBounds(404,510,100,25);  
    jawabKriteria1[15][1].setBounds(404,540,100,25);  
    labelLuarAlternatif[0][1].setBounds(405,450,100,25);  
    labelLuarAlternatif[1][1].setBounds(405,480,100,25);  
    labelLuarAlternatif[2][1].setBounds(405,510,100,25);  
    labelLuarAlternatif[3][1].setBounds(405,540,100,25);  
    labelLuarAlternatif[4][1].setBounds(405,570,100,25);  
    labelLuarAlternatif1[0][1].setBounds(506,400,100,25);  
    labelLuarAlternatif1[1][1].setBounds(607,400,100,25);  
    labelLuarAlternatif1[2][1].setBounds(708,400,100,25);  
    labelLuarAlternatif1[3][1].setBounds(809,400,100,25);  
    labelLuarAlternatif1[4][1].setBounds(910,400,100,25);  
    jawabAlternatif1[0][1].setBounds(506,450,100,25);  
    jawabAlternatif1[1][1].setBounds(506,480,100,25);  
    jawabAlternatif1[2][1].setBounds(506,510,100,25);  
    jawabAlternatif1[3][1].setBounds(506,540,100,25);  
    jawabAlternatif1[4][1].setBounds(506,570,100,25);  
    jawabAlternatif1[5][1].setBounds(607,450,100,25);  
    jawabAlternatif1[6][1].setBounds(607,480,100,25);  
    jawabAlternatif1[7][1].setBounds(607,510,100,25);  
    jawabAlternatif1[8][1].setBounds(607,540,100,25);  
    jawabAlternatif1[9][1].setBounds(607,570,100,25);  
    jawabAlternatif1[10][1].setBounds(708,450,100,25);  
    jawabAlternatif1[11][1].setBounds(708,480,100,25);  
    jawabAlternatif1[12][1].setBounds(708,510,100,25);  
    jawabAlternatif1[13][1].setBounds(708,540,100,25);  
    jawabAlternatif1[14][1].setBounds(708,570,100,25);  
    jawabAlternatif1[15][1].setBounds(809,450,100,25);  
    jawabAlternatif1[16][1].setBounds(809,480,100,25);  
    jawabAlternatif1[17][1].setBounds(809,510,100,25);  
    jawabAlternatif1[18][1].setBounds(809,540,100,25);  
    jawabAlternatif1[19][1].setBounds(809,570,100,25);  
    jawabAlternatif1[20][1].setBounds(910,450,100,25);  
    jawabAlternatif1[21][1].setBounds(910,480,100,25);  
    jawabAlternatif1[22][1].setBounds(910,510,100,25);  
    jawabAlternatif1[23][1].setBounds(910,540,100,25);  
    jawabAlternatif1[24][1].setBounds(910,570,100,25);  
    lanjutlah1.setBounds(404,570,100,25);  
    kembali.setBounds(0,700,200,25);  
    isi.add(lanjutlah1);  
    isi.add(kembali);  
    lanjutlah.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    for (int hulap = 0; hulap < 16; hulap++)  
                    {  
                        jawabKriteria1[hulap][0].setVisible(false);  
                    }  
                    for (int hulapa = 0; hulapa < 4; hulapa++)  
                    {  
                        labelLuarKriteria[hulapa][0].setVisible(false);  
                        labelLuarKriteria1[hulapa][0].setVisible(false);  
                    }  
                    for (int hulapar = 0; hulapar < 5; hulapar++)  
                    {  
                        labelLuarAlternatif[hulapar][0].setVisible(true);  
                        labelLuarAlternatif1[hulapar][0].setVisible(true);  
                    }  
                    lanjutlah.setVisible(false);  
                    perhitunganKriteria.setVisible(true);  
                    tampilKriteria.setVisible(true);  
                    kriteriaLanjut.setVisible(true);  
                    update.setVisible(true);  
                    kmbl.setVisible(true);  
                    kmbl.setEnabled(false);  
                    for (int mnjka = 0; mnjka < 25; mnjka++)  
                    {  
                        jawabAlternatif1[mnjka][0].setVisible(true);  
                    }  
                }  
        });  
    lanjutlah1.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    for (int hulapl = 0; hulapl < 16; hulapl++)  
                    {  
                        jawabKriteria1[hulapl][1].setVisible(false);  
                    }  
                    for (int hulapak = 0; hulapak < 4; hulapak++)  
                    {  
                        labelLuarKriteria[hulapak][1].setVisible(false);  
                        labelLuarKriteria1[hulapak][1].setVisible(false);  
                    }  
                    for (int hulapark = 0; hulapark < 5; hulapark++)  
                    {  
                        labelLuarAlternatif[hulapark][1].setVisible(true);  
                        labelLuarAlternatif1[hulapark][1].setVisible(true);  
                    }  
                    lanjutlah1.setVisible(false);  
                    perhitunganKriteria1.setVisible(true);  
                    tampilKriteria1.setVisible(true);  
                    update1.setVisible(true);  
                    kriteriaLanjut1.setVisible(true);  
                    kmbl1.setVisible(true);  
                    kmbl1.setEnabled(false);  
                    for (int mnjkap = 0; mnjkap < 25; mnjkap++)  
                    {  
                        jawabAlternatif1[mnjkap][1].setVisible(true);  
                    }  
                }  
        });  
    kembali.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    setTitle("Program Pemilihan Obat dengan Cara Analytic Hierarchycal Process");  
                    setSize(1024,768);  
                    setVisible(true);  
                    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
                    setLocationRelativeTo(null);  
                    /*lblNama.setVisible(false); 
                    txtNama.setVisible(false); 
                    kataSandi.setVisible(false); 
                    sandiKata.setVisible(false); 
     masuk.setVisible(false); 
     keluar.setVisible(false); 
     tombolHubungkankePadukData.setVisible(false); 
     putuskanKoneksiKePadukData.setVisible(false); 
     tombolUbahPadukData.setVisible(false); 
     tombolBatal.setVisible(false); 
     lanjut.setVisible(false); 
     jcboURL.setVisible(false); 
     jcboDriver.setVisible(false); 
     statusKoneksi.setVisible(false); 
     padukData.setVisible(false); 
     myocardialInfarction.setVisible(false); 
     stroke.setVisible(false); 
     for (int hklma = 0; hklma < kriteria.length; hklma++) {   
        for (int nyola = 0; nyola < kriteria[hklma].length; nyola++) {   
            kriteria[hklma][nyola].setVisible(true);   
        }   
    } 
     for (int hklma = 0; hklma < alternatif.length; hklma++) {   
        for (int nyola = 0; nyola < alternatif[hklma].length; nyola++) {   
            alternatif[hklma][nyola].setVisible(true);   
        }   
    } 
     statusMasuk.setVisible(false);*/  
    labelPerhitunganKriteria.setVisible(false);  
         tampilKriteria.setVisible(false);  
         tampilKriteria1.setVisible(false);  
         ubah.setVisible(false);  
         kembali.setVisible(false);  
         lanjutlah.setVisible(false);  
         lanjutlah1.setVisible(false);  
         perhitunganKriteria.setVisible(false);  
         perhitunganKriteria1.setVisible(false);  
         kmbl.setVisible(false);  
         kmbl1.setVisible(false);  
         update.setVisible(false);  
         update1.setVisible(false);  
         myocardInfarc.setVisible(false);  
         stroke1.setVisible(false);  
        for (int hklma = 0; hklma < jawabKriteria1.length; hklma++) {    
        for (int nyola = 0; nyola < jawabKriteria1[hklma].length; nyola++) {    
            jawabKriteria1[hklma][nyola].setVisible(false);    
        }    
    }  
        for (int hklma = 0; hklma < jawabAlternatif1.length; hklma++) {    
        for (int nyola = 0; nyola < jawabAlternatif1[hklma].length; nyola++) {    
            jawabAlternatif1[hklma][nyola].setVisible(false);    
        }    
    }  
         for (int hklma = 0; hklma < labelLuarKriteria.length; hklma++) {    
        for (int nyola = 0; nyola < labelLuarKriteria[hklma].length; nyola++) {    
            labelLuarKriteria[hklma][nyola].setVisible(false);    
        }    
    }  
         for (int hklma = 0; hklma < labelLuarAlternatif.length; hklma++) {    
        for (int nyola = 0; nyola < labelLuarAlternatif[hklma].length; nyola++) {    
            labelLuarAlternatif[hklma][nyola].setVisible(false);    
        }    
    }  
         for (int hklma = 0; hklma < labelLuarAlternatif1.length; hklma++) {    
        for (int nyola = 0; nyola < labelLuarAlternatif1[hklma].length; nyola++) {    
            labelLuarAlternatif1[hklma][nyola].setVisible(false);    
        }    
    }  
         for (int hklm = 0; hklm < labelLuarKriteria1.length; hklm++) {    
        for (int nyol = 0; nyol < labelLuarKriteria1[hklm].length; nyol++) {    
            labelLuarKriteria1[hklm][nyol].setVisible(false);    
        }    
    }  
         kriteriaLanjut.setVisible(false);  
         kriteriaLanjut1.setVisible(false);  
                }  
        });  
    perhitunganKriteria.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    for (int hulapr = 0; hulapr < 16; hulapr++)  
                    {  
                        jawabKriteria1[hulapr][0].setVisible(true);  
                    }  
                    for (int hulapae = 0; hulapae < 4; hulapae++)  
                    {  
                        labelLuarKriteria[hulapae][0].setVisible(true);  
                        labelLuarKriteria1[hulapae][0].setVisible(true);  
                    }  
                    for (int hulapars = 0; hulapars < 5; hulapars++)  
                    {  
                        labelLuarAlternatif[hulapars][0].setVisible(false);  
                        labelLuarAlternatif1[hulapars][0].setVisible(false);  
                    }  
                    lanjutlah.setVisible(true);  
                    perhitunganKriteria.setVisible(false);  
                    update.setVisible(false);  
                    tampilKriteria.setVisible(false);  
                    kriteriaLanjut.setVisible(false);  
                    kmbl.setVisible(false);  
                    kmbl.setEnabled(true);  
                    for (int mnjkas = 0; mnjkas < 25; mnjkas++)  
                    {  
                        jawabAlternatif1[mnjkas][0].setVisible(false);  
                    }  
                }  
        });  
    perhitunganKriteria1.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    for (int hulapla = 0; hulapla < 16; hulapla++)  
                    {  
                        jawabKriteria1[hulapla][1].setVisible(true);  
                    }  
                    for (int hulapaka = 0; hulapaka < 4; hulapaka++)  
                    {  
                        labelLuarKriteria[hulapaka][1].setVisible(true);  
                        labelLuarKriteria1[hulapaka][1].setVisible(true);  
                    }  
                    for (int hulaparka = 0; hulaparka < 5; hulaparka++)  
                    {  
                        labelLuarAlternatif[hulaparka][1].setVisible(false);  
                        labelLuarAlternatif1[hulaparka][1].setVisible(false);  
                    }  
                    lanjutlah1.setVisible(true);  
                    perhitunganKriteria1.setVisible(false);  
                    update1.setVisible(false);  
                    kriteriaLanjut1.setVisible(false);  
                    tampilKriteria1.setVisible(false);  
                    kmbl1.setVisible(false);  
                    kmbl1.setEnabled(false);  
                    for (int mnjkapa = 0; mnjkapa < 25; mnjkapa++)  
                    {  
                        jawabAlternatif1[mnjkapa][1].setVisible(false);  
                    }  
                }  
        });  
    kriteriaLanjut.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    xyz = xyz++;  
                    kriteriaLanjut.setText(lblKriteria[xyz][0]);  
                    for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        variabelTampung[dlp + ((xyz-1)*25)][0] = jawabAlternatif1[dlp][0].getText();  
                    }  
                    kmbl.setText(lblKriteria[xyz-1][0]);  
                    if (xyz > 3)  
    {  
    xyz--;  
    kmbl.setText(lblKriteria[xyz-1][0]);  
    for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        variabelTampung[dlp + ((xyz)*25)][0] = jawabAlternatif1[dlp][0].getText();  
                    }  
                        JOptionPane.showMessageDialog(null, "Akhir Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE);  
                    }  
                }  
        });  
    kmbl.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    xyz--;  
                    kriteriaLanjut.setText(lblKriteria[xyz][0]);  
                    for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        jawabAlternatif1[dlp][0].setText(variabelTampung[dlp + ((xyz * 25))][0]);  
                    }  
                    kmbl.setText(lblKriteria[xyz-1][0]);  
                    if (xyz == 0)  
                    {  
                        kmbl.setText("");  
                        xyz++;  
                        for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        jawabAlternatif1[dlp][0].setText(variabelTampung[dlp + ((xyz * 25))][0]);  
                    }  
                        JOptionPane.showMessageDialog(null, "Awal Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE);  
                    }  
                }  
        });  
    kmbl1.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    xyz1--;  
                    kriteriaLanjut1.setText(lblKriteria[xyz1][1]);  
                    for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        jawabAlternatif1[dlp][1].setText(variabelTampung[dlp + ((xyz1 * 25))][1]);  
                    }  
                    kmbl.setText(lblKriteria[xyz1-1][1]);  
                    if (xyz1 == 0)  
                    {  
                        kmbl1.setText("");  
                        xyz1++;  
                        for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        jawabAlternatif1[dlp][1].setText(variabelTampung[dlp + ((xyz1 * 25))][1]);  
                    }  
                        JOptionPane.showMessageDialog(null, "Awal Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE);  
                    }  
                }  
        });  
    kriteriaLanjut1.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    xyz1 = xyz1++;  
                    kriteriaLanjut1.setText(lblKriteria[xyz1][1]);  
                    for (int dlp = 0; dlp < 25; dlp++)  
                    {  
                        variabelTampung[dlp + ((xyz1-1)*25)][1] = jawabAlternatif1[dlp][1].getText();  
                    }  
                    kmbl1.setText(lblKriteria[xyz1-1][1]);  
                    if (xyz1 > 3)  
    {  
    xyz1--;  
    kmbl1.setText(lblKriteria[xyz1-1][1]);  
    for (int dlp = 0; dlp < 25; dlp++)  
    {  
    variabelTampung[dlp + ((xyz1)*25)][1] = jawabAlternatif1[dlp][1].getText();  
    }  
    JOptionPane.showMessageDialog(null, "Akhir Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE);  
    }  
    }  
    });  
    isi.add(stroke1);  
    for (int kul = 0; kul < 4; kul++)  
    {  
    isi.add(labelLuarKriteria[kul][1]);  
    isi.add(labelLuarKriteria1[kul][1]);  
    }  
    for (int s = 0; s < 16; s++)  
    {  
    isi.add(jawabKriteria1[s][1]);  
    }  
    }  
    }
    This is because I need to merge them into my project so please help me to do so. I have very limited time. They almost drop me out.
    Last edited by Tawijakarta; June 15th, 2013 at 12:35 PM.
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    That is too much code to work with. It is better to work with the small programs like NewMain.java where the problem can be isolated in a few lines of code.

    You may need to find a java programmer you can hire to write the program for you.
  4. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    That is too much code to work with. It is better to work with the small programs like NewMain.java where the problem can be isolated in a few lines of code.

    You may need to find a java programmer you can hire to write the program for you.
    I must finish this by myself, please help me. What do you suggest me to put in NewMain? If I put the action listener for each button, it will be the same with the real project, so?
    Last edited by Tawijakarta; June 15th, 2013 at 01:24 PM.
  5. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    What happens in the NewMain program when the connection.close() statements are removed?
  6. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    What happens in the NewMain program when the connection.close() statements are removed?
    the connection should stay open so?
  7. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    What happens when the close() statements are removed?
    Remove them and execute the code.
  8. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by cmontes1
    I can show you httpd.conf if you like.



    What are these?
  9. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Ok, here is another problem: the code will connect to the database although the password is wrong and the username is correct, why?

    Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package programtesisbaru;
    
    import java.sql.*;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.*;
    
    /**
     *
     * @author Tawi
     */
    public class NewMain extends JFrame {
        JLabel lblNama = new JLabel("Nama : ");
        JTextField txtNama = new JTextField();  
        JLabel kataSandi = new JLabel("Kata Sandi : ");  
        JPasswordField sandiKata = new JPasswordField();  
        JButton masuk = new JButton("Masuk");  
        JButton keluar = new JButton("Keluar"); 
        JButton tombolHubungkankePadukData = new JButton("Hubungkan ke Paduk Data");  
    JButton putuskanKoneksiKePadukData = new JButton("Putuskan Koneksi ke Paduk Data");  
    JButton tombolUbahPadukData = new JButton("Ubah Paduk Data");  
    JButton tombolBatal = new JButton("Batal");
        String namaPengguna1 = new String();  
        String passwordPengguna1 = new String(); 
        Connection connection;  
        Statement statement; 
        Statement pernyataan;
        JLabel statusMasuk = new JLabel("Belum Masuk");  
        JComboBox jcboURL = new JComboBox (new String[] {"jdbc:odbc:DatabaseKlinik"});  
        JComboBox jcboDriver = new JComboBox (new String[] {"sun.jdbc.odbc.JdbcOdbcDriver"});  
        JLabel statusKoneksi = new JLabel("Tidak ada Koneksi ke Paduk Data");  
        String ax = "Nama Dokter Belum Dimasukkan";   
        String bx = "Nama Dokter atau Kata Sandi tidak Ada";  
        String cx = "Kata Sandi Belum Dimasukkan";  
        String dx = "Nama Dokter Belum Dimasukkan";  
        String ex = "Dokter tidak Dikenal";  
        String fx = "Kata Kunci tidak Benar";  
        String gx = "Nama Dokter dan Kata Sandi tidak Benar";  
        String hx = "Nama Dokter atau Kata Sandi tidak Ada"; 
        String ix = "Kesalahan";
        String usrname = new String();
        String psswrd = new String();
        String uniRL = (String)jcboURL.getSelectedItem();  
        String driver = (String) jcboDriver.getSelectedItem(); 
        
      public NewMain() {  
    // Atur letak beberapa komponen 
    setLayout(null);
    lblNama.setBounds(0,10,100,25);  
    add(lblNama);  
    txtNama.setBounds(130,10,200,25);  
    add(txtNama);  
    kataSandi.setBounds(330,10,100,25);  
    add(kataSandi);  
    sandiKata.setBounds(410,10,200,25);  
    add(sandiKata);  
    masuk.setBounds(600,10,100,25);  
    add(masuk);  
    keluar.setBounds(700,10,100,25);  
    add(keluar);  
    tombolHubungkankePadukData.setBounds(0,50,250,25);  
    add(tombolHubungkankePadukData);  
    putuskanKoneksiKePadukData.setBounds(250,50,250,25);  
    add(putuskanKoneksiKePadukData);  
    tombolUbahPadukData.setBounds(480,50,250,25);  
    add(tombolUbahPadukData);  
    tombolBatal.setBounds(730,50,250,25);  
    add(tombolBatal);  
    statusKoneksi.setBounds(800,10,200,25);  
    add(statusKoneksi);  
    tombolHubungkankePadukData.setEnabled(false);  
    putuskanKoneksiKePadukData.setEnabled(false);  
    tombolUbahPadukData.setEnabled(false);    
    tombolBatal.setEnabled(false);   
    statusKoneksi.setVisible(true);  
    lblNama.setVisible(true);  
    txtNama.setVisible(true);  
    kataSandi.setVisible(true);  
    sandiKata.setVisible(true);  
    masuk.setVisible(true);  
    keluar.setVisible(true);  
    masuk.addActionListener(new java.awt.event.ActionListener() {  
                String loginName;  
                String loginPassword;    
                String passwrd;
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {  
                    usrname = txtNama.getText().trim();  
                    psswrd = new String(sandiKata.getPassword());
                    try {  
                        masuklah();  
                    }   
                    catch (SQLException ex) {
                        ex.printStackTrace();
                        Logger.getLogger(ProgramTesisBaru.class.getName()).log(Level.SEVERE, null, ex);  
                    }  
                }  
      
                private void masuklah() throws SQLException {  
                      if (connection == null)  
                      {  
                          masuk.setEnabled(false);  
                          entryPrg();  
                      }  
                      else {
                          entryPrg();  
                      }  
                }  
      
                public void connectToDB() {  
                    //String uniRL = (String)jcboURL.getSelectedItem();  
                    //String driver = (String) jcboDriver.getSelectedItem();  
                    //URL uniRL = (URL)jcboURL.getSelectedItem();  
                    try {  
                        Class.forName(driver);  
                        connection = DriverManager.getConnection(uniRL, usrname, psswrd);  
                        //rowSet.setURL(uniRL);  
                        statusKoneksi.setText("Terhubung ke Paduk Data"); 
                        //statement = connection.createStatement();
                    }  
                    catch (java.lang.Exception ex) { 
                        ex.printStackTrace();
                        statusKoneksi.setText("Gagal Terhubung ke Paduk Data");  
                    }  
                }  
      
                private void entryPrg() {  
                          connectToDB();
                          try {
                          /*//System.out.println("con="+connection.isClosed());*/
                          statement = connection.createStatement();
                          pernyataan = connection.createStatement();
                          loginName = "select Nama_Dokter from tblDokterAhli where Nama_Dokter = '"+usrname+"'";  
                          //System.out.println(loginName);
                          loginPassword = "select Kata_Kunci from tblDokterAhli where Kata_Kunci = '"+psswrd+"'";
                          ResultSet logName = statement.executeQuery(loginName);  
                          //System.out.println(logName);
                          ResultSet logPassword = pernyataan.executeQuery(loginPassword);
                          while (logName.next()) 
                               {  
                               namaPengguna1 = logName.getString("Nama_Dokter");  
                               }  
                          while (logPassword.next()) 
                               {  
                               passwordPengguna1 = logPassword.getString("Kata_Kunci");  
                               }  
                          if (("".equals(usrname)) && ("".equals(psswrd)))   
                                 {  
                                   tombolHubungkankePadukData.setEnabled(false);  
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   tombolUbahPadukData.setEnabled(false);  
                                   tombolBatal.setEnabled(false);  
                                   masuk.setEnabled(true);
                                   statusKoneksi.setText("Tidak Ada Koneksi ke Paduk Data");
                                   connection.close();
                                   keluar.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(false); 
                                   statement.close();
                                   pernyataan.close();
                                   JOptionPane.showMessageDialog(null, gx, ix, JOptionPane.INFORMATION_MESSAGE);  
                                 }  
                        else if ((!"".equals(usrname)) && (!"".equals(psswrd)))  
                           {  
                             if ((!"".equals(namaPengguna1)) && (!"".equals(passwordPengguna1)))   
                                {  
                                   tombolHubungkankePadukData.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(true);  
                                   tombolUbahPadukData.setEnabled(true);  
                                   tombolBatal.setEnabled(true);  
                                   masuk.setEnabled(false);
                                   statusKoneksi.setText("Terhubung ke Paduk Data");
                                   keluar.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(true);  
                                   statement.close();
                                   connection.close();
                                   pernyataan.close();
                                }  
                             else if (("".equals(namaPengguna1)) && (!"".equals(passwordPengguna1)))  
                                {  
                                   tombolHubungkankePadukData.setEnabled(false);  
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   tombolUbahPadukData.setEnabled(false);  
                                   tombolBatal.setEnabled(false);  
                                   keluar.setEnabled(true);
                                   masuk.setEnabled(true);
                                   statusKoneksi.setText("Tidak Ada Koneksi ke Paduk Data");
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   JOptionPane.showMessageDialog(null, ex, ix, JOptionPane.INFORMATION_MESSAGE);  
                                   connection.close();
                                   statement.close();
                                   pernyataan.close();
                               }  
                            else if ((!"".equals(namaPengguna1)) && ("".equals(passwordPengguna1)))  
                               {  
                                   tombolHubungkankePadukData.setEnabled(false);  
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   tombolUbahPadukData.setEnabled(false);  
                                   tombolBatal.setEnabled(false);
                                   masuk.setEnabled(true);
                                   statusKoneksi.setText("Tidak Ada Koneksi ke Paduk Data");
                                   keluar.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   JOptionPane.showMessageDialog(null, fx, ix, JOptionPane.INFORMATION_MESSAGE);  
                                   connection.close();
                                   pernyataan.close();
                               }
                             else if (("".equals(namaPengguna1)) && ("".equals(passwordPengguna1)))  
                               {  
                                   tombolHubungkankePadukData.setEnabled(false);  
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   tombolUbahPadukData.setEnabled(false);  
                                   tombolBatal.setEnabled(false);
                                   masuk.setEnabled(true);
                                   statusKoneksi.setText("Tidak Ada Koneksi ke Paduk Data");
                                   keluar.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   JOptionPane.showMessageDialog(null, gx, ix, JOptionPane.INFORMATION_MESSAGE);  
                                   connection.close();
                                   pernyataan.close();
                               }
        }  
        else if ((!"".equals(usrname)) && ("".equals(psswrd)))
        {  
              JOptionPane.showMessageDialog(null, cx, ix, JOptionPane.INFORMATION_MESSAGE);  
              tombolHubungkankePadukData.setEnabled(false);  
              putuskanKoneksiKePadukData.setEnabled(false);  
              tombolUbahPadukData.setEnabled(false);  
              tombolBatal.setEnabled(false); 
              masuk.setEnabled(true);
              statusKoneksi.setText("Tidak Ada Koneksi ke Paduk Data");
              keluar.setEnabled(true);  
              putuskanKoneksiKePadukData.setEnabled(false);  
              try {
                   connection.close();                    
                   statement.close();
                   pernyataan.close();
              }
              catch (SQLException ex) 
              {
                  ex.printStackTrace();
                  statusMasuk.setText("Gagal Masuk");
              }
        }  
        else if ((("".equals(usrname)) && (!"".equals(psswrd))))  
        {      
            tombolHubungkankePadukData.setEnabled(false);  
            putuskanKoneksiKePadukData.setEnabled(false);  
            tombolUbahPadukData.setEnabled(false);  
            tombolBatal.setEnabled(false);  
            keluar.setEnabled(true);  
            masuk.setEnabled(true);
            statusKoneksi.setText("Tidak Ada Koneksi ke Paduk Data");
            putuskanKoneksiKePadukData.setEnabled(false);  
            JOptionPane.showMessageDialog(null, dx, ix, JOptionPane.INFORMATION_MESSAGE);                          
            try 
            {
            connection.close(); 
            statement.close();
            pernyataan.close();
            }
            catch (SQLException ex) 
              {
                  ex.printStackTrace();
                  statusMasuk.setText("Gagal Masuk");
              } 
          }       
                          }  
                          catch (java.lang.Exception ex){ 
                              ex.printStackTrace();
                              statusMasuk.setText("Gagal Masuk");  
                          }
                }});
    
    keluar.addActionListener(new java.awt.event.ActionListener() {  
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {  
                    keluar();  
                }  
      
                private void keluar() {  
                    System.exit(0);  
                }  
            });  
      }
        public static void main(String[] args) {
            NewMain mainkan = new NewMain();// TODO code application logic here
            mainkan.setVisible(true);
            mainkan.setTitle("Program Pemilihan Obat dengan Cara Analytic Hierarchycal Process");
            mainkan.setSize(1024,768); 
            mainkan.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            mainkan.setLocationRelativeTo(null);
        }
    }
    Please help me but without asking me to println first ok?
  10. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    How do you create a DB that requires a userid and password for the getConnection() method to work?
    Code:
                        connection = DriverManager.getConnection(uniRL, usrname, psswrd);
    The DB I have ignores the values of the userid and password and gives a connection for any values.
  11. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    How do you create a DB that requires a userid and password for the getConnection() method to work?
    Code:
                        connection = DriverManager.getConnection(uniRL, usrname, psswrd);
    The DB I have ignores the values of the userid and password and gives a connection for any values.
    What is your email address? I will send the db to your email address as an attachment. You can examine it later ok?

    I didn't protect the db with password. I probably will protect it later because my lecture want me to use SQL database not access database. Now I want to make the code to work first before I modify the database later. I use the Microsoft Access 2003 if I make no mistake or 2007 if I make any mistakes.
    Last edited by Tawijakarta; June 16th, 2013 at 09:36 AM.
  12. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    Can you post details on how to create a DB that requires a userid and password to be able to connect to it?

    Can you attach a DB for testing to this thread?

    I've zipped and attached the DB I am using.


    I didn't protect the db with password.
    the code will connect to the database although the password is wrong
    These two statements do not agree. I'm confused about what your problem is. If the DB does not require a password, then it will allow a connection with a "WRONG" password.
    Please explain.
    Attached Files
    Last edited by NormR; June 16th, 2013 at 09:40 AM.
  13. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Can you post details on how to create a DB that requires a userid and password to be able to connect to it?

    Can you attach a testing DB to this thread?
    I can't. The forum reject the file. What is your email address? I will send the file to your email address as an attachment. I use the Microsoft Access 2007 to create it but I will convert it later to MySQL database not an Access database any longer.
  14. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    Look at the DB I attached. I had to put it in a zip file to attach it.
    For testing the DB should be small and easy to copy and use. Later the DB can be enlarged for further testing.

    I do not have the MS Access program.

    Please explain the problem with the password.
  15. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Can you post details on how to create a DB that requires a userid and password to be able to connect to it?

    Can you attach a DB for testing to this thread?

    I've zipped and attached the DB I am using.




    These two statements do not agree. I'm confused about what your problem is. If the DB does not require a password, then it will allow a connection with a "WRONG" password.
    Please explain.
    I do not protect the database but I protect the code so the user cannot access it without filling a correct Nama or username in English and Kata Sandi or password in English. You see, if you run the code, it will show you two JTextFields that you need to fill with some things in those JTextFields. If you fill in a wrong combination, the code should reject the connection. In fact, the code will connect to the database although the user fill a JTextField with a wrong password and another JTextField with correct Nama or username in English. Beside you are using the password word not Kata_Kunci. The other thing is I change the table name to tblDokterAhli not tblDokterNaraSumber any more. Allright, I posted the database that I use to test.
    Attached Files
    Last edited by Tawijakarta; June 16th, 2013 at 10:19 AM.

IMN logo majestic logo threadwatch logo seochat tools logo