1. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    348
    How to avoid it to open a new frame?
    Hard to say without seeing the code.
    Several choices:
    don't extend JFrame
    Don't use the new statement with a class that creates a new frame.

    Can you make a small simple program that compiles, executes and shows the problem?
    Don't post the large program. For testing the code should have fewer than 300 lines.
  2. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Hard to say without seeing the code.
    Several choices:
    don't extend JFrame
    Don't use the new statement with a class that creates a new frame.

    Can you make a small simple program that compiles, executes and shows the problem?
    Don't post the large program. For testing the code should have fewer than 300 lines.
    I can't stop to extend the JFrame.

    Look at this code:
    Code:
    package programtesisbaru;
    
    import javax.swing.*;
    
    /**
     *
     * @author Tawi
     */
    class BaruFrame extends JFrame {
          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 = 3;  
          JButton kriteriaLanjut = new JButton("");  
          JButton kriteriaLanjut1 = new JButton("");  
          String[][] variabelTampung = new String[100][2];  
     public  BaruFrame() {    
            setSize(1024,768);  
            setVisible(true);
            setTitle("Penghitungan Data");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            setLocationRelativeTo(null);  
      
    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);    
    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,180,100,25);  
    jawabKriteria1[1][0].setBounds(101,210,100,25);  
    jawabKriteria1[2][0].setBounds(101,240,100,25);  
    jawabKriteria1[3][0].setBounds(101,270,100,25);  
    jawabKriteria1[4][0].setBounds(202,180,100,25);  
    jawabKriteria1[5][0].setBounds(202,210,100,25);  
    jawabKriteria1[6][0].setBounds(202,240,100,25);  
    jawabKriteria1[7][0].setBounds(202,270,100,25);  
    jawabKriteria1[8][0].setBounds(303,180,100,25);  
    jawabKriteria1[9][0].setBounds(303,210,100,25);  
    jawabKriteria1[10][0].setBounds(303,240,100,25);  
    jawabKriteria1[11][0].setBounds(303,270,100,25);  
    jawabKriteria1[12][0].setBounds(404,180,100,25);  
    jawabKriteria1[13][0].setBounds(404,210,100,25);  
    jawabKriteria1[14][0].setBounds(404,240,100,25);  
    jawabKriteria1[15][0].setBounds(404,270,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,300,100,25);  
    add(lanjutlah);  
    add(stroke1);
    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);  
    perhitunganKriteria1.setBounds(506,630,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);  
    add(kmbl);  
    add(kmbl1);  
    add(kriteriaLanjut);  
    add(kriteriaLanjut1);  
    add(update);  
    add(update1);  
    add(tampilKriteria);  
    add(tampilKriteria1);  
    kmbl.setVisible(false);  
    kmbl1.setVisible(false);  
    for (int kul = 0; kul < 4; kul++) {  
    add(labelLuarKriteria[kul][1]);  
    add(labelLuarKriteria1[kul][1]); }  
    for (int s = 0; s < 16; s++) {add(jawabKriteria1[s][1]); }  
    perhitunganKriteria.setVisible(false);  
    add(perhitunganKriteria);  
    perhitunganKriteria1.setVisible(false); 
    add(perhitunganKriteria1);
    for (int mnjk = 0; mnjk < 25; mnjk++) {  
        add(jawabAlternatif1[mnjk][0]);  
        jawabAlternatif1[mnjk][0].setVisible(false);  
        add(jawabAlternatif1[mnjk][1]);  
        jawabAlternatif1[mnjk][1].setVisible(false); }  
    add(myocardInfarc);  
    for (int yul = 0; yul < 4; yul++) { 
        add(labelLuarKriteria[yul][0]);  
        add(labelLuarKriteria1[yul][0]); }  
    for (int yulp = 0; yulp < 5; yulp++) {  
        add(labelLuarAlternatif[yulp][0]);  
        add(labelLuarAlternatif1[yulp][0]);  
        add(labelLuarAlternatif[yulp][1]);  
        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++) {add(jawabKriteria1[s][0]);}    
    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);  
    add(lanjutlah1);  
    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);  
         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]);  
                        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) {   
                    if (xyz != 0) {
                    xyz--;  
                    kriteriaLanjut.setText(lblKriteria[xyz][0]);  
                    for (int dlp = 0; dlp < 25; dlp++) {jawabAlternatif1[dlp][0].setText(variabelTampung[dlp + ((xyz * 25))][0]); }  
                    if (xyz - 1 == 0) {
                    kmbl.setText("");}}  
                    else {  
                        kmbl.setText("");  
                        xyz++;  
                        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); }}});}}
  3. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    I got these error messages:

    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -25
    at programtesisbaru.BaruFrame$6.actionPerformed(BaruFrame.java:356)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6505)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:702)
    at java.awt.EventQueue$4.run(EventQueue.java:700)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
    BUILD SUCCESSFUL (total time: 31 seconds)
  4. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    348
    I can't stop to extend the JFrame.
    If the class extends the JFrame class, then every new instance of the class will create a new JFrame.

    I got these error messages:

    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -25
    at programtesisbaru.BaruFrame$6.actionPerformed(BaruFrame.java:356)
    At line 356 there is an index to an array with the value of -25 which is NOT a valid array index. Valid array indexes range in value from 0 to the array length-1.
    Look at line 356, find the array index variable that has the value -25 and then look at the code that assigns that variable its value to see how it became -25.

    For example
    Code:
      anArray[x-25]  //  index into an array with an expression
    will give an index of -25 when the value of x is zero.


    If the code has an expression as the index to the array, you need to see what the values of the variables in the expression are. Use a println() statement to print out the values of all the variables used in the expression so you can see where the problem is.
    Last edited by NormR; July 14th, 2013 at 11:15 AM.
  5. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    If I use your methods, I will get a long error message:
  6. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    348
    If I use your methods, I will get a long error message:
    Please explain.
  7. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    I revised the code several time so I forgot the code that I revised. Please examine this code:

    Code:
    package programtesisbaru;
    
    import javax.swing.*;
    
    /**
     *
     * @author Tawi
     */
    class BaruFrame extends JFrame {
          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 = 3;  
          JButton kriteriaLanjut = new JButton("");  
          JButton kriteriaLanjut1 = new JButton("");  
          String[][] variabelTampung = new String[100][2];  
     public  BaruFrame() {    
            setSize(1024,768);  
            setVisible(true);
            setTitle("Penghitungan Data");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            setLocationRelativeTo(null);  
      
    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);    
    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,180,100,25);  
    jawabKriteria1[1][0].setBounds(101,210,100,25);  
    jawabKriteria1[2][0].setBounds(101,240,100,25);  
    jawabKriteria1[3][0].setBounds(101,270,100,25);  
    jawabKriteria1[4][0].setBounds(202,180,100,25);  
    jawabKriteria1[5][0].setBounds(202,210,100,25);  
    jawabKriteria1[6][0].setBounds(202,240,100,25);  
    jawabKriteria1[7][0].setBounds(202,270,100,25);  
    jawabKriteria1[8][0].setBounds(303,180,100,25);  
    jawabKriteria1[9][0].setBounds(303,210,100,25);  
    jawabKriteria1[10][0].setBounds(303,240,100,25);  
    jawabKriteria1[11][0].setBounds(303,270,100,25);  
    jawabKriteria1[12][0].setBounds(404,180,100,25);  
    jawabKriteria1[13][0].setBounds(404,210,100,25);  
    jawabKriteria1[14][0].setBounds(404,240,100,25);  
    jawabKriteria1[15][0].setBounds(404,270,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,300,100,25);  
    add(lanjutlah);  
    add(stroke1);
    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);  
    perhitunganKriteria1.setBounds(506,630,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);  
    add(kmbl);  
    add(kmbl1);  
    add(kriteriaLanjut);  
    add(kriteriaLanjut1);  
    add(update);  
    add(update1);  
    add(tampilKriteria);  
    add(tampilKriteria1);  
    kmbl.setVisible(false);  
    kmbl1.setVisible(false);  
    for (int kul = 0; kul < 4; kul++) {  
    add(labelLuarKriteria[kul][1]);  
    add(labelLuarKriteria1[kul][1]); }  
    for (int s = 0; s < 16; s++) {add(jawabKriteria1[s][1]); }  
    perhitunganKriteria.setVisible(false);  
    add(perhitunganKriteria);  
    perhitunganKriteria1.setVisible(false); 
    add(perhitunganKriteria1);
    for (int mnjk = 0; mnjk < 25; mnjk++) {  
        add(jawabAlternatif1[mnjk][0]);  
        jawabAlternatif1[mnjk][0].setVisible(false);  
        add(jawabAlternatif1[mnjk][1]);  
        jawabAlternatif1[mnjk][1].setVisible(false); }  
    add(myocardInfarc);  
    for (int yul = 0; yul < 4; yul++) { 
        add(labelLuarKriteria[yul][0]);  
        add(labelLuarKriteria1[yul][0]); }  
    for (int yulp = 0; yulp < 5; yulp++) {  
        add(labelLuarAlternatif[yulp][0]);  
        add(labelLuarAlternatif1[yulp][0]);  
        add(labelLuarAlternatif[yulp][1]);  
        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++) {add(jawabKriteria1[s][0]);}    
    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);  
    add(lanjutlah1);  
    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);                
                    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]);  
                        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) {   
                    if (xyz > 0) {
                    xyz--;  
                    kriteriaLanjut.setText(lblKriteria[xyz][0]);  
                    for (int dlp = 0; dlp < 25; dlp++) {jawabAlternatif1[dlp][0].setText(variabelTampung[dlp + ((xyz * 25))][0]); }}
                    else if (xyz == 0) {
                    kmbl.setText("");}  
                    else  if (xyz < 0) {  
                        kmbl.setText("");  
                        xyz++;  
                        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); }}});}}
    Where in the code do you think is wrong?
    Last edited by Tawijakarta; July 16th, 2013 at 12:03 AM.
  8. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    These are the error messages:
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -25
    at programtesisbaru.BaruFrame$6.actionPerformed(BaruFrame.java:356)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6505)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:702)
    at java.awt.EventQueue$4.run(EventQueue.java:700)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -25
    at programtesisbaru.BaruFrame$6.actionPerformed(BaruFrame.java:356)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6505)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:702)
    at java.awt.EventQueue$4.run(EventQueue.java:700)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -25
    at programtesisbaru.BaruFrame$6.actionPerformed(BaruFrame.java:356)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6505)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:702)
    at java.awt.EventQueue$4.run(EventQueue.java:700)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -25
    at programtesisbaru.BaruFrame$6.actionPerformed(BaruFrame.java:356)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6505)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:702)
    at java.awt.EventQueue$4.run(EventQueue.java:700)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -25
    at programtesisbaru.BaruFrame$6.actionPerformed(BaruFrame.java:356)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6505)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:702)
    at java.awt.EventQueue$4.run(EventQueue.java:700)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
    BUILD SUCCESSFUL (total time: 30 seconds)
  9. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Ok, a problem is solved. I got a new problem, why don't the JLabel show user's input in jawabKriteria[][]?

    Here is the new updated code:

    Code:
    package programtesisbaru;
    
    import javax.swing.*;
    
    /**
     *
     * @author Tawi
     */
    class BaruFrame extends JFrame {
          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  BaruFrame() {    
            setSize(1024,768);  
            setVisible(true);
            setTitle("Penghitungan Data");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            setLocationRelativeTo(null);  
      
    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][1]);  
    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);    
    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,180,100,25);  
    jawabKriteria1[1][0].setBounds(101,210,100,25);  
    jawabKriteria1[2][0].setBounds(101,240,100,25);  
    jawabKriteria1[3][0].setBounds(101,270,100,25);  
    jawabKriteria1[4][0].setBounds(202,180,100,25);  
    jawabKriteria1[5][0].setBounds(202,210,100,25);  
    jawabKriteria1[6][0].setBounds(202,240,100,25);  
    jawabKriteria1[7][0].setBounds(202,270,100,25);  
    jawabKriteria1[8][0].setBounds(303,180,100,25);  
    jawabKriteria1[9][0].setBounds(303,210,100,25);  
    jawabKriteria1[10][0].setBounds(303,240,100,25);  
    jawabKriteria1[11][0].setBounds(303,270,100,25);  
    jawabKriteria1[12][0].setBounds(404,180,100,25);  
    jawabKriteria1[13][0].setBounds(404,210,100,25);  
    jawabKriteria1[14][0].setBounds(404,240,100,25);  
    jawabKriteria1[15][0].setBounds(404,270,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,300,100,25);  
    add(lanjutlah);  
    add(stroke1);
    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);  
    perhitunganKriteria1.setBounds(506,630,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);  
    add(kmbl);  
    add(kmbl1);  
    add(kriteriaLanjut);  
    add(kriteriaLanjut1);  
    add(update);  
    add(update1);  
    add(tampilKriteria);  
    add(tampilKriteria1);  
    kmbl.setVisible(false);  
    kmbl1.setVisible(false);  
    for (int kul = 0; kul < 4; kul++) {  
    add(labelLuarKriteria[kul][1]);  
    add(labelLuarKriteria1[kul][1]); }  
    for (int s = 0; s < 16; s++) {add(jawabKriteria1[s][1]); }  
    perhitunganKriteria.setVisible(false);  
    add(perhitunganKriteria);  
    perhitunganKriteria1.setVisible(false); 
    add(perhitunganKriteria1);
    for (int mnjk = 0; mnjk < 25; mnjk++) {  
        add(jawabAlternatif1[mnjk][0]);  
        jawabAlternatif1[mnjk][0].setVisible(false);  
        add(jawabAlternatif1[mnjk][1]);  
        jawabAlternatif1[mnjk][1].setVisible(false); }  
    add(myocardInfarc);  
    for (int yul = 0; yul < 4; yul++) { 
        add(labelLuarKriteria[yul][0]);  
        add(labelLuarKriteria1[yul][0]); }  
    for (int yulp = 0; yulp < 5; yulp++) {  
        add(labelLuarAlternatif[yulp][0]);  
        add(labelLuarAlternatif1[yulp][0]);  
        add(labelLuarAlternatif[yulp][1]);  
        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++) {add(jawabKriteria1[s][0]);}    
    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);  
    add(lanjutlah1);  
    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);                
                    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) {   
                    if (xyz > 3) {  
                        xyz--;  
                        kmbl.setText(lblKriteria[xyz-1][0]);
                        kriteriaLanjut.setEnabled(false);
                        JOptionPane.showMessageDialog(null, "Akhir Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE); }
                    else if ((xyz >= 0) && (xyz <= 3)) {
                        xyz = xyz++;  
                        kriteriaLanjut.setText(lblKriteria[xyz][0]);  
                        if ((xyz - 1) < 0) {kmbl.setText(""); }
                        else {
                        for (int dlp = 0; dlp < 25; dlp++) {variabelTampung[dlp + ((xyz-1)*25)][0] = jawabAlternatif1[dlp][0].getText(); }
                        kmbl.setText(lblKriteria[xyz-1][0]); 
                        kmbl.setEnabled(true);}}
                    else if (xyz < 0) {
                        JOptionPane.showMessageDialog(null, "Ada Kesalahan tidak Terduga", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE); }}});  
    kmbl.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    if (xyz > 0) {
                    xyz--;  
                    kriteriaLanjut.setText(lblKriteria[xyz][0]);  
                    for (int dlp = 0; dlp < 25; dlp++) {jawabAlternatif1[dlp][0].setText(variabelTampung[dlp + ((xyz * 25))][0]); }}
                    else if (xyz == 0) {
                    kmbl.setText("");
                    kmbl.setEnabled(false);
                    kriteriaLanjut.setEnabled(true);}  
                    else  if (xyz < 0) {  
                        kmbl.setText("");  
                        xyz++;
                        kmbl.setEnabled(false);
                        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) {   
                    if (xyz1 > 0) {
                    xyz1--;  
                    kriteriaLanjut1.setText(lblKriteria[xyz][1]);  
                    for (int dlp = 0; dlp < 25; dlp++) {jawabAlternatif1[dlp][1].setText(variabelTampung[dlp + ((xyz * 25))][1]); }}
                    else if (xyz1 == 0) {
                    kmbl1.setText("");
                    kmbl1.setEnabled(false);
                    kriteriaLanjut1.setEnabled(true);}  
                    else  if (xyz1 < 0) {  
                        kmbl1.setText("");  
                        xyz1++;
                        kmbl1.setEnabled(false);
                        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) {   
                    if (xyz1 > 3) {  
                        xyz1--;  
                        kmbl1.setText(lblKriteria[xyz-1][1]);
                        kriteriaLanjut1.setEnabled(false);
                        JOptionPane.showMessageDialog(null, "Akhir Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE); }
                    else if ((xyz1 >= 0) && (xyz1 <= 3)) {
                        xyz1 = xyz1++;  
                        kriteriaLanjut1.setText(lblKriteria[xyz][1]);  
                        if ((xyz1 - 1) < 0) {kmbl1.setText(""); }
                        else {
                        for (int dlp = 0; dlp < 25; dlp++) {variabelTampung[dlp + ((xyz-1)*25)][1] = jawabAlternatif1[dlp][1].getText(); }
                        kmbl1.setText(lblKriteria[xyz-1][1]); 
                        kmbl1.setEnabled(true);}}
                    else if (xyz1 < 0) {
                        JOptionPane.showMessageDialog(null, "Ada Kesalahan tidak Terduga", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE); }}}); }}
    Last edited by Tawijakarta; July 16th, 2013 at 02:42 AM.
  10. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    348
    The posted code is missing the end of the class. There is no main() method so that it can be executed.

    why don't the JLabel show user's input in jawabKriteria[][]?
    You need to debug the code to see what it is doing.
    Where is the user's input read?
    What variable contains the user's input?
    What does the program do with the contents of that variable?
    Where does the program "show" what the user entered?
    Last edited by NormR; July 16th, 2013 at 06:53 AM.
  11. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Well, you can see this code:

    Code:
    package programtesisbaru;
    
    /**
     *
     * @author Tawi
     */
    import java.sql.*;   
    import javax.swing.*;
    
    public class BaruProgram extends BaruFrame {
    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");
    int i;
    JLabel[] lblPerhitunganKriteria = new JLabel[2];
    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");  
    JButton lanjut = new JButton("Lanjut");  
    JComboBox jcboURL = new JComboBox (new String[] {"jdbc:odbc:DatabaseKlinik"});  
    JComboBox jcboDriver = new JComboBox (new String[] {"sun.jdbc.odbc.JdbcOdbcDriver"});  
    Connection connection;  
    Statement statement;  
    Statement pernyataan;
    JLabel statusKoneksi = new JLabel("Belum ada Koneksi ke Paduk Data");  
    JLabel padukData = new JLabel("Paduk Data Belum Diubah");  
    String namaPengguna1 = new String();  
    String passwordPengguna1 = new String();  
    JLabel myocardialInfarction = new JLabel("Myocardial Infarction");  
    JLabel stroke = new JLabel("Stroke");  
    JLabel[][] kriteria = new JLabel[4][2];  
    JLabel[][] alternatif = new JLabel[5][2];  
    JTextField[][]jawabKriteria = new JTextField [4][2];  
    JTextField[][] jawabAlternatif = new JTextField[5][2];  
    JLabel statusMasuk = new JLabel("Belum Masuk");  
    String ax = "Kata Sandi Belum Dimasukkan";  
    String bx = "Nama Dokter Belum Dimasukkan";  
    String cx = "Nama Dokter dan Kata Sandi tidak Diisi";  
    String dx = "Nama Dokter atau Kata Sandi tidak Benar"; 
    String ex = "Kesalahan";
    String fx = "Tidak Ada Koneksi ke Paduk Data";
    String usrname = new String();
    String psswrd = new String();
    String uniRL = (String)jcboURL.getSelectedItem();  
    String driver = (String) jcboDriver.getSelectedItem(); 
    public void connectToDB() { 
                    try {  
                        Class.forName(driver);  
                        connection = DriverManager.getConnection(uniRL, usrname, psswrd);  
                        statusKoneksi.setText("Terhubung ke Paduk Data"); }  
                    catch (java.lang.Exception x) { 
                        x.printStackTrace();
                        statusKoneksi.setText("Gagal Terhubung ke Paduk Data"); }}
    public BaruProgram() {
    setLayout(null);
    for (int itlo = 0; itlo < 2; itlo++) {lblPerhitunganKriteria[itlo] = new JLabel("Perhitungan Kriteria"); }
    for (int tlo = 0; tlo < 2; tlo++) {
           kriteria[0][tlo] = new JLabel("Kriteria 1");  
           kriteria[1][tlo] = new JLabel("Kriteria 2");  
           kriteria[2][tlo] = new JLabel("Kriteria 3");  
           kriteria[3][tlo] = new JLabel("Kriteria 4");  
           alternatif[0][tlo] = new JLabel("Alternatif 1");  
           alternatif[1][tlo] = new JLabel("Alternatif 2");  
           alternatif[2][tlo] = new JLabel("Alternatif 3");  
           alternatif[3][tlo] = new JLabel("Alternatif 4");  
           alternatif[4][tlo] = new JLabel("Alternatif 5"); }   
    for (int klof = 0; klof < 5; klof++) {for (int mobil = 0; mobil < 2; mobil++) {jawabAlternatif[klof][mobil] = new JTextField(10); }}
    for (int plof = 0; plof < 4; plof++) {for (int kekar = 0; kekar < 2; kekar++) {jawabKriteria[plof][kekar] = new JTextField(10); }}
    for (int m = 0; m <5; m++)  {for (int prodi = 0; prodi < 2; prodi++)  {
          jawabAlternatif[m][prodi].setEditable(false);    
          jawabAlternatif[m][prodi].setVisible(false); }}  
    for (int hki = 0; hki < 4; hki++)  {for (int hse = 0; hse < 2; hse++) {
          jawabKriteria[hki][hse].setEditable(false);    
          jawabKriteria[hki][hse].setVisible(false);}}   
    kriteria[0][0].setBounds(1,210,100,25);  
    kriteria[1][0].setBounds(1,240,100,25);  
    kriteria[2][0].setBounds(1,270,100,25);  
    kriteria[3][0].setBounds(1,300,100,25);  
    for (int lop = 0; lop < 4; lop++) {add(kriteria[lop][0]); }    
    jawabKriteria[0][0].setBounds(101,210,70,25);  
    jawabKriteria[1][0].setBounds(101,240,70,25);  
    jawabKriteria[2][0].setBounds(101,270,70,25);  
    jawabKriteria[3][0].setBounds(101,300,70,25);  
    for (int jki = 0; jki < 4; jki++) {add(jawabKriteria[jki][0]); }  
    alternatif[0][0].setBounds(200,210,100,25);  
    alternatif[1][0].setBounds(200,240,100,25);  
    alternatif[2][0].setBounds(200,270,100,25);  
    alternatif[3][0].setBounds(200,300,100,25);  
    alternatif[4][0].setBounds(200,330,100,25);  
    for (int loyo = 0; loyo < 5; loyo++) {add(alternatif[loyo][0]); }  
    jawabAlternatif[0][0].setBounds(360,210,70,25);  
    jawabAlternatif[1][0].setBounds(360,240,70,25);  
    jawabAlternatif[2][0].setBounds(360,270,70,25);  
    jawabAlternatif[3][0].setBounds(360,300,70,25);  
    jawabAlternatif[4][0].setBounds(360,330,70,25);  
    for (int gfk = 0; gfk < 5; gfk++) {add(jawabAlternatif[gfk][0]); }  
    stroke.setBounds(0,380,200,25);
    kriteria[0][1].setBounds(1,420,200,25);  
    kriteria[1][1].setBounds(1,450,200,25);  
    kriteria[2][1].setBounds(1,480,200,25);  
    kriteria[3][1].setBounds(1,510,200,25);  
    for (int gdu = 0; gdu < 4; gdu++) {add(kriteria[gdu][1]); }   
    jawabKriteria[0][1].setBounds(101,420,60,25);  
    jawabKriteria[1][1].setBounds(101,450,60,25);  
    jawabKriteria[2][1].setBounds(101,480,60,25);  
    jawabKriteria[3][1].setBounds(101,510,60,25);  
    for (int jku = 0; jku < 4; jku++) {add(jawabKriteria[jku][1]); }  
    alternatif[0][1].setBounds(200,420,100,25);  
    alternatif[1][1].setBounds(200,450,100,25);  
    alternatif[2][1].setBounds(200,480,100,25);  
    alternatif[3][1].setBounds(200,510,100,25);  
    alternatif[4][1].setBounds(200,540,100,25);  
    for (int loyom = 0; loyom < 5; loyom++) {add(alternatif[loyom][1]); }  
    jawabAlternatif[0][1].setBounds(360,420,70,25);  
    jawabAlternatif[1][1].setBounds(360,450,70,25);  
    jawabAlternatif[2][1].setBounds(360,480,70,25);  
    jawabAlternatif[3][1].setBounds(360,510,70,25);  
    jawabAlternatif[4][1].setBounds(360,540,70,25);  
    for (int gfki = 0; gfki < 5; gfki++) {add(jawabAlternatif[gfki][1]); }  
    lanjut.setBounds(880,560,100,25);  
    add(lanjut);  
    lanjut.setEnabled(false);  
    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);  
    myocardialInfarction.setBounds(0,90,200,25);
    lblPerhitunganKriteria[0].setBounds(0, 80, 200, 25);
    lblPerhitunganKriteria[1].setBounds(0, 400, 200, 25);
    for (int celt = 0; celt < 2; celt++) {lblPerhitunganKriteria[celt].setVisible(false); }
    for (int kmlo = 0; kmlo <2; kmlo++) {add(lblPerhitunganKriteria[kmlo]); }
    add(myocardialInfarction);
    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);  
    statusMasuk.setBounds(0,70,200,25);
    add(statusMasuk);
    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);  
    tombolHubungkankePadukData.setVisible(true);  
    putuskanKoneksiKePadukData.setVisible(true);  
    tombolUbahPadukData.setVisible(true);  
    tombolBatal.setVisible(true);  
    lanjut.setBounds(880,560,100,25);  
    add(lanjut);  
    lanjut.setEnabled(false);
    lanjut.setVisible(false);  
    jcboURL.setVisible(true);  
    jcboDriver.setVisible(true);  
    statusKoneksi.setVisible(true);
    padukData.setVisible(true);  
    myocardialInfarction.setVisible(false);  
    stroke.setVisible(false);  
    add(stroke); 
    for (int hklma = 0; hklma < kriteria.length; hklma++) {for (int kloaka = 0; kloaka < 2; kloaka++){kriteria[hklma][kloaka].setVisible(false); }}  
    for (int hklma = 0; hklma < alternatif.length; hklma++) {for (int kock = 0; kock <2; kock++) {alternatif[hklma][kock].setVisible(false);}}     
    statusMasuk.setVisible(true);  
    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);
    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());
                    for (int celtf = 0; celtf < 2; celtf++) {lblPerhitunganKriteria[celtf].setVisible(false); }
                    if (("".equals(usrname)) && ("".equals(psswrd)))  {  
                                   tombolHubungkankePadukData.setEnabled(false);  
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   tombolUbahPadukData.setEnabled(false);  
                                   tombolBatal.setEnabled(false);  
                                   masuk.setEnabled(true);
                                   statusKoneksi.setText(fx);
                                   keluar.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(false); 
                                   JOptionPane.showMessageDialog(null, cx, ex, JOptionPane.INFORMATION_MESSAGE); }  
                    else if ((!"".equals(usrname)) && ("".equals(psswrd))) {  
                                   JOptionPane.showMessageDialog(null, ax, ex, JOptionPane.INFORMATION_MESSAGE);  
                                   tombolHubungkankePadukData.setEnabled(false);  
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   tombolUbahPadukData.setEnabled(false);  
                                   tombolBatal.setEnabled(false); 
                                   masuk.setEnabled(true);
                                   statusKoneksi.setText(fx);
                                   keluar.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(false); }  
                    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(fx);
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   JOptionPane.showMessageDialog(null, bx, ex, JOptionPane.INFORMATION_MESSAGE); }       
                    else if ((!"".equals(usrname)) && (!"".equals(psswrd))) {connectToDB(); }
                    masuklah(); }  
                private void masuklah() {  
                    try {
                        if (connection.isClosed()) {  
                            masuk.setEnabled(true);  
                            entryPrg(); }  
                        else {
                            masuk.setEnabled(false);
                            entryPrg(); }
                    } catch (SQLException ex) {ex.printStackTrace(); }}   
                private void entryPrg() {  
                          connectToDB();
                          try {
                              statement = connection.createStatement();
                              pernyataan = connection.createStatement();
                              loginName = "select Nama_Dokter from tblDokterAhli where Nama_Dokter = '"+usrname+"'";  
                              loginPassword = "select Kata_Kunci from tblDokterAhli where Kata_Kunci = '"+psswrd+"' and Nama_Dokter = '"+usrname+"'";
                              ResultSet logName = statement.executeQuery(loginName);  
                              ResultSet logPassword = pernyataan.executeQuery(loginPassword);
                              while (logName.next()) {namaPengguna1 = logName.getString("Nama_Dokter"); }  
                              while (logPassword.next()) {passwordPengguna1 = logPassword.getString("Kata_Kunci"); }  
                              if ((!"".equals(namaPengguna1)) && (!"".equals(passwordPengguna1))) {  
                                   tombolHubungkankePadukData.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(true);  
                                   tombolUbahPadukData.setEnabled(true);  
                                   tombolBatal.setEnabled(true);  
                                   masuk.setEnabled(false);
                                   statusKoneksi.setText("Belum Terhubung ke Paduk Data");
                                   statusMasuk.setText("Sudah Masuk");
                                   keluar.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(true);  
                                   statement.close();
                                   connection.close();
                                   connection = null;
                                   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(fx);
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   JOptionPane.showMessageDialog(null, dx, ex, JOptionPane.INFORMATION_MESSAGE);  
                                   connection.close();
                                   connection = null;
                                   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(fx);
                                   keluar.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   JOptionPane.showMessageDialog(null, dx, ex, JOptionPane.INFORMATION_MESSAGE);  
                                   connection.close();
                                   connection = null;
                                   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(fx);
                                   keluar.setEnabled(true);  
                                   putuskanKoneksiKePadukData.setEnabled(false);  
                                   JOptionPane.showMessageDialog(null, dx, ex, JOptionPane.INFORMATION_MESSAGE);  
                                   connection.close();
                                   connection = null;
                                   statement.close();
                                   pernyataan.close(); }}  
                          catch (java.lang.Exception ex){ 
                              ex.printStackTrace();
                              statusMasuk.setText("Gagal Masuk");  }}});
    putuskanKoneksiKePadukData.addActionListener(new java.awt.event.ActionListener() {  
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {  
                    try {putuskan(); } catch (SQLException ex) {ex.printStackTrace();}}  
                private void putuskan() throws SQLException {      
                    if (connection != null)  {  
                         statusKoneksi.setText("Koneksi ke Paduk Data sudah Terputus");  
                      for (int lko = 0; lko < 4; lko++) {for (int ten = 0; ten < 2; ten++) {
                              kriteria[lko][ten].setVisible(false);
                              jawabKriteria[lko][ten].setEditable(false);  
                              jawabKriteria[lko][ten].setVisible(false); }}  
                      for (int lok = 0; lok < 5; lok++) {for (int songo = 0; songo < 2; songo++) {
                             alternatif[lok][songo].setVisible(false);
                             jawabAlternatif[lok][songo].setEditable(false);   
                             jawabAlternatif[lok][songo].setVisible(false); }}      
                      connection.close();
                      connection = null;
                      statement.close();
                      pernyataan.close();
                      lanjut.setVisible(false);
                      lanjut.setEnabled(false);}
                    else {
                       statusKoneksi.setText(fx);  
                       myocardialInfarction.setVisible(false);
                       stroke.setVisible(false);
                       for (int ltu = 0; ltu < 4; ltu++) {for (int wolu = 0; wolu < 2; wolu++) {
                               kriteria[ltu][wolu].setVisible(false);
                               jawabKriteria[ltu][wolu].setEditable(false);  
                               jawabKriteria[ltu][wolu].setVisible(false); }}  
                       for (int tlu = 0; tlu < 5; tlu++) {for (int papat = 0; papat < 2; papat++) {
                               jawabAlternatif[tlu][papat].setEditable(false);  
                               jawabAlternatif[tlu][papat].setVisible(false);  
                               alternatif[tlu][papat].setVisible(false); }}}  
                    myocardialInfarction.setVisible(false);
                    stroke.setVisible(false); }});  
    keluar.addActionListener(new java.awt.event.ActionListener() {  
             @Override  
             public void actionPerformed(java.awt.event.ActionEvent evt) {keluar();}  
             private void keluar() {System.exit(0);}});  
    tombolHubungkankePadukData.addActionListener(new java.awt.event.ActionListener() {  
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {  
                        if (connection != null) {statusKoneksi.setText("Sudah Terhubung ke Paduk Data");}  
                        else {connectToDB(); }}});  
    tombolBatal.addActionListener(new java.awt.event.ActionListener() {  
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {batal();  }  
                private void batal() { 
                        if (connection != null) {                      
                          myocardialInfarction.setVisible(false);
                          stroke.setVisible(false);
                          for (int k = 0; k < 4; k++)  {for (int kipas = 0; kipas < 2; kipas++) {
                                jawabKriteria[k][kipas].setText("");   
                                kriteria[k][kipas].setVisible(false); }}  
                          for (int lkm = 0; lkm < 5; lkm++) {for (int kitas = 0; kitas < 2; kitas++) {
                                jawabAlternatif[lkm][kitas].setText("");  
                                alternatif[lkm][kitas].setVisible(false); }}  
                          for (int lqj = 0; lqj < 4; lqj++) {for (int lopker = 0; lopker < 2; lopker++) {
                                jawabKriteria[lqj][lopker].setEditable(false);  
                                jawabKriteria[lqj][lopker].setVisible(false); }}  
                          for (int ljq = 0; ljq < 5; ljq++) {for (int klopker = 0; klopker < 2; klopker++){
                                jawabAlternatif[ljq][klopker].setEditable(false);    
                                jawabAlternatif[ljq][klopker].setVisible(false); }}
                                lanjut.setEnabled(false); 
                                lanjut.setVisible(false);}
                        else {JOptionPane.showMessageDialog(null, "Hubungkan Dahulu ke Paduk Data", fx, JOptionPane.INFORMATION_MESSAGE); }}});  
    lanjut.addActionListener(new java.awt.event.ActionListener() {  
          @Override  
          public void actionPerformed(java.awt.event.ActionEvent evt) {kontinu(); }  
          private void kontinu() {  
              String[][] passCriteriaVariables = new String[4][2];  
              String[][] passAlternativeVariables = new String[5][2];  
              for (int ijkl = 0; ijkl < passCriteriaVariables.length; ijkl++) {for (int ikjl = 0; ikjl < passCriteriaVariables[ijkl].length; ikjl++) {passCriteriaVariables[ijkl][ikjl] = new String(); }}  
              for (int aijkl = 0; aijkl < 4; aijkl++) {for (int aikjl = 0; aikjl < 2; aikjl++) {passCriteriaVariables[aijkl][aikjl] = jawabKriteria[aijkl][aikjl].getText();  }}  
              for (int laijkl = 0; laijkl < passAlternativeVariables.length; laijkl++) {for (int laikjl = 0; laikjl < passAlternativeVariables[laijkl].length; laikjl++) {passAlternativeVariables[laijkl][laikjl] = new String(); }}  
              for (int lijkl = 0; lijkl < 5; lijkl++) {for (int likjl = 0; likjl < 2; likjl++) {passAlternativeVariables[lijkl][likjl] = jawabAlternatif[lijkl][likjl].getText(); }}  
              lblKriteria = passCriteriaVariables;  
              lblAlternatif = passAlternativeVariables; 
              lblNama.setVisible(false);  
              txtNama.setVisible(false);  
              kataSandi.setVisible(false);  
              sandiKata.setVisible(false);  
              masuk.setVisible(false);  
              keluar.setVisible(false); 
              myocardialInfarction.setBounds(0,60,200,25);
              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(true);  
              stroke.setVisible(true);  
              for (int hklma = 0; hklma < kriteria.length; hklma++) {for (int nyola = 0; nyola < kriteria[hklma].length; nyola++) {kriteria[hklma][nyola].setVisible(false); }}  
              for (int hklmaf = 0; hklmaf < jawabAlternatif1.length; hklmaf++) {for (int nyolaf = 0; nyolaf < jawabAlternatif1[hklmaf].length; nyolaf++) {jawabAlternatif1[hklmaf][nyolaf].setVisible(false); }}  
              for (int hklma = 0; hklma < alternatif.length; hklma++) {for (int nyola = 0; nyola < alternatif[hklma].length; nyola++) {alternatif[hklma][nyola].setVisible(false); }}  
              statusMasuk.setVisible(false);  
              for (int celta = 0; celta < lblPerhitunganKriteria.length; celta++) {lblPerhitunganKriteria[celta].setVisible(true); } 
              tampilKriteria.setVisible(true);  
              tampilKriteria1.setVisible(true);  
              ubah.setVisible(true);  
              kembali.setVisible(true);  
              lanjutlah.setVisible(true);  
              lanjutlah1.setVisible(true);  
              perhitunganKriteria.setVisible(false);  
              perhitunganKriteria1.setVisible(false);  
              kmbl.setVisible(false);  
              kmbl1.setVisible(false);  
              update.setVisible(false);  
              update1.setVisible(false);   
              for (int hklma = 0; hklma < jawabKriteria1.length; hklma++) {for (int piano = 0; piano < 2; piano++) {jawabKriteria1[hklma][piano].setVisible(true); }}    
              for (int hklma = 0; hklma < labelLuarKriteria.length; hklma++) {for (int nyola = 0; nyola < labelLuarKriteria[hklma].length; nyola++) {labelLuarKriteria[hklma][nyola].setVisible(true); }}  
              for (int hklma = 0; hklma < labelLuarAlternatif.length; hklma++) {for (int nyola = 0; nyola < labelLuarAlternatif[hklma].length; nyola++) {labelLuarAlternatif[hklma][nyola].setVisible(true); }}  
              for (int hklma = 0; hklma < labelLuarAlternatif1.length; hklma++) {for (int nyola = 0; nyola < labelLuarAlternatif1[hklma].length; nyola++) {labelLuarAlternatif1[hklma][nyola].setVisible(true); }}  
              for (int hklm = 0; hklm < labelLuarKriteria1.length; hklm++) {for (int nyol = 0; nyol < labelLuarKriteria1[hklm].length; nyol++) {labelLuarKriteria1[hklm][nyol].setVisible(true); }}  
              for (int hklmg = 0; hklmg < jawabKriteria.length; hklmg++) {for (int nyolg = 0; nyolg < jawabKriteria[hklmg].length; nyolg++) {jawabKriteria[hklmg][nyolg].setVisible(false); }}  
              for (int hklmga = 0; hklmga < jawabAlternatif.length; hklmga++) {for (int nyolga = 0; nyolga < jawabAlternatif[hklmga].length; nyolga++) {jawabAlternatif[hklmga][nyolga].setVisible(false); }}  
              kriteriaLanjut.setVisible(false);  
              kriteriaLanjut1.setVisible(false); }}); //FrameBaru baru = new FrameBaru(passCriteriaVariables, passAlternativeVariables); // I want to make a class that is named FrameBaru to be visible   
    tombolUbahPadukData.addActionListener(new java.awt.event.ActionListener() {  
       @Override  
       public void actionPerformed(java.awt.event.ActionEvent evt) {  
           try {ubah();
           } catch (SQLException ex) {
               ex.printStackTrace();
               statusKoneksi.setText("Gagal Terhubung dengan Paduk Data"); }}   
       private void ubah() throws SQLException { 
               if (connection != null) {
                      for (int lmo = 0; lmo < 4; lmo++) {  
                          for (int jmo = 0; jmo < 2; jmo++){
                              jawabKriteria[lmo][jmo].setEditable(true);
                              jawabKriteria[lmo][jmo].setVisible(true);
                              kriteria[lmo][jmo].setVisible(true); 
                              kriteria[lmo][jmo].setEnabled(true);}}  
                     for (int mlo = 0; mlo < 5; mlo++)  {
                         for (int hlok = 0; hlok < 2; hlok++) {
                              jawabAlternatif[mlo][hlok].setEditable(true);  
                              jawabAlternatif[mlo][hlok].setVisible(true);
                              alternatif[mlo][hlok].setVisible(true);
                              alternatif[mlo][hlok].setEnabled(true); }}  
                     lanjut.setEnabled(true); 
                     lanjut.setVisible(true);
                     myocardialInfarction.setBounds(0, 160, 200, 25);
                     myocardialInfarction.setVisible(true);
                     stroke.setVisible(true); }
               else {JOptionPane.showMessageDialog(null, "Hubungkan Dahulu ke Paduk Data", fx, JOptionPane.INFORMATION_MESSAGE); }}});}
    public static void main(String[] args) {  
            BaruProgram tesis = new BaruProgram();   
            tesis.setTitle("Program Pemilihan Obat dengan Cara Analytic Hierarchycal Process");  
            tesis.setSize(1024,768);  
            tesis.setVisible(true);  
            tesis.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            tesis.setLocationRelativeTo(null); }}
    I give the variables values with the codes in bold. So? What should I do next if that is not correct?
    Last edited by Tawijakarta; July 17th, 2013 at 09:49 AM.
  12. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    This is the BaruFrame:

    Code:
    package programtesisbaru;
    
    import javax.swing.*;
    
    /**
     *
     * @author Tawi
     */
    class BaruFrame extends JFrame {
          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  BaruFrame() {    
            setSize(1024,768);  
            setVisible(true);
            setTitle("Penghitungan Data");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            setLocationRelativeTo(null);  
      
    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][1]);  
    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);    
    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,180,100,25);  
    jawabKriteria1[1][0].setBounds(101,210,100,25);  
    jawabKriteria1[2][0].setBounds(101,240,100,25);  
    jawabKriteria1[3][0].setBounds(101,270,100,25);  
    jawabKriteria1[4][0].setBounds(202,180,100,25);  
    jawabKriteria1[5][0].setBounds(202,210,100,25);  
    jawabKriteria1[6][0].setBounds(202,240,100,25);  
    jawabKriteria1[7][0].setBounds(202,270,100,25);  
    jawabKriteria1[8][0].setBounds(303,180,100,25);  
    jawabKriteria1[9][0].setBounds(303,210,100,25);  
    jawabKriteria1[10][0].setBounds(303,240,100,25);  
    jawabKriteria1[11][0].setBounds(303,270,100,25);  
    jawabKriteria1[12][0].setBounds(404,180,100,25);  
    jawabKriteria1[13][0].setBounds(404,210,100,25);  
    jawabKriteria1[14][0].setBounds(404,240,100,25);  
    jawabKriteria1[15][0].setBounds(404,270,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,300,100,25);  
    add(lanjutlah);  
    add(stroke1);
    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);  
    perhitunganKriteria1.setBounds(506,630,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);  
    add(kmbl);  
    add(kmbl1);  
    add(kriteriaLanjut);  
    add(kriteriaLanjut1);  
    add(update);  
    add(update1);  
    add(tampilKriteria);  
    add(tampilKriteria1);  
    kmbl.setVisible(false);  
    kmbl1.setVisible(false);  
    for (int kul = 0; kul < 4; kul++) {  
    add(labelLuarKriteria[kul][1]);  
    add(labelLuarKriteria1[kul][1]); }  
    for (int s = 0; s < 16; s++) {add(jawabKriteria1[s][1]); }  
    perhitunganKriteria.setVisible(false);  
    add(perhitunganKriteria);  
    perhitunganKriteria1.setVisible(false); 
    add(perhitunganKriteria1);
    for (int mnjk = 0; mnjk < 25; mnjk++) {  
        add(jawabAlternatif1[mnjk][0]);  
        jawabAlternatif1[mnjk][0].setVisible(false);  
        add(jawabAlternatif1[mnjk][1]);  
        jawabAlternatif1[mnjk][1].setVisible(false); }  
    add(myocardInfarc);  
    for (int yul = 0; yul < 4; yul++) { 
        add(labelLuarKriteria[yul][0]);  
        add(labelLuarKriteria1[yul][0]); }  
    for (int yulp = 0; yulp < 5; yulp++) {  
        add(labelLuarAlternatif[yulp][0]);  
        add(labelLuarAlternatif1[yulp][0]);  
        add(labelLuarAlternatif[yulp][1]);  
        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++) {add(jawabKriteria1[s][0]);}    
    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);  
    add(lanjutlah1);  
    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);                
                    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) {   
                    if (xyz > 3) {  
                        xyz--;  
                        kmbl.setText(lblKriteria[xyz-1][0]);
                        kriteriaLanjut.setEnabled(false);
                        JOptionPane.showMessageDialog(null, "Akhir Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE); }
                    else if ((xyz >= 0) && (xyz <= 3)) {
                        xyz = xyz++;  
                        kriteriaLanjut.setText(lblKriteria[xyz][0]);  
                        if ((xyz - 1) < 0) {kmbl.setText(""); }
                        else {
                        for (int dlp = 0; dlp < 25; dlp++) {variabelTampung[dlp + ((xyz-1)*25)][0] = jawabAlternatif1[dlp][0].getText(); }
                        kmbl.setText(lblKriteria[xyz-1][0]); 
                        kmbl.setEnabled(true);}}
                    else if (xyz < 0) {
                        JOptionPane.showMessageDialog(null, "Ada Kesalahan tidak Terduga", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE); }}});  
    kmbl.addActionListener(new java.awt.event.ActionListener() {          
                @Override  
                public void actionPerformed(java.awt.event.ActionEvent evt) {   
                    if (xyz > 0) {
                    xyz--;  
                    kriteriaLanjut.setText(lblKriteria[xyz][0]);  
                    for (int dlp = 0; dlp < 25; dlp++) {jawabAlternatif1[dlp][0].setText(variabelTampung[dlp + ((xyz * 25))][0]); }}
                    else if (xyz == 0) {
                    kmbl.setText("");
                    kmbl.setEnabled(false);
                    kriteriaLanjut.setEnabled(true);}  
                    else  if (xyz < 0) {  
                        kmbl.setText("");  
                        xyz++;
                        kmbl.setEnabled(false);
                        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) {   
                    if (xyz1 > 0) {
                    xyz1--;  
                    kriteriaLanjut1.setText(lblKriteria[xyz][1]);  
                    for (int dlp = 0; dlp < 25; dlp++) {jawabAlternatif1[dlp][1].setText(variabelTampung[dlp + ((xyz * 25))][1]); }}
                    else if (xyz1 == 0) {
                    kmbl1.setText("");
                    kmbl1.setEnabled(false);
                    kriteriaLanjut1.setEnabled(true);}  
                    else  if (xyz1 < 0) {  
                        kmbl1.setText("");  
                        xyz1++;
                        kmbl1.setEnabled(false);
                        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) {   
                    if (xyz1 > 3) {  
                        xyz1--;  
                        kmbl1.setText(lblKriteria[xyz-1][1]);
                        kriteriaLanjut1.setEnabled(false);
                        JOptionPane.showMessageDialog(null, "Akhir Kriteria", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE); }
                    else if ((xyz1 >= 0) && (xyz1 <= 3)) {
                        xyz1 = xyz1++;  
                        kriteriaLanjut1.setText(lblKriteria[xyz][1]);  
                        if ((xyz1 - 1) < 0) {kmbl1.setText(""); }
                        else {
                        for (int dlp = 0; dlp < 25; dlp++) {variabelTampung[dlp + ((xyz-1)*25)][1] = jawabAlternatif1[dlp][1].getText(); }
                        kmbl1.setText(lblKriteria[xyz-1][1]); 
                        kmbl1.setEnabled(true);}}
                    else if (xyz1 < 0) {
                        JOptionPane.showMessageDialog(null, "Ada Kesalahan tidak Terduga", "Pesan Kesalahan", JOptionPane.INFORMATION_MESSAGE); }}}); }}
    What is the problem?
  13. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    348
    Can you answer any of the questions about the code that I asked in post#310?
    You need to figure out what your code is doing.

    The code is TOO LARGE for me.
    Also it is very poorly formatted. There is a free website that will format the code:http://www.prettyprinter.de/
    Here is a sample for part of your program:
    Code:
    package programtesisbaru;
    
    /**
    *
    * @author Tawi
    */
    import java.sql.*;
    import javax.swing.*;
    
    public class BaruProgram extends BaruFrame
    {
        
        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");
        int i;
        JLabel[] lblPerhitunganKriteria = new JLabel[2];
        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");
        JButton lanjut = new JButton("Lanjut");
        JComboBox jcboURL = new JComboBox (new String[]
        {
            "jdbc:odbc:DatabaseKlinik"
        }
        );
        JComboBox jcboDriver = new JComboBox (new String[]
        {
            "sun.jdbc.odbc.JdbcOdbcDriver"
        }
        );
        Connection connection;
        Statement statement;
        Statement pernyataan;
        JLabel statusKoneksi = new JLabel("Belum ada Koneksi ke Paduk Data");
        JLabel padukData = new JLabel("Paduk Data Belum Diubah");
        String namaPengguna1 = new String();
        String passwordPengguna1 = new String();
        JLabel myocardialInfarction = new JLabel("Myocardial Infarction");
        JLabel stroke = new JLabel("Stroke");
        JLabel[][] kriteria = new JLabel[4][2];
        JLabel[][] alternatif = new JLabel[5][2];
        JTextField[][]jawabKriteria = new JTextField [4][2];
        JTextField[][] jawabAlternatif = new JTextField[5][2];
        JLabel statusMasuk = new JLabel("Belum Masuk");
        String ax = "Kata Sandi Belum Dimasukkan";
        String bx = "Nama Dokter Belum Dimasukkan";
        String cx = "Nama Dokter dan Kata Sandi tidak Diisi";
        String dx = "Nama Dokter atau Kata Sandi tidak Benar";
        String ex = "Kesalahan";
        String fx = "Tidak Ada Koneksi ke Paduk Data";
        String usrname = new String();
        String psswrd = new String();
        String uniRL = (String)jcboURL.getSelectedItem();
        String driver = (String) jcboDriver.getSelectedItem();
        public void connectToDB()
        {
            
            try
            {
                
                Class.forName(driver);
                connection = DriverManager.getConnection(uniRL, usrname, psswrd);
                statusKoneksi.setText("Terhubung ke Paduk Data");
            }
            
            catch (java.lang.Exception x)
            {
                
                x.printStackTrace();
                statusKoneksi.setText("Gagal Terhubung ke Paduk Data");
            }
            
        }
        
        public BaruProgram()
        {
            
            setLayout(null);
            for (int itlo = 0; itlo &lt; 2; itlo++)
            {
                lblPerhitunganKriteria[itlo] = new JLabel("Perhitungan Kriteria");
            }
            
            for (int tlo = 0; tlo &lt; 2; tlo++)
            {
                
                kriteria[0][tlo] = new JLabel("Kriteria 1");
                kriteria[1][tlo] = new JLabel("Kriteria 2");
                kriteria[2][tlo] = new JLabel("Kriteria 3");
                kriteria[3][tlo] = new JLabel("Kriteria 4");
                alternatif[0][tlo] = new JLabel("Alternatif 1");
                alternatif[1][tlo] = new JLabel("Alternatif 2");
                alternatif[2][tlo] = new JLabel("Alternatif 3");
                alternatif[3][tlo] = new JLabel("Alternatif 4");
                alternatif[4][tlo] = new JLabel("Alternatif 5");
            }
            
            for (int klof = 0; klof &lt; 5; klof++)
            {
                for (int mobil = 0; mobil &lt; 2; mobil++)
                {
                    jawabAlternatif[klof][mobil] = new JTextField(10);
                }
                
            }
            
            for (int plof = 0; plof &lt; 4; plof++)
            {
                for (int kekar = 0; kekar &lt; 2; kekar++)
                {
                    jawabKriteria[plof][kekar] = new JTextField(10);
                }
                
            }
            
            for (int m = 0; m &lt;5; m++)
            {
                for (int prodi = 0; prodi &lt; 2; prodi++)
                {
                    
                    jawabAlternatif[m][prodi].setEditable(false);
                    jawabAlternatif[m][prodi].setVisible(false);
                }
                
            }
            
            for (int hki = 0; hki &lt; 4; hki++)
            {
                for (int hse = 0; hse &lt; 2; hse++)
                {
                    
                    jawabKriteria[hki][hse].setEditable(false);
                    jawabKriteria[hki][hse].setVisible(false);
                }
                
            }
            
            kriteria[0][0].setBounds(1,210,100,25);
            kriteria[1][0].setBounds(1,240,100,25);
            kriteria[2][0].setBounds(1,270,100,25);
            kriteria[3][0].setBounds(1,300,100,25);
            for (int lop = 0; lop &lt; 4; lop++)
            {
                add(kriteria[lop][0]);
            }
            
            jawabKriteria[0][0].setBounds(101,210,70,25);
            jawabKriteria[1][0].setBounds(101,240,70,25);
            jawabKriteria[2][0].setBounds(101,270,70,25);
            jawabKriteria[3][0].setBounds(101,300,70,25);
            for (int jki = 0; jki &lt; 4; jki++)
            {
                add(jawabKriteria[jki][0]);
            }
            
            alternatif[0][0].setBounds(200,210,100,25);
            alternatif[1][0].setBounds(200,240,100,25);
            alternatif[2][0].setBounds(200,270,100,25);
            alternatif[3][0].setBounds(200,300,100,25);
            alternatif[4][0].setBounds(200,330,100,25);
            for (int loyo = 0; loyo &lt; 5; loyo++)
            {
                add(alternatif[loyo][0]);
            }
            
            jawabAlternatif[0][0].setBounds(360,210,70,25);
            jawabAlternatif[1][0].setBounds(360,240,70,25);
            jawabAlternatif[2][0].setBounds(360,270,70,25);
            jawabAlternatif[3][0].setBounds(360,300,70,25);
            jawabAlternatif[4][0].setBounds(360,330,70,25);
            for (int gfk = 0; gfk &lt; 5; gfk++)
            {
                add(jawabAlternatif[gfk][0]);
            }
            
            stroke.setBounds(0,380,200,25);
            kriteria[0][1].setBounds(1,420,200,25);
            kriteria[1][1].setBounds(1,450,200,25);
            kriteria[2][1].setBounds(1,480,200,25);
            kriteria[3][1].setBounds(1,510,200,25);
            for (int gdu = 0; gdu &lt; 4; gdu++)
            {
                add(kriteria[gdu][1]);
            }
            
            jawabKriteria[0][1].setBounds(101,420,60,25);
            jawabKriteria[1][1].setBounds(101,450,60,25);
            jawabKriteria[2][1].setBounds(101,480,60,25);
            jawabKriteria[3][1].setBounds(101,510,60,25);
            for (int jku = 0; jku &lt; 4; jku++)
            {
                add(jawabKriteria[jku][1]);
            }
            
            alternatif[0][1].setBounds(200,420,100,25);
            alternatif[1][1].setBounds(200,450,100,25);
            alternatif[2][1].setBounds(200,480,100,25);
            alternatif[3][1].setBounds(200,510,100,25);
            alternatif[4][1].setBounds(200,540,100,25);
            for (int loyom = 0; loyom &lt; 5; loyom++)
            {
                add(alternatif[loyom][1]);
            }
            
            jawabAlternatif[0][1].setBounds(360,420,70,25);
            jawabAlternatif[1][1].setBounds(360,450,70,25);
            jawabAlternatif[2][1].setBounds(360,480,70,25);
            jawabAlternatif[3][1].setBounds(360,510,70,25);
            jawabAlternatif[4][1].setBounds(360,540,70,25);
            for (int gfki = 0; gfki &lt; 5; gfki++)
            {
                add(jawabAlternatif[gfki][1]);
            }
            
            lanjut.setBounds(880,560,100,25);
            add(lanjut);
            lanjut.setEnabled(false);
            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);
            myocardialInfarction.setBounds(0,90,200,25);
            lblPerhitunganKriteria[0].setBounds(0, 80, 200, 25);
            lblPerhitunganKriteria[1].setBounds(0, 400, 200, 25);
            for (int celt = 0; celt &lt; 2; celt++)
            {
                lblPerhitunganKriteria[celt].setVisible(false);
            }
            
            for (int kmlo = 0; kmlo &lt;2; kmlo++)
            {
                add(lblPerhitunganKriteria[kmlo]);
            }
            
            add(myocardialInfarction);
            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);
            statusMasuk.setBounds(0,70,200,25);
            add(statusMasuk);
            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);
            tombolHubungkankePadukData.setVisible(true);
            putuskanKoneksiKePadukData.setVisible(true);
            tombolUbahPadukData.setVisible(true);
            tombolBatal.setVisible(true);
            lanjut.setBounds(880,560,100,25);
            add(lanjut);
            lanjut.setEnabled(false);
            lanjut.setVisible(false);
            jcboURL.setVisible(true);
            jcboDriver.setVisible(true);
            statusKoneksi.setVisible(true);
            padukData.setVisible(true);
            myocardialInfarction.setVisible(false);
            stroke.setVisible(false);
            add(stroke);
            for (int hklma = 0; hklma &lt; kriteria.length; hklma++)
            {
                for (int kloaka = 0; kloaka &lt; 2; kloaka++)
                {
                    kriteria[hklma][kloaka].setVisible(false);
                }
                
            }
            
            for (int hklma = 0; hklma &lt; alternatif.length; hklma++)
            {
                for (int kock = 0; kock &lt;2; kock++)
                {
                    alternatif[hklma][kock].setVisible(false);
                }
                
            }
            
            statusMasuk.setVisible(true);
            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 &lt; jawabKriteria1.length; hklma++)
            {
                for (int nyola = 0; nyola &lt; jawabKriteria1[hklma].length; nyola++)
                {
                    jawabKriteria1[hklma][nyola].setVisible(false);
                }
                
            }
            
            for (int hklma = 0; hklma &lt; jawabAlternatif1.length; hklma++)
            {
                for (int nyola = 0; nyola &lt; jawabAlternatif1[hklma].length; nyola++)
                {
                    jawabAlternatif1[hklma][nyola].setVisible(false);
                }
                
            }
            
            for (int hklma = 0; hklma &lt; labelLuarKriteria.length; hklma++)
            {
                for (int nyola = 0; nyola &lt; labelLuarKriteria[hklma].length; nyola++)
                {
                    labelLuarKriteria[hklma][nyola].setVisible(false);
                }
                
            }
            
            for (int hklma = 0; hklma &lt; labelLuarAlternatif.length; hklma++)
            {
                for (int nyola = 0; nyola &lt; labelLuarAlternatif[hklma].length; nyola++)
                {
                    labelLuarAlternatif[hklma][nyola].setVisible(false);
                }
                
            }
            
            for (int hklma = 0; hklma &lt; labelLuarAlternatif1.length; hklma++)
            {
                for (int nyola = 0; nyola &lt; labelLuarAlternatif1[hklma].length; nyola++)
                {
                    labelLuarAlternatif1[hklma][nyola].setVisible(false);
                }
                
            }
            
            for (int hklm = 0; hklm &lt; labelLuarKriteria1.length; hklm++)
            {
                for (int nyol = 0; nyol &lt; labelLuarKriteria1[hklm].length; nyol++)
                {
                    labelLuarKriteria1[hklm][nyol].setVisible(false);
                }
                
            }
            
            kriteriaLanjut.setVisible(false);
            kriteriaLanjut1.setVisible(false);
            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());
                    for (int celtf = 0; celtf &lt; 2; celtf++)
                    {
                        lblPerhitunganKriteria[celtf].setVisible(false);
                    }
                    
                    if (("".equals(usrname)) && ("".equals(psswrd)))
                    {
                        
                        tombolHubungkankePadukData.setEnabled(false);
                        putuskanKoneksiKePadukData.setEnabled(false);
                        tombolUbahPadukData.setEnabled(false);
                        tombolBatal.setEnabled(false);
                        masuk.setEnabled(true);
                        statusKoneksi.setText(fx);
                        keluar.setEnabled(true);
                        putuskanKoneksiKePadukData.setEnabled(false);
                        JOptionPane.showMessageDialog(null, cx, ex, JOptionPane.INFORMATION_MESSAGE);
                    }
                    
                    else if ((!"".equals(usrname)) && ("".equals(psswrd)))
                    {
                        
                        JOptionPane.showMessageDialog(null, ax, ex, JOptionPane.INFORMATION_MESSAGE);
                        tombolHubungkankePadukData.setEnabled(false);
                        putuskanKoneksiKePadukData.setEnabled(false);
                        tombolUbahPadukData.setEnabled(false);
                        tombolBatal.setEnabled(false);
                        masuk.setEnabled(true);
                        statusKoneksi.setText(fx);
                        keluar.setEnabled(true);
                        putuskanKoneksiKePadukData.setEnabled(false);
                    }
                    
                    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(fx);
                        putuskanKoneksiKePadukData.setEnabled(false);
                        JOptionPane.showMessageDialog(null, bx, ex, JOptionPane.INFORMATION_MESSAGE);
                    }
                    
                    else if ((!"".equals(usrname)) && (!"".equals(psswrd)))
                    {
                        connectToDB();
                    }
                    
                    masuklah();
                }
                
                private void masuklah()
                {
                    
                    try
                    {
                        
                        if (connection.isClosed())
                        {
                            
                            masuk.setEnabled(true);
                            entryPrg();
                        }
                        
                        else
                        {
                            
                            masuk.setEnabled(false);
                            entryPrg();
                        }
                        
                        
                    }
                    catch (SQLException ex)
                    {
                        ex.printStackTrace();
                    }
                    
                }
                
                private void entryPrg()
                {
                    
                    connectToDB();
                    try
                    {
                        
                        statement = connection.createStatement();
                        pernyataan = connection.createStatement();
                        loginName = "select Nama_Dokter from tblDokterAhli where Nama_Dokter = '"+usrname+"'";
                        loginPassword = "select Kata_Kunci from tblDokterAhli where Kata_Kunci = '"+psswrd+"' and Nama_Dokter = '"+usrname+"'";
                        ResultSet logName = statement.executeQuery(loginName);
                        ResultSet logPassword = pernyataan.executeQuery(loginPassword);
                        while (logName.next())
                        {
                            namaPengguna1 = logName.getString("Nama_Dokter");
                        }
                        
                        while (logPassword.next())
                        {
                            passwordPengguna1 = logPassword.getString("Kata_Kunci");
                        }
                        
                        if ((!"".equals(namaPengguna1)) && (!"".equals(passwordPengguna1)))
                        {
                            
                            tombolHubungkankePadukData.setEnabled(true);
                            putuskanKoneksiKePadukData.setEnabled(true);
                            tombolUbahPadukData.setEnabled(true);
                            tombolBatal.setEnabled(true);
                            masuk.setEnabled(false);
                            statusKoneksi.setText("Belum Terhubung ke Paduk Data");
                            statusMasuk.setText("Sudah Masuk");
                            keluar.setEnabled(true);
                            putuskanKoneksiKePadukData.setEnabled(true);
                            statement.close();
                            connection.close();
                            connection = null;
                            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(fx);
                            putuskanKoneksiKePadukData.setEnabled(false);
                            JOptionPane.showMessageDialog(null, dx, ex, JOptionPane.INFORMATION_MESSAGE);
                            connection.close();
                            connection = null;
                            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(fx);
                            keluar.setEnabled(true);
                            putuskanKoneksiKePadukData.setEnabled(false);
                            JOptionPane.showMessageDialog(null, dx, ex, JOptionPane.INFORMATION_MESSAGE);
                            connection.close();
                            connection = null;
                            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(fx);
                            keluar.setEnabled(true);
                            putuskanKoneksiKePadukData.setEnabled(false);
                            JOptionPane.showMessageDialog(null, dx, ex, JOptionPane.INFORMATION_MESSAGE);
                            connection.close();
                            connection = null;
                            statement.close();
                            pernyataan.close();
                        }
                        
                    }
                    
                    catch (java.lang.Exception ex)
                    {
                        
                        ex.printStackTrace();
                        statusMasuk.setText("Gagal Masuk");
                    }
                    
                }
                
            }
            );
            putuskanKoneksiKePadukData.addActionListener(new java.awt.event.ActionListener()
            {
                
                @Override
                public void actionPerformed(java.awt.event.ActionEvent evt)
                {
                    
                    try
                    {
                        putuskan();
                    }
                    catch (SQLException ex)
                    {
                        ex.printStackTrace();
                    }
                    
                }
                
                private void putuskan() throws SQLException
                {
                    
                    if (connection != null)
                    {
                        
                        statusKoneksi.setText("Koneksi ke Paduk Data sudah Terputus");
                        for (int lko = 0; lko &lt; 4; lko++)
                        {
                            for (int ten = 0; ten &lt; 2; ten++)
                            {
                                
                                kriteria[lko][ten].setVisible(false);
                                jawabKriteria[lko][ten].setEditable(false);
                                jawabKriteria[lko][ten].setVisible(false);
                            }
                            
                        }
                        
                        for (int lok = 0; lok &lt; 5; lok++)
                        {
                            for (int songo = 0; songo &lt; 2; songo++)
                            {
                                
                                alternatif[lok][songo].setVisible(false);
                                jawabAlternatif[lok][songo].setEditable(false);
                                jawabAlternatif[lok][songo].setVisible(false);
                            }
                            
                        }
                        
                        connection.close();
                        connection = null;
                        statement.close();
                        pernyataan.close();
                        lanjut.setVisible(false);
                        lanjut.setEnabled(false);
                    }
                    
                    else
                    {
                        
                        statusKoneksi.setText(fx);
                        myocardialInfarction.setVisible(false);
                        stroke.setVisible(false);
                        for (int ltu = 0; ltu &lt; 4; ltu++)
                        {
                            for (int wolu = 0; wolu &lt; 2; wolu++)
                            {
                                
                                kriteria[ltu][wolu].setVisible(false);
                                jawabKriteria[ltu][wolu].setEditable(false);
                                jawabKriteria[ltu][wolu].setVisible(false);
                            }
                            
                        }
                        
                        for (int tlu = 0; tlu &lt; 5; tlu++)
                        {
                            for (int papat = 0; papat &lt; 2; papat++)
                            {
                                
                                jawabAlternatif[tlu][papat].setEditable(false);
                                jawabAlternatif[tlu][papat].setVisible(false);
                                alternatif[tlu][papat].setVisible(false);
                            }
                            
                        }
                        
                    }
                    
                    myocardialInfarction.setVisible(false);
                    stroke.setVisible(false);
                }
                
            }
            );
            keluar.addActionListener(new java.awt.event.ActionListener()
            {
                
                @Override
                public void actionPerformed(java.awt.event.ActionEvent evt)
                {
                    keluar();
                }
                
                private void keluar()
                {
                    System.exit(0);
                }
                
            }
            );
            tombolHubungkankePadukData.addActionListener(new java.awt.event.ActionListener()
            {
                
                @Override
                public void actionPerformed(java.awt.event.ActionEvent evt)
                {
                    
                    if (connection != null)
                    {
                        statusKoneksi.setText("Sudah Terhubung ke Paduk Data");
                    }
                    
                    else
                    {
                        connectToDB();
                    }
                    
                }
                
            }
            );
            tombolBatal.addActionListener(new java.awt.event.ActionListener()
            {
                
    
     ......  code removed here  <<<<<<<<<<<<<<<<
    
    
    
        public static void main(String[] args)
        {
            
            BaruProgram tesis = new BaruProgram();
            tesis.setTitle("Program Pemilihan Obat dengan Cara Analytic Hierarchycal Process");
            tesis.setSize(1024,768);
            tesis.setVisible(true);
            tesis.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            tesis.setLocationRelativeTo(null);
        }
        
    }
    Last edited by NormR; July 17th, 2013 at 10:52 AM. Reason: Change text to hyperlink
  14. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    User's input is read at:

    Code:
    for (int ijkl = 0; ijkl < passCriteriaVariables.length; ijkl++) {for (int ikjl = 0; ikjl < passCriteriaVariables[ijkl].length; ikjl++) {passCriteriaVariables[ijkl][ikjl] = new String(); }}  
              for (int aijkl = 0; aijkl < 4; aijkl++) {for (int aikjl = 0; aikjl < 2; aikjl++) {passCriteriaVariables[aijkl][aikjl] = jawabKriteria[aijkl][aikjl].getText();  }}  
              for (int laijkl = 0; laijkl < passAlternativeVariables.length; laijkl++) {for (int laikjl = 0; laikjl < passAlternativeVariables[laijkl].length; laikjl++) {passAlternativeVariables[laijkl][laikjl] = new String(); }}  
              for (int lijkl = 0; lijkl < 5; lijkl++) {for (int likjl = 0; likjl < 2; likjl++) {passAlternativeVariables[lijkl][likjl] = jawabAlternatif[lijkl][likjl].getText(); }}
    After it is read, the content of the passCriteriaVariables are passed to lblKriteria and passAlternativevariables are passed to lblAlternatif as you can see in post 311 that is being made bold by me. I format the code this way to make you analyze it for me because without doing this, the code will have more than 500 lines. The code should display the user's input at above of the JTextFields that were shown after the user click the lanjut button. After the user clicks lanjut button after the user clicks the first lanjut button, JTextFields and the users's input that is being assigned to lblAlternatif should be shown. The user's input should be at the above of the JTextField. In fact, the code does not do this. What should I do?
  15. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    348
    . I format the code this way to make you analyze it for me
    The formatting makes the code HARD TO READ and UNDERSTAND. See how the code is formatted in post#313. Your code needs to be formatted like that. There is a FREE website that will format the code. See post#313.

    I am NOT going to analyze such a large program. It has over 1500+ lines when it is properly formatted. Putting more than one statement on a line is NOT the way to make the code better. You could put all the code on one line and it would compile and execute but be impossible to read and understand.

    code should display the user's input at above of the JTextFields
    What field does the user's input come from?
    What field is that input supposed to be displayed in?
    Use println() statements to show what is read, how it is passed and how it is put into the field where it is to be displayed.

IMN logo majestic logo threadwatch logo seochat tools logo