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

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    What statement makes that message appear? Is there a variable that determines if that statement will be executed? Where is the variable given the value that causes the message to be shown?

    For example:
    Code:
    if(xyz == 123) {
       //  here we show the message
    }
    In the above code, the message is shown when the variable: xyz has the value of 123. To keep the message from being shown, the value of xyz needs to be different from 123.
    The thing that I know is I set this:

    Code:
    for (int celt = 0; celta < lblPerhitunganKriteria.length; celt++) {lblPerhitunganKriteria[celt].setVisible(false);
    at the beginning and set this:

    Code:
    for (int celta = 0; celta < lblPerhitunganKriteria.length; celta++) {lblPerhitunganKriteria[celta].setVisible(true);
    after the user click the lanjut button, so? What solution can you give me?
  2. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    Where is the message that is the problem coming from? When I search ALL the code in the project I see that it is used in several places. Which one is the one that is being shown?
    To see which one, make the text in all of them different by adding a number to the text: " Perhitungan Kriteria1" and "Perhitungan Kriteria2" etc
    Then when the message is shown, you will know which one is being shown and can the look at the code that is showing it.
  3. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Where is the message that is the problem coming from? When I search ALL the code in the project I see that it is used in several places. Which one is the one that is being shown?
    To see which one, make the text in all of them different by adding a number to the text: " Perhitungan Kriteria1" and "Perhitungan Kriteria2" etc
    Then when the message is shown, you will know which one is being shown and can the look at the code that is showing it.
    I think I only set two, one true and one false, which one else do you see?
  4. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    Do a search through all the code for the String: Perhitungan Kriteria ?
    If you only find one, change it (add XXX at the end of it) so you can see it it is the one being used or if there is another one being used from somewhere else.

    When I search on this page in the forum for that String I see that it occurs 16 times.
  5. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Do a search through all the code for the String: Perhitungan Kriteria ?
    If you only find one, change it (add XXX at the end of it) so you can see it it is the one being used or if there is another one being used from somewhere else.

    When I search on this page in the forum for that String I see that it occurs 16 times.
    You probably see it as a JButton. I mean the Perhitungan Kriteria as a JLabel, how many do you see? I only create two. Which one else?
  6. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    Did you try changing the text to see if you are looking at the correct component?
  7. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Did you try changing the text to see if you are looking at the correct component?
    Yes, but nothing is happening. I get one question which is why does the button not changing? I add one of perhitunganKriteria or perhitunganKriteria1 JButton in FrameBaru. Why do both of them show up? How to eliminate the JLabel one at the beginning of my code?
    Last edited by Tawijakarta; July 9th, 2013 at 01:18 PM.
  8. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    nothing is happening.
    If you changed the value of the text and nothing in the display changed, that means that the text being displayed is coming from somewhere else. You need to find where the text that you don't want displayed is coming from and make some changes there.

    The way the posted code positions and controls the display of components like labels and button is very, very, very messed up and hard to understand.
    I have not looked at it in detail or tried to understand it. It is too ugly.
  9. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    If you changed the value of the text and nothing in the display changed, that means that the text being displayed is coming from somewhere else. You need to find where the text that you don't want displayed is coming from and make some changes there.

    The way the posted code positions and controls the display of components like labels and button is very, very, very messed up and hard to understand.
    I have not looked at it in detail or tried to understand it. It is too ugly.
    I have one big question for you. I changed the perhitunganKriteria1 button to

    Code:
    perhitunganKriteria1.setBounds(506,430,200,25);
    but nothing is happening, what should I do?
  10. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    One suggestion I have is that you use better layout control for the components in the program. Look at using the CardLayout class to allow there to be different components shown at different times in the program's execution.
    The first card's showing would be for the login. Then swap to another card to show the various textfields and labels for the next phase of the program's execution.

    Using the setVisible() method to control when a component is shown makes for code that is hard to understand and maintain.

    nothing is happening, what should I do?
    What is supposed to happen? How do you know that it is happening or not?
    What do you see that shows that nothing is happening?
    What do you expect to see?
    What would be different if that statement was executed?
    Last edited by NormR; July 12th, 2013 at 09:29 AM.
  11. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    One suggestion I have is that you use better layout control for the components in the program. Look at using the CardLayout class to allow there to be different components shown at different times in the program's execution.
    The first card's showing would be for the login. Then swap to another card to show the various textfields and labels for the next phase of the program's execution.

    Using the setVisible() method to control when a component is shown makes for code that is hard to understand and maintain.


    What is supposed to happen? How do you know that it is happening or not?
    What do you see that shows that nothing is happening?
    What do you expect to see?
    What would be different if that statement was executed?
    I am trying to find the best place for that component. With that code, I am trying to move the component and testing it. If I make a correct effort, the component should be placed in a wrong place and after that I will change the place until it is placed in a correct place because I add one of them but not both of them. What should I do?
  12. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    What should I do?
    Make a small, simple version of the program that compiles, executes and shows the problem. Post the code for the simple program here and add some explanations to it that explain what the problem is: What does the code do and what do you want it to do differently.
  13. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Make a small, simple version of the program that compiles, executes and shows the problem. Post the code for the simple program here and add some explanations to it that explain what the problem is: What does the code do and what do you want it to do differently.
    I do not know how to make it. After I created the small one, the Perhitungan Kriteria text still exist. What should I do? Is that not simple enough? It is only about 400+ lines.
  14. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    A test program with 400 lines that shows the problem would be Ok.
    Post it and explain the problem.
  15. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Code:
    package programtesisbaru;
    
    import java.sql.*;   
    import javax.swing.*;
    
    /**
     *
     * @author Tawi
     */
    public class NewProgramTesisBaru extends FrameBaru { 
    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;  
    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");  
    JLabel[] lblPerhitunganKriteria = new JLabel[2];
    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 NewProgramTesisBaru() {
    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 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);  
    for (int celt = 0; celt < 2; celt++) {lblPerhitunganKriteria[celt].setVisible(false); }
    tampilKriteria.setVisible(false);  
    tampilKriteria1.setVisible(false);  
    ubah.setVisible(false);  
    kembali.setVisible(false);  
    lanjutlah.setVisible(false);  
    lanjutlah1.setVisible(false);  
    perhitunganKriteria.setVisible(false);  
    perhitunganKriteria1.setVisible(false);  
    kmbl.setVisible(false);  
    kmbl1.setVisible(false);  
    update.setVisible(false);  
    update1.setVisible(false);  
    myocardInfarc.setVisible(false);  
    stroke1.setVisible(false);  
    for (int hklma = 0; hklma < jawabKriteria1.length; hklma++) {for (int nyola = 0; nyola < jawabKriteria1[hklma].length; nyola++) {jawabKriteria1[hklma][nyola].setVisible(false); }}  
    for (int hklma = 0; hklma < jawabAlternatif1.length; hklma++) {for (int nyola = 0; nyola < jawabAlternatif1[hklma].length; nyola++) {jawabAlternatif1[hklma][nyola].setVisible(false); }}  
    for (int hklma = 0; hklma < labelLuarKriteria.length; hklma++) {for (int nyola = 0; nyola < labelLuarKriteria[hklma].length; nyola++) {labelLuarKriteria[hklma][nyola].setVisible(false); }}  
    for (int hklma = 0; hklma < labelLuarAlternatif.length; hklma++) {for (int nyola = 0; nyola < labelLuarAlternatif[hklma].length; nyola++) {labelLuarAlternatif[hklma][nyola].setVisible(false); }}  
    for (int hklma = 0; hklma < labelLuarAlternatif1.length; hklma++) {for (int nyola = 0; nyola < labelLuarAlternatif1[hklma].length; nyola++) {labelLuarAlternatif1[hklma][nyola].setVisible(false); }}  
    for (int hklm = 0; hklm < labelLuarKriteria1.length; hklm++) {for (int nyol = 0; nyol < labelLuarKriteria1[hklm].length; nyol++) {labelLuarKriteria1[hklm][nyol].setVisible(false); }}  
    kriteriaLanjut.setVisible(false);  
    kriteriaLanjut1.setVisible(false);
    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());
                    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) {  
            NewProgramTesisBaru tesis = new NewProgramTesisBaru();   
            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); }}

IMN logo majestic logo threadwatch logo seochat tools logo