コード例 #1
0
ファイル: LoginUser.java プロジェクト: ustadho/toko-ndeso
  private void formWindowOpened(
      java.awt.event.WindowEvent evt) { // GEN-FIRST:event_formWindowOpened
    // image/Login.jpg
    // String fileImage="image/Login.jpg";
    //   LabelIcon(fileImage,jLabel8);
    //        try {
    //            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    //        } catch (Exception e) {}
    // SystemConfig sc=new SystemConfig();

    conn =
        new KasirCon(
            "jdbc:postgresql://" + sc.getServerLoc() + ":5432/" + sc.getDBName(),
            "postgres",
            "bismillah",
            this);
    // conn = new KasirCon("jdbc:postgresql://"+sc.getServerLoc()+":5432/"+sc.getDBName(), "joss",
    // "123", this);

    if (conn.gettErrLog() == true) {
      con = conn.getCon();
    }
    txtKasir.addFocusListener(txtFoculListener);
    txtPass.addFocusListener(txtFoculListener);

    i = pBar.getX();
    timer = new Timer();
    timer.schedule(new DoTick(), 0, 5);
    java.text.SimpleDateFormat fdate2 = new java.text.SimpleDateFormat("HH:mm");

    Date jamNow = Calendar.getInstance().getTime();
    System.out.println("JAM: " + fdate2.format(jamNow.getTime()));

    // this.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    // this.setExtendedState(MAXIMIZED_BOTH);

    //        try{
    //            Statement st=con.createStatement();
    //            ResultSet rs=st.executeQuery("select kode_resort, coalesce(nama_resort, '') as
    // nama_resort from m_Resort");
    //
    //            lstModel.removeAllElements();
    //
    //            int idx=0;
    //            lstModel.add(idx, "");
    //            cmbGudang.addItem("<Semua Resort>");
    //            idx++;
    //
    //            while(rs.next()){
    //                cmbGudang.addItem(rs.getString("nama_resort"));
    //                lstModel.add(idx, rs.getString("kode_resort"));
    //
    //                idx++;
    //            }
    //
    //        }catch(SQLException se){
    //            JOptionPane.showMessageDialog(this, se.getMessage());
    //        }
  } // GEN-LAST:event_formWindowOpened
コード例 #2
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    String str = "";
    String str1;
    java.text.SimpleDateFormat fmt = new java.text.SimpleDateFormat("dd-MM-yyyy");
    String formattedDate = fmt.format(jDateChooser1.getDate());
    if (jRadioButton1.isSelected()) str = jRadioButton1.getText();
    if (jRadioButton2.isSelected()) str = jRadioButton2.getText();
    if (jRadioButton3.isSelected()) str = jRadioButton3.getText();
    if (jRadioButton4.isSelected()) str = jRadioButton4.getText();
    if (jRadioButton5.isSelected()) str = jRadioButton5.getText();
    if (jRadioButton6.isSelected()) str = jRadioButton6.getText();
    /*   if(formattedDate.compareTo(str)==0)
    {
        information.setText("Un booked");
    }
    else
       information.setText(str);*/
    try {
      res = st.executeQuery("select * from Booking where Event_date='" + formattedDate + "'");
      if (res.next()) { // txtroll.setText(res.getString(0));
        // jTextField1.setText(res.getString(6));
        // jTextField1.setText(res.getString(6));
        // jTextField1.setText(res.getString(7));
        str1 = res.getString(7);
        if (formattedDate.compareTo(res.getString(6)) == 0) {
          if (str1.compareTo("A-2") == 0) jRadioButton1.setVisible(false);
          else jRadioButton1.setVisible(true);
          if (str1.compareTo("A-11") == 0) jRadioButton2.setVisible(false);
          else jRadioButton2.setVisible(true);
          if (str1.compareTo("A-12") == 0) jRadioButton3.setVisible(false);
          else jRadioButton3.setVisible(true);
          if (str1.compareTo("A-13") == 0) jRadioButton4.setVisible(false);
          else jRadioButton4.setVisible(true);
          if (str1.compareTo("EEE-Auditorium") == 0) jRadioButton5.setVisible(false);
          else jRadioButton5.setVisible(true);
          if (str1.compareTo("Barn") == 0) jRadioButton6.setVisible(false);
          else jRadioButton6.setVisible(true);
          // repaint();
        }
        // str1=res.getString(6).toString();
        // jTextField1.setText(str1);
        // javax.swing.JOptionPane.showMessageDialog(null,"Invalid.....");
        // jRadioButton3.setVisible(false);

        // txtcontact.setText(res.getString(12));

      } else {
        jRadioButton1.setVisible(true);
        jRadioButton2.setVisible(true);
        jRadioButton3.setVisible(true);
        jRadioButton4.setVisible(true);
        jRadioButton5.setVisible(true);
        jRadioButton6.setVisible(true);
      }
    } catch (Exception e) {
      javax.swing.JOptionPane.showMessageDialog(null, e.toString());
    }
    str1 = formattedDate;
  } // GEN-LAST:event_jButton1ActionPerformed