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

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    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.


    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.
    The user's inputs are coming from jawabKriteria and jawabAlternatif. They should be put at the mentioned place, so how to make it happen?
  2. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    how to make it happen?
    You need to debug the code to see where the user's input is going when the program is executed. Try adding some println() statements to show the user's input when it is read from the textfield, then when it is copied to another variable and then again when it is assigned to the component that will show it on the screen. The print outs should show you where the problem is. If the user's input shows when it is read from the text field, and does NOT show when it is copied to the component where it will be shown on the screen, then you know to look further into the code between those two places to see why the data is not getting copied correctly.
  3. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Code:
    package programtesisbaru;
    
    import javax.swing.*;
    
    /**
     *
     * @author Tawi
     */
    public class ProgramBaru extends Kuyakuya {
    JTextField[][]jawabKriteria = new JTextField [4][2];  
    JTextField[][] jawabAlternatif = new JTextField[5][2]; 
    JLabel[][] kriteria = new JLabel[4][2];  
    JLabel[][] alternatif = new JLabel[5][2];  
    String[][] passCriteriaVariables = new String[4][2];  
    String[][] passAlternativeVariables = new String[5][2]; 
    JButton lanjut = new JButton("Lanjut");
    JLabel myocardialInfarction = new JLabel("Myocardial Infarction");  
    JLabel stroke = new JLabel("Stroke");  
    public ProgramBaru() {
    setLayout(null);
              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); }}
              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);
              myocardialInfarction.setBounds(0,90,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);  
              add(myocardialInfarction);
              add(stroke);
              
    lanjut.addActionListener(new java.awt.event.ActionListener() {  
          @Override  
          public void actionPerformed(java.awt.event.ActionEvent evt) {kontinu(); }  
          private void kontinu() {   
              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;
              myocardialInfarction.setBounds(0,60,200,25);
              lanjut.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); }}             
              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); }});
    }
    public static void main(String[] args) {  
            ProgramBaru coba = new ProgramBaru();   
            coba.setTitle("Program Pemilihan Obat dengan Cara Analytic Hierarchycal Process");  
            coba.setSize(1024,768);  
            coba.setVisible(true);  
            coba.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            coba.setLocationRelativeTo(null); }
    }
  4. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Code:
    package programtesisbaru;
    
    import javax.swing.*;
    
    /**
     *
     * @author Tawi
     */
    class Kuyakuya extends JFrame {
          String[][] lblKriteria = new String[4][2];  
          String[][] lblAlternatif = new String[5][2]; 
          JLabel[][] labelLuarKriteria = new JLabel[4][2];  
          JLabel[][] labelLuarAlternatif = new JLabel[5][2];  
          JLabel[][] labelLuarAlternatif1 = new JLabel[5][2];
          JLabel labelLuarKriteria1[][] = new JLabel[4][2];
          JButton kriteriaLanjut = new JButton("");  
          JButton kriteriaLanjut1 = new JButton("");
          JTextField[][] jawabKriteria1 = new JTextField[16][2];  
          JTextField[][] jawabAlternatif1 = new JTextField[25][2];
          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");  
          int xyz = 0;  
          int xyz1 = 0;
          String[][] variabelTampung = new String[100][2];  
    public Kuyakuya() {
        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]); }  
    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);  
    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);  
    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); 
    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); }  
    for (int mnjka = 0; mnjka < 16; mnjka++) {  
        add(jawabKriteria1[mnjka][0]);  
        jawabKriteria1[mnjka][0].setVisible(false);  
        add(jawabKriteria1[mnjka][1]);  
        jawabKriteria1[mnjka][1].setVisible(false); } 
    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 yul = 0; yul < 4; yul++) { 
        add(labelLuarKriteria[yul][0]);  
        add(labelLuarKriteria1[yul][0]); }  
    add(kmbl);  
    add(kmbl1);  
    add(kriteriaLanjut);  
    add(kriteriaLanjut1);  
    add(update);  
    add(update1);  
    add(tampilKriteria);  
    add(tampilKriteria1); 
    kmbl.setVisible(false);  
    kmbl1.setVisible(false);
    lanjutlah.setVisible(false);
    lanjutlah1.setVisible(false);
    kriteriaLanjut.setVisible(false);  
    kriteriaLanjut1.setVisible(false);
    update.setVisible(false);  
    update1.setVisible(false);  
    tampilKriteria.setVisible(false);  
    tampilKriteria1.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); } 
    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]);}
    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); }}});  
    }}
    Alright, above are the smaller codes, please analyze them. Why do the setText not working? The user's inputs are not becoming the text of the JLabels?
  5. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    Why do the setText not working? The user's inputs are not becoming the text of the JLabels?
    Where are the calls to the println() method I suggested in many previous posts?
    You must add them to the code so you can see when and where the data is being assigned to variables and shown in the GUI.
    When you find a problem with the way specific lines of code works, post the code and your questions about it.
    Do not expect me to find the problem and fix it for you. You must find the problem and ask questions about specific lines of code.
  6. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Hallo, nilainya yaitu: [[Ljava.lang.String;@1ef7de4

    I got the above value when I use println to see the value of lblKriteria, why?

    This is the code:

    Code:
    package programtesisbaru;
    
    import javax.swing.*;
    
    /**
     *
     * @author Tawi
     */
    public class ProgramBaru extends Kuyakuya {
    JTextField[][]jawabKriteria = new JTextField [4][2];  
    JTextField[][] jawabAlternatif = new JTextField[5][2]; 
    JLabel[][] kriteria = new JLabel[4][2];  
    JLabel[][] alternatif = new JLabel[5][2];  
    String[][] passCriteriaVariables = new String[4][2];  
    String[][] passAlternativeVariables = new String[5][2]; 
    JButton lanjut = new JButton("Lanjut");
    JLabel myocardialInfarction = new JLabel("Myocardial Infarction");  
    JLabel stroke = new JLabel("Stroke");  
    public ProgramBaru() {
    setLayout(null);
              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); }}
              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);
              myocardialInfarction.setBounds(0,90,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);  
              add(myocardialInfarction);
              add(stroke);
              
    lanjut.addActionListener(new java.awt.event.ActionListener() {  
          @Override  
          public void actionPerformed(java.awt.event.ActionEvent evt) {kontinu(); }  
          private void kontinu() {   
              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;
              System.out.println("Hallo, nilainya yaitu: " + lblKriteria);
              System.out.println("Ya, ini nilainya yaitu: " +lblAlternatif);
              myocardialInfarction.setBounds(0,60,200,25);
              lanjut.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); }}             
              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); }});
    }
    public static void main(String[] args) {  
            ProgramBaru coba = new ProgramBaru();   
            coba.setTitle("Program Pemilihan Obat dengan Cara Analytic Hierarchycal Process");  
            coba.setSize(1024,768);  
            coba.setVisible(true);  
            coba.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            coba.setLocationRelativeTo(null); }
    }
  7. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    This is the other code just in case you need them.

    Code:
    package programtesisbaru;
    
    import javax.swing.*;
    
    /**
     *
     * @author Tawi
     */
    class Kuyakuya extends JFrame {
          String[][] lblKriteria = new String[4][2];  
          String[][] lblAlternatif = new String[5][2]; 
          JLabel[][] labelLuarKriteria = new JLabel[4][2];  
          JLabel[][] labelLuarAlternatif = new JLabel[5][2];  
          JLabel[][] labelLuarAlternatif1 = new JLabel[5][2];
          JLabel labelLuarKriteria1[][] = new JLabel[4][2];
          JButton kriteriaLanjut = new JButton("");  
          JButton kriteriaLanjut1 = new JButton("");
          JTextField[][] jawabKriteria1 = new JTextField[16][2];  
          JTextField[][] jawabAlternatif1 = new JTextField[25][2];
          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");  
          int xyz = 0;  
          int xyz1 = 0;
          String[][] variabelTampung = new String[100][2];  
    public Kuyakuya() {
        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]); }  
    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);  
    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);  
    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); 
    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); }  
    for (int mnjka = 0; mnjka < 16; mnjka++) {  
        add(jawabKriteria1[mnjka][0]);  
        jawabKriteria1[mnjka][0].setVisible(false);  
        add(jawabKriteria1[mnjka][1]);  
        jawabKriteria1[mnjka][1].setVisible(false); } 
    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 yul = 0; yul < 4; yul++) { 
        add(labelLuarKriteria[yul][0]);  
        add(labelLuarKriteria1[yul][0]); }  
    add(kmbl);  
    add(kmbl1);  
    add(kriteriaLanjut);  
    add(kriteriaLanjut1);  
    add(update);  
    add(update1);  
    add(tampilKriteria);  
    add(tampilKriteria1); 
    kmbl.setVisible(false);  
    kmbl1.setVisible(false);
    lanjutlah.setVisible(false);
    lanjutlah1.setVisible(false);
    kriteriaLanjut.setVisible(false);  
    kriteriaLanjut1.setVisible(false);
    update.setVisible(false);  
    update1.setVisible(false);  
    tampilKriteria.setVisible(false);  
    tampilKriteria1.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); } 
    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]);}
    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); }}});  
    }}
  8. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    [[Ljava.lang.String;@1ef7de4
    That is the String that is returned by the toString() method of a two dimensional array.
    If you want to see the full contents of a two dim array, use the Arrays class's deepToString() method:
    Code:
    System.out.println("an ID "+ java.util.Arrays.deepToString(theArrayName));
    Did you print out a message for when the follow events happen?
    1)get text from textfield into StringVar1
    2)assign StringVar1 to StringVar2
    3)set text of textfield from StringVar2

    In What order were the messages printed out?

    use println to see the value of lblKriteria
    For testing this problem you do not need to see the full contents of the array.
    Just print the value of the first element in the array and make sure the user enters a value in the first element so its progress through the code can be tracked.
  9. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Code:
    package programtesisbaru;
    
    /**
     *
     * @author Tawi
     */
    import javax.swing.*;
    
    public class NewClass extends Gula {
        JLabel merit = new JLabel("Coba tik kata: ");
        JLabel meritlah = new JLabel("Tik juga pada tempat ini: ");
        JTextField[][] isi = new JTextField[2][2];
        String[][] passCriteriaVariables = new String[2][2];
        JButton lanjut = new JButton();
        
    public NewClass() {
        setLayout(null);
        merit.setBounds(1,10,100,25);
        meritlah.setBounds(10,10,100,25);
        add(merit);
        add(meritlah);
        for (int jitak = 0; jitak < isi.length; jitak++){
            for (int tak = 0; tak < isi[tak].length; tak++) {
             isi[jitak][tak] = new JTextField(10);
            }
        }
        for (int jitaka = 0; jitaka < isi.length; jitaka++){
            for (int taka = 0; taka < isi[taka].length; taka++) {
             add(isi[jitaka][taka]);
            }
        }
        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 < 2; aijkl++) {for (int aikjl = 0; aikjl < 2; aikjl++) {passCriteriaVariables[aijkl][aikjl] = isi[aijkl][aikjl].getText();  }}
        isi[0][0].setBounds(1,111,100,25);
        isi[0][1].setBounds(1,211,100,25);
        isi[1][0].setBounds(10,111,100,25);
        isi[1][1].setBounds(10,211,100,25);
        test = passCriteriaVariables;
        lanjut.setBounds(20,100, 100,25);
        add(lanjut);
        lanjut.addActionListener(new java.awt.event.ActionListener() {  
          @Override  
          public void actionPerformed(java.awt.event.ActionEvent evt) {
             for (int intele = 0; intele < tampung.length; intele++) {for (int insidee = 0; insidee < tampung[intele].length; insidee++) {tampung[intele][insidee].setVisible(true); }}
             for (int intelaf = 0; intelaf < apasaja.length; intelaf++) {for (int insideaf = 0; insideaf < apasaja[intelaf].length; insideaf++) {apasaja[intelaf][insideaf].setVisible(true); }}      
             lanjut.setVisible(false);
          }
        });
    }
    public static void main(String[] args) {  
            NewClass coba = new NewClass();   
            coba.setTitle("Program Pemilihan Obat dengan Cara Analytic Hierarchycal Process");  
            coba.setSize(1024,768);  
            coba.setVisible(true);  
            coba.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            coba.setLocationRelativeTo(null); }
    }
    Code:
    package programtesisbaru;
    
    /**
     *
     * @author Tawi
     */
    import javax.swing.*;
    
    class Gula extends JFrame {
        JLabel[][] tampung = new JLabel[2][2];
        JTextField[][] apasaja = new JTextField[2][2];
        String[][] test = new String[2][2];
        
    public Gula() {
        for (int ijka = 0; ijka < test.length; ijka++) {for (int ikja = 0; ikja < test[ijka].length; ikja++) {test[ijka][ikja] = new String(); }}
        for (int intel = 0; intel < tampung.length; intel++) {for (int inside = 0; inside < tampung[intel].length; inside++) {
            tampung[intel][inside] = new JLabel(); 
            add(tampung[intel][inside]);}}
        for (int intela = 0; intela < apasaja.length; intela++) {for (int insidea = 0; insidea < apasaja[intela].length; insidea++) {
            apasaja[intela][insidea] = new JTextField(); 
            add(apasaja[intela][insidea]);}}
        tampung[0][0].setBounds(10, 101, 100, 25);
        tampung[0][1].setBounds(10, 211, 100, 25);
        tampung[1][0].setBounds(36, 1, 100, 25);
        tampung[1][1].setBounds(61, 1, 100, 25);
        tampung[0][0].setText(test[0][0]);
        tampung[0][1].setText(test[0][1]);
        tampung[1][0].setText(test[1][0]);
        tampung[1][1].setText(test[1][1]);
        apasaja[0][0].setBounds(36, 101, 100, 25);
        apasaja[0][1].setBounds(36, 211, 100, 25);
        apasaja[1][0].setBounds(61, 101, 100, 25);
        apasaja[1][1].setBounds(61, 211, 100, 25);
        for (int intele = 0; intele < tampung.length; intele++) {for (int insidee = 0; insidee < tampung[intele].length; insidee++) {tampung[intele][insidee].setVisible(false); }}
        for (int intelaf = 0; intelaf < apasaja.length; intelaf++) {for (int insideaf = 0; insideaf < apasaja[intelaf].length; insideaf++) {apasaja[intelaf][insideaf].setVisible(false); }}   
    }
    }
    Why do I get these error messages:
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
    at programtesisbaru.NewClass.<init>(NewClass.java:23)
    at programtesisbaru.NewClass.main(NewClass.java:51)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 1 second)?

    Please explain because I try to seek the mistakes but I fail.
  10. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    Why do I get these error messages:
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
    at programtesisbaru.NewClass.<init>(NewClass.java:23)
    At line 23 in NewClass the index to the array is past the end of the array.
    Indexes to arrays range in value from 0 to the length of the array -1.
    If the array has 2 elements, then an index of 2 will be past the end of the array because the valid indexes are 0 and 1.
  11. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    That is the String that is returned by the toString() method of a two dimensional array.
    If you want to see the full contents of a two dim array, use the Arrays class's deepToString() method:
    Code:
    System.out.println("an ID "+ java.util.Arrays.deepToString(theArrayName));
    Did you print out a message for when the follow events happen?
    1)get text from textfield into StringVar1
    2)assign StringVar1 to StringVar2
    3)set text of textfield from StringVar2

    In What order were the messages printed out?


    For testing this problem you do not need to see the full contents of the array.
    Just print the value of the first element in the array and make sure the user enters a value in the first element so its progress through the code can be tracked.
    Alright, how to assign the value that is read by deeptoString to a variable with array?
  12. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    how to assign the value that is read by deeptoString to a variable with array?
    The method: deeptoString() is for helping the debugging of code by formatting the contents of two dim arrays for printing out the contents of two dimensional arrays.
    I don't understand what else you are trying to use that method for.
    deepToString() returns a String showing the array's contents.

    Can you explain what you are trying to do?
  13. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    The method: deeptoString() is for helping the debugging of code by formatting the contents of two dim arrays for printing out the contents of two dimensional arrays.
    I don't understand what else you are trying to use that method for.
    deepToString() returns a String showing the array's contents.

    Can you explain what you are trying to do?
    I want to use the text that is read from a getText() method to setText a JLabel, how to do that?
  14. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    I want to use the text that is read from a getText() method to setText a JLabel,
    Do the following steps in this order shown:
    1)get text from textfield into StringVar
    2)set text of JLabel from StringVar

    Don't do step 2 before step 1.
  15. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Do the following steps in this order shown:
    1)get text from textfield into StringVar
    2)set text of JLabel from StringVar

    Don't do step 2 before step 1.
    Ok, problem is solved. The other problem is how to make a button and a JLabel to update the text that is shown by them?

IMN logo majestic logo threadwatch logo seochat tools logo