Results 1 to 11 of 11
  1. #1
    habiler is offline Member
    Join Date
    Sep 2016
    Posts
    44
    Rep Power
    0

    Default Using the return value of a class in another class

    Hello everybody,

    How can i return the value of gap in nbOfMonthsBetweenTwoDates into the jTextField txtMois.
    For DateDebut and DateFin i use the value of twp JdtateChooser DateDebut and dateFin.
    I find no example for this one.

    thanks for all

    Habiler

    Java Code:
        private void txtMoisActionPerformed(ActionEvent e) throws SQLException {
                nbOfMonthsBetweenTwoDates nbr1mois = new nbOfMonthsBetweenTwoDates(DateDebut,dateFin);
                
          }


    Java Code:
    package decisions;
    
    import com.toedter.calendar.JDateChooser;
    import java.sql.Date;
    import java.text.SimpleDateFormat;
    import java.util.GregorianCalendar;
    
    publc class nbOfMonthsBetweenTwoDates {
    
        nbOfMonthsBetweenTwoDates(JDateChooser DateDebut, JDateChooser DateFin) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    
        nbOfMonthsBetweenTwoDates() {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    
        nbOfMonthsBetweenTwoDates(Date deb, Date fin) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
      public int nbOfMonthsBetweenTwoDates(String dateDebut, String dateFin) throws Exception  {
            SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
            Date date1 = (Date) sdf.parse(dateDebut);
            GregorianCalendar gc1 = new GregorianCalendar();
            gc1.setTime(date1);
            Date date2 = (Date) sdf.parse(dateFin);
            GregorianCalendar gc2 = new GregorianCalendar();
            gc2.setTime(date2);
            int gap = 0;
            gc1.add(GregorianCalendar.MONTH, 1);
            while(gc1.compareTo(gc2)<=0) {
                gap++;
                gc1.add(GregorianCalendar.MONTH, 1);
            }
            return gap;                
             }
    }

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,904
    Rep Power
    30

    Default Re: Using the return value of a class in another class

    return the value of gap in nbOfMonthsBetweenTwoDates into the jTextField txtMois.
    Compute the value you want in the textfield and use one of the methods of the class that txtMois is an instance of to give it the value.
    See the API doc for a list of the available methods: http://docs.oracle.com/javase/8/docs/api/index.html
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    381
    Rep Power
    4

    Default Re: Using the return value of a class in another class

    Any reason why you use Java.sql.date rather than Java.util.date or even better Java.Date?

  4. #4
    habiler is offline Member
    Join Date
    Sep 2016
    Posts
    44
    Rep Power
    0

    Default Re: Using the return value of a class in another class

    I trying to add the value into txtMois (Jtextfiled) but i have no reaction.


    public void txtMoisActionPerformed(ActionEvent e) {

    java.util.Date date1 = jDateChooserDateDebut.getDate();
    java.util.Date date2 = jDateChooserDateFin.getDate();
    long CONST_DURATION_OF_DAY = 1000l * 60 * 60 * 24;

    long diff = Math.abs(date2.getTime() - date1.getTime());
    long numberOfMonths = diff/CONST_DURATION_OF_DAY;
    txtMois.add(numberOfMonts, this);
    affiche ("txtMois" + numberOfMonths);
    }

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,904
    Rep Power
    30

    Default Re: Using the return value of a class in another class

    trying to add the value into txtMois
    The add() method is wrong for adding text to a JTextField. Use setText
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    habiler is offline Member
    Join Date
    Sep 2016
    Posts
    44
    Rep Power
    0

    Default Re: Using the return value of a class in another class

    I tryed with setText() but no result.

    Java Code:
        public void txtMoisActionPerformed(ActionEvent e) {
    
            java.util.Date date1 = jDateChooserDateDebut.getDate();
            java.util.Date date2 = jDateChooserDateFin.getDate();
            long CONST_DURATION_OF_DAY = 1000l * 60 * 60 * 24;
     
            long diff = Math.abs(date2.getTime() - date1.getTime());
            long numberOfMonths = diff/CONST_DURATION_OF_DAY;
            txtMois.setText()= numberOfMonths;
         
        }
    Java Code:
    package decisions;
    
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.event.ActionEvent;
    import java.beans.*;
    import java.sql.*;
    import javax.swing.*;
    import java.util.Calendar;
    import javax.swing.border.*;
    import com.toedter.calendar.*;
    import java.beans.PropertyChangeListener;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    
    
    public class AddDecisionFrame_ok1 extends JFrame {
    
        private static final long serialVersionUID = 1L;
    
    private Connection conn =null;
    private ResultSet rs = null;
    private PreparedStatement ps = null;
    private String numberOfMonts;
    
    
    
    public AddDecisionFrame_ok1() throws SQLException {
           
              initComponents();
             conn = Connect.ConnectDB();
            jDateChooserPostposeDebut.setVisible(false);
            jDateChooserPostposeFin.setVisible(false);
            jTextNom_Parent.setVisible(false);
    
            FilljCboTypeAbsence();
        
        }
       static Void affiche(String message) {
          System.out.println(message);
         return null;
       }
       private final static String newLine = "\n";
    
    @SuppressWarnings("empty-statement")
        private void jDateChooserDateFinPropertyChange(PropertyChangeEvent e) {
        NullPointerException exp;
        jDateChooserDateFin.addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(java.beans.PropertyChangeEvent evt1) {
                if (evt1.getPropertyName().equals("date")) {
                    if (jDateChooserDateDebut.getCalendar() == null) {
                        JOptionPane.showMessageDialog(null,
                                "La date de début est nulle !!!.",
                                " Avertissement", JOptionPane.WARNING_MESSAGE);;
                    } else
                        
                    {
                        if (jDateChooserDateFin.getCalendar().before(jDateChooserDateDebut.getCalendar()))
                        {
                            JOptionPane.showMessageDialog(null,
                                    "La date de début est "
                                            + "supérieure à la date de fin !!!.",
                                    " Avertissement", JOptionPane.WARNING_MESSAGE);;
                        } else
                            
                        {
                            System.out.println("bon d'accord ...");
                        }
                    } }
                {
                    Calendar sDate = Calendar.getInstance();
                    Calendar eDate = Calendar.getInstance();
                    sDate.setTime(jDateChooserDateFin.getDate());
                    eDate.setTime(jDateChooserDateDebut.getDate());
                    int difInMonths = sDate.get(Calendar.MONTH) - eDate.get(Calendar.MONTH);
                    JOptionPane.showMessageDialog(null,""+difInMonths+" mois","Nombre de mois !!!",JOptionPane.PLAIN_MESSAGE);
                    System.out.println(""+difInMonths+"");
                }
            }
        });   
        }
        
        private void jDateChooserPostposeFinPropertyChange(PropertyChangeEvent e) {
        NullPointerException exp;
         jDateChooserPostposeFin.addPropertyChangeListener(new PropertyChangeListener() {
                      @Override
                      public void propertyChange(java.beans.PropertyChangeEvent evt1) {
                          if (evt1.getPropertyName().equals("date")) {
                              if (jDateChooserPostposeDebut.getCalendar() == null) {
                                  JOptionPane.showMessageDialog(null,
                                          "La date de début est nulle !!!.",
                                          " Avertissement", JOptionPane.WARNING_MESSAGE);;
                              } else {
                                  if (jDateChooserPostposeFin.getCalendar().before(jDateChooserPostposeDebut.getCalendar())) {
                                      JOptionPane.showMessageDialog(null,
                                              "La date de début est inférieure à la date de fin !!!.",
                                              " Avertissement", JOptionPane.WARNING_MESSAGE);;
                                  } else {
                                      System.out.println("bon d'accord ...");
                                  }
                              }
                          }
                      }
                  });
          // TODO add your code here
        }
    
        private void jTxtNomPrenomActionPerformed(ActionEvent e) {
            // TODO add your code here
        }
    
        private void jTxtMatrFocusLost(FocusEvent e) {
                         PreparedStatement ps1;
                          PreparedStatement ps2;
                    Connection conn1 = Connect.ConnectDB();
                        
                try {   
                    String SQL1 = "SELECT * FROM Signaletique where Matricule = ?";
                        ps1 = conn1.prepareStatement(SQL1); 
                        ps1.setString(1,jTxtMatr.getText());  
                        ResultSet rs1 = ps1.executeQuery();
                        
                    String SQL2 = "SELECT * FROM Decisions where Matr = ?";
                        ps2 = conn1.prepareStatement(SQL2); 
                        ps2.setString(1,jTxtMatr.getText());  
                        ResultSet rs2 = ps2.executeQuery();
                
                while ( rs1.next()) {
                    String nomPrenom =  (rs1.getString(3) + " " + rs1.getString(4));    
                    jTxtNomPrenom.setText(nomPrenom);
                    JTextNomPrenom2.setText(rs1.getString(3) + " " + rs1.getString(4));
               }
                  while ( rs2.next()) {
                    String ListeSQL=  (rs2.getString(3) + " " + rs2.getString(4));    
                    textAreaSQL.append(ListeSQL + newLine);
                    
               }
                 
                getPs().close();
               
        }catch(SQLException ex){
            
            JOptionPane.showMessageDialog(null, e);
        }         
        }
    
        private void scrollPane1ComponentAdded(ContainerEvent e) {
            // TODO add your code here
        }
    
        private void btnNlActionPerformed(ActionEvent e) {
            jLabel3.setText("Stamnummer");
        }
    
        private void btnFrActionPerformed(ActionEvent e) {
           jLabel3.setText("Matricule");
        }
    
        public void txtMoisActionPerformed(ActionEvent e) {
    
            java.util.Date date1 = jDateChooserDateDebut.getDate();
            java.util.Date date2 = jDateChooserDateFin.getDate();
            long CONST_DURATION_OF_DAY = 1000l * 60 * 60 * 24;
     
            long diff = Math.abs(date2.getTime() - date1.getTime());
            long numberOfMonths = diff/CONST_DURATION_OF_DAY;
            txtMois.setText() = numberOfMonths ;
            affiche ("txtMois" + numberOfMonths);
        }
      
    public final void FilljCboTypeAbsence() {
        try{
            
           String sql = "SELECT Type FROM Typedossier";
                setPs(getConn().prepareStatement(sql));
                setRs(getPs().executeQuery());
            
            
            while (getRs().next()){
            jCboTypeAbsence.addItem(getRs().getString("Type"));    
            
                    }
         //   ps.close();
        }    catch(SQLException e) {
            
            JOptionPane.showMessageDialog(null, e);
        }
       
    }
    
        
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
        // Generated using JFormDesigner non-commercial license
        private void initComponents() {
            jLabel1 = new JLabel();
            CmdSave = new JButton();
            jLabel2 = new JLabel();
            TxtDecId = new JTextField();
            jLabel3 = new JLabel();
            jLabel4 = new JLabel();
            TxtNumero = new JTextField();
            jLabel5 = new JLabel();
            jLabel6 = new JLabel();
            jLabel7 = new JLabel();
            jTxtMatr = new JTextField();
            jLabel8 = new JLabel();
            jLabel9 = new JLabel();
            jCheckBoxRefus = new JCheckBox();
            jLabel10 = new JLabel();
            jCheckBox3 = new JCheckBox();
            jCheckBoxPostpose = new JCheckBox();
            jLabel12 = new JLabel();
            jCboPcActivity = new JComboBox<>();
            jCboTypeAbsence = new JComboBox<>();
            jCheckBoxVen1 = new JCheckBox();
            TxtId = new JTextField();
            jDateChooserDateDebut = new JDateChooser();
            jDateChooserDateFin = new JDateChooser();
            jCheckBoxLun1 = new JCheckBox();
            jCheckBoxMar1 = new JCheckBox();
            jCheckBoxMer1 = new JCheckBox();
            jCheckBoxJeu1 = new JCheckBox();
            jCheckBoxVen2 = new JCheckBox();
            jCheckBoxLun2 = new JCheckBox();
            jCheckBoxMar2 = new JCheckBox();
            jCheckBoxMer2 = new JCheckBox();
            jCheckBoxJeu2 = new JCheckBox();
            jScrollPane1 = new JScrollPane();
            jTextAreaRemarques = new JTextArea();
            jLabel11 = new JLabel();
            jCboFiliation = new JComboBox<>();
            jTextNom_Parent = new JTextField();
            jDateChooserDateDec = new JDateChooser();
            jDateChooserPostposeDebut = new JDateChooser();
            jDateChooserPostposeFin = new JDateChooser();
            panel1 = new JPanel();
            panel2 = new JPanel();
            jTxtNomPrenom = new JTextField();
            desktopPane1 = new JDesktopPane();
            toggleBtnFr = new JToggleButton();
            btnNl = new JToggleButton();
            scrollPane1 = new JScrollPane();
            textAreaSQL = new JTextArea();
            JTextNomPrenom2 = new JTextField();
            txtMois = new JTextField();
    
            //======== this ========
            setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            setTitle("A0");
            setBackground(new Color(102, 255, 204));
            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            Container contentPane = getContentPane();
            contentPane.setLayout(null);
    
            //---- jLabel1 ----
            jLabel1.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel1.setText("Id");
            contentPane.add(jLabel1);
            jLabel1.setBounds(25, 70, 95, jLabel1.getPreferredSize().height);
    
            //---- CmdSave ----
            CmdSave.setText("Save record");
            CmdSave.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    CmdSaveMouseClicked(e);
                }
            });
            contentPane.add(CmdSave);
            CmdSave.setBounds(new Rectangle(new Point(150, 475), CmdSave.getPreferredSize()));
    
            //---- jLabel2 ----
            jLabel2.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel2.setText("DecId");
            contentPane.add(jLabel2);
            jLabel2.setBounds(25, 90, jLabel2.getPreferredSize().width, 18);
            contentPane.add(TxtDecId);
            TxtDecId.setBounds(140, 90, 105, TxtDecId.getPreferredSize().height);
    
            //---- jLabel3 ----
            jLabel3.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel3.setText("Matricule");
            contentPane.add(jLabel3);
            jLabel3.setBounds(new Rectangle(new Point(20, 40), jLabel3.getPreferredSize()));
    
            //---- jLabel4 ----
            jLabel4.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel4.setText("Numero");
            contentPane.add(jLabel4);
            jLabel4.setBounds(24, 150, jLabel4.getPreferredSize().width, 18);
            contentPane.add(TxtNumero);
            TxtNumero.setBounds(140, 150, 100, TxtNumero.getPreferredSize().height);
    
            //---- jLabel5 ----
            jLabel5.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel5.setText("Date d\u00e9cision");
            contentPane.add(jLabel5);
            jLabel5.setBounds(new Rectangle(new Point(24, 119), jLabel5.getPreferredSize()));
    
            //---- jLabel6 ----
            jLabel6.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel6.setText("D\u00e9but de l'absence");
            contentPane.add(jLabel6);
            jLabel6.setBounds(20, 240, jLabel6.getPreferredSize().width, 20);
    
            //---- jLabel7 ----
            jLabel7.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel7.setText("Fin de l'absence");
            contentPane.add(jLabel7);
            jLabel7.setBounds(20, 270, 98, 20);
    
            //---- jTxtMatr ----
            jTxtMatr.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    jTxtMatrFocusLost(e);
                }
            });
            contentPane.add(jTxtMatr);
            jTxtMatr.setBounds(140, 35, 105, jTxtMatr.getPreferredSize().height);
    
            //---- jLabel8 ----
            jLabel8.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel8.setText("Pc d'activit\u00e9");
            contentPane.add(jLabel8);
            jLabel8.setBounds(18, 180, 110, 20);
    
            //---- jLabel9 ----
            jLabel9.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel9.setText("Type d'absence");
            contentPane.add(jLabel9);
            jLabel9.setBounds(20, 210, jLabel9.getPreferredSize().width, 20);
            contentPane.add(jCheckBoxRefus);
            jCheckBoxRefus.setBounds(new Rectangle(new Point(140, 300), jCheckBoxRefus.getPreferredSize()));
    
            //---- jLabel10 ----
            jLabel10.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel10.setText("Refus");
            contentPane.add(jLabel10);
            jLabel10.setBounds(20, 300, 100, 20);
            contentPane.add(jCheckBox3);
            jCheckBox3.setBounds(new Rectangle(new Point(140, 300), jCheckBox3.getPreferredSize()));
    
            //---- jCheckBoxPostpose ----
            jCheckBoxPostpose.addActionListener(e -> jCheckBoxPostposeActionPerformed(e));
            contentPane.add(jCheckBoxPostpose);
            jCheckBoxPostpose.setBounds(new Rectangle(new Point(140, 330), jCheckBoxPostpose.getPreferredSize()));
    
            //---- jLabel12 ----
            jLabel12.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel12.setText("Pospos\u00e9");
            jLabel12.setRequestFocusEnabled(false);
            contentPane.add(jLabel12);
            jLabel12.setBounds(new Rectangle(new Point(20, 330), jLabel12.getPreferredSize()));
    
            //---- jCboPcActivity ----
            jCboPcActivity.setModel(new DefaultComboBoxModel<>(new String[] {
                "0",
                "10",
                "20",
                "30",
                "40",
                "50",
                "60",
                "70",
                "85",
                "90",
                "100"
            }));
            jCboPcActivity.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            jCboPcActivity.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    jCboPcActivityFocusLost(e);
                }
            });
            contentPane.add(jCboPcActivity);
            jCboPcActivity.setBounds(140, 180, jCboPcActivity.getPreferredSize().width, 20);
    
            //---- jCboTypeAbsence ----
            jCboTypeAbsence.setSelectedIndex(-1);
            contentPane.add(jCboTypeAbsence);
            jCboTypeAbsence.setBounds(140, 210, 180, jCboTypeAbsence.getPreferredSize().height);
    
            //---- jCheckBoxVen1 ----
            jCheckBoxVen1.setText("Vendredi");
            jCheckBoxVen1.setIcon(new ImageIcon(getClass().getResource("/decisions/Oui.png")));
            jCheckBoxVen1.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/Non.png")));
            contentPane.add(jCheckBoxVen1);
            jCheckBoxVen1.setBounds(new Rectangle(new Point(390, 320), jCheckBoxVen1.getPreferredSize()));
            contentPane.add(TxtId);
            TxtId.setBounds(140, 65, 105, TxtId.getPreferredSize().height);
    
            //---- jDateChooserDateDebut ----
            jDateChooserDateDebut.setDateFormatString("dd/MM/yyyy");
            jDateChooserDateDebut.setFocusCycleRoot(true);
            jDateChooserDateDebut.setDate(null);
            jDateChooserDateDebut.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED));
            contentPane.add(jDateChooserDateDebut);
            jDateChooserDateDebut.setBounds(140, 240, 105, jDateChooserDateDebut.getPreferredSize().height);
    
            //---- jDateChooserDateFin ----
            jDateChooserDateFin.setDateFormatString("dd/MM/yyyy");
            jDateChooserDateFin.setFocusCycleRoot(true);
            jDateChooserDateFin.setBorder(new BevelBorder(BevelBorder.LOWERED));
            jDateChooserDateFin.setDate(null);
            jDateChooserDateFin.addPropertyChangeListener(e -> jDateChooserDateFinPropertyChange(e));
            contentPane.add(jDateChooserDateFin);
            jDateChooserDateFin.setBounds(140, 270, 105, jDateChooserDateFin.getPreferredSize().height);
    
            //---- jCheckBoxLun1 ----
            jCheckBoxLun1.setText("Lundi");
            jCheckBoxLun1.setIcon(new ImageIcon(getClass().getResource("/decisions/Oui.png")));
            jCheckBoxLun1.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/Non.png")));
            contentPane.add(jCheckBoxLun1);
            jCheckBoxLun1.setBounds(new Rectangle(new Point(390, 240), jCheckBoxLun1.getPreferredSize()));
    
            //---- jCheckBoxMar1 ----
            jCheckBoxMar1.setText("Mardi");
            jCheckBoxMar1.setIcon(new ImageIcon(getClass().getResource("/decisions/Oui.png")));
            jCheckBoxMar1.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/Non.png")));
            contentPane.add(jCheckBoxMar1);
            jCheckBoxMar1.setBounds(new Rectangle(new Point(390, 260), jCheckBoxMar1.getPreferredSize()));
    
            //---- jCheckBoxMer1 ----
            jCheckBoxMer1.setText("Mercredi");
            jCheckBoxMer1.setIcon(new ImageIcon(getClass().getResource("/decisions/Oui.png")));
            jCheckBoxMer1.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/Non.png")));
            contentPane.add(jCheckBoxMer1);
            jCheckBoxMer1.setBounds(new Rectangle(new Point(390, 280), jCheckBoxMer1.getPreferredSize()));
    
            //---- jCheckBoxJeu1 ----
            jCheckBoxJeu1.setText("Jeudi");
            jCheckBoxJeu1.setIcon(new ImageIcon(getClass().getResource("/decisions/Oui.png")));
            jCheckBoxJeu1.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/Non.png")));
            contentPane.add(jCheckBoxJeu1);
            jCheckBoxJeu1.setBounds(new Rectangle(new Point(390, 300), jCheckBoxJeu1.getPreferredSize()));
    
            //---- jCheckBoxVen2 ----
            jCheckBoxVen2.setText("Vendredi");
            jCheckBoxVen2.setIcon(new ImageIcon(getClass().getResource("/decisions/Oui.png")));
            jCheckBoxVen2.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/Non.png")));
            contentPane.add(jCheckBoxVen2);
            jCheckBoxVen2.setBounds(new Rectangle(new Point(470, 320), jCheckBoxVen2.getPreferredSize()));
    
            //---- jCheckBoxLun2 ----
            jCheckBoxLun2.setText("Lundi");
            jCheckBoxLun2.setIcon(new ImageIcon(getClass().getResource("/decisions/Oui.png")));
            jCheckBoxLun2.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/Non.png")));
            contentPane.add(jCheckBoxLun2);
            jCheckBoxLun2.setBounds(new Rectangle(new Point(470, 240), jCheckBoxLun2.getPreferredSize()));
    
            //---- jCheckBoxMar2 ----
            jCheckBoxMar2.setText("Mardi");
            jCheckBoxMar2.setIcon(new ImageIcon(getClass().getResource("/decisions/Oui.png")));
            jCheckBoxMar2.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/Non.png")));
            contentPane.add(jCheckBoxMar2);
            jCheckBoxMar2.setBounds(new Rectangle(new Point(470, 260), jCheckBoxMar2.getPreferredSize()));
    
            //---- jCheckBoxMer2 ----
            jCheckBoxMer2.setText("Mercredi");
            jCheckBoxMer2.setIcon(new ImageIcon(getClass().getResource("/decisions/Oui.png")));
            jCheckBoxMer2.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/Non.png")));
            contentPane.add(jCheckBoxMer2);
            jCheckBoxMer2.setBounds(new Rectangle(new Point(470, 280), jCheckBoxMer2.getPreferredSize()));
    
            //---- jCheckBoxJeu2 ----
            jCheckBoxJeu2.setText("Jeudi");
            jCheckBoxJeu2.setIcon(new ImageIcon(getClass().getResource("/decisions/Oui.png")));
            jCheckBoxJeu2.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/Non.png")));
            contentPane.add(jCheckBoxJeu2);
            jCheckBoxJeu2.setBounds(new Rectangle(new Point(470, 300), jCheckBoxJeu2.getPreferredSize()));
    
            //======== jScrollPane1 ========
            {
    
                //---- jTextAreaRemarques ----
                jTextAreaRemarques.setColumns(20);
                jTextAreaRemarques.setFont(new Font("Cambria", Font.PLAIN, 11));
                jTextAreaRemarques.setLineWrap(true);
                jTextAreaRemarques.setRows(5);
                jTextAreaRemarques.setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
                jScrollPane1.setViewportView(jTextAreaRemarques);
            }
            contentPane.add(jScrollPane1);
            jScrollPane1.setBounds(150, 390, 405, jScrollPane1.getPreferredSize().height);
    
            //---- jLabel11 ----
            jLabel11.setFont(new Font("Times New Roman", Font.BOLD, 11));
            jLabel11.setText("Remarques :");
            contentPane.add(jLabel11);
            jLabel11.setBounds(21, 390, 70, jLabel11.getPreferredSize().height);
    
            //---- jCboFiliation ----
            jCboFiliation.setModel(new DefaultComboBoxModel<>(new String[] {
                "<None>",
                "Fils",
                "Fille",
                "P\u00e8re",
                "M\u00e8re",
                "Fr\u00e8re",
                "Soeur",
                "Beau-p\u00e8re",
                "Belle-m\u00e8re"
            }));
            jCboFiliation.addActionListener(e -> jCboFiliationActionPerformed(e));
            contentPane.add(jCboFiliation);
            jCboFiliation.setBounds(330, 210, 100, jCboFiliation.getPreferredSize().height);
            contentPane.add(jTextNom_Parent);
            jTextNom_Parent.setBounds(440, 210, 160, jTextNom_Parent.getPreferredSize().height);
    
            //---- jDateChooserDateDec ----
            jDateChooserDateDec.setDateFormatString("dd/MM/yyyy");
            jDateChooserDateDec.setFocusCycleRoot(true);
            jDateChooserDateDec.setBorder(new BevelBorder(BevelBorder.LOWERED));
            jDateChooserDateDec.setMaxSelectableDate(new java.util.Date(253370764880000L));
            jDateChooserDateDec.setDate(null);
            contentPane.add(jDateChooserDateDec);
            jDateChooserDateDec.setBounds(140, 120, 105, jDateChooserDateDec.getPreferredSize().height);
    
            //---- jDateChooserPostposeDebut ----
            jDateChooserPostposeDebut.setDateFormatString("dd/MM/yyyy");
            jDateChooserPostposeDebut.setFocusCycleRoot(true);
            jDateChooserPostposeDebut.setBorder(new BevelBorder(BevelBorder.LOWERED));
            jDateChooserPostposeDebut.setDate(null);
            contentPane.add(jDateChooserPostposeDebut);
            jDateChooserPostposeDebut.setBounds(new Rectangle(new Point(160, 330), jDateChooserPostposeDebut.getPreferredSize()));
    
            //---- jDateChooserPostposeFin ----
            jDateChooserPostposeFin.setDateFormatString("dd/MM/yyyy");
            jDateChooserPostposeFin.setFocusCycleRoot(true);
            jDateChooserPostposeFin.setBorder(new BevelBorder(BevelBorder.LOWERED));
            jDateChooserPostposeFin.setDate(null);
            jDateChooserPostposeFin.setMinimumSize(new Dimension(91, 24));
            jDateChooserPostposeFin.addPropertyChangeListener(e -> jDateChooserPostposeFinPropertyChange(e));
            contentPane.add(jDateChooserPostposeFin);
            jDateChooserPostposeFin.setBounds(265, 330, jDateChooserPostposeFin.getPreferredSize().width, 25);
    
            //======== panel1 ========
            {
                panel1.setLayout(null);
    
                //======== panel2 ========
                {
                    panel2.setLayout(null);
    
                    //---- jTxtNomPrenom ----
                    jTxtNomPrenom.setBackground(UIManager.getColor("Button.background"));
                    jTxtNomPrenom.setEditable(false);
                    jTxtNomPrenom.setBorder(null);
                    jTxtNomPrenom.addActionListener(e -> jTxtNomPrenomActionPerformed(e));
                    panel2.add(jTxtNomPrenom);
                    jTxtNomPrenom.setBounds(20, 0, 210, 20);
    
                    { // compute preferred size
                        Dimension preferredSize = new Dimension();
                        for(int i = 0; i < panel2.getComponentCount(); i++) {
                            Rectangle bounds = panel2.getComponent(i).getBounds();
                            preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                            preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                        }
                        Insets insets = panel2.getInsets();
                        preferredSize.width += insets.right;
                        preferredSize.height += insets.bottom;
                        panel2.setMinimumSize(preferredSize);
                        panel2.setPreferredSize(preferredSize);
                    }
                }
                panel1.add(panel2);
                panel2.setBounds(new Rectangle(new Point(0, 0), panel2.getPreferredSize()));
    
                { // compute preferred size
                    Dimension preferredSize = new Dimension();
                    for(int i = 0; i < panel1.getComponentCount(); i++) {
                        Rectangle bounds = panel1.getComponent(i).getBounds();
                        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                    }
                    Insets insets = panel1.getInsets();
                    preferredSize.width += insets.right;
                    preferredSize.height += insets.bottom;
                    panel1.setMinimumSize(preferredSize);
                    panel1.setPreferredSize(preferredSize);
                }
            }
            contentPane.add(panel1);
            panel1.setBounds(new Rectangle(new Point(240, 35), panel1.getPreferredSize()));
            contentPane.add(desktopPane1);
            desktopPane1.setBounds(new Rectangle(new Point(1090, 280), desktopPane1.getPreferredSize()));
    
            //---- toggleBtnFr ----
            toggleBtnFr.setText("Fr");
            toggleBtnFr.setIcon(new ImageIcon(getClass().getResource("/decisions/french.png")));
            toggleBtnFr.setBorder(null);
            toggleBtnFr.addActionListener(e -> btnFrActionPerformed(e));
            contentPane.add(toggleBtnFr);
            toggleBtnFr.setBounds(20, 5, 55, toggleBtnFr.getPreferredSize().height);
    
            //---- btnNl ----
            btnNl.setText("Nl");
            btnNl.setSelectedIcon(new ImageIcon(getClass().getResource("/decisions/dutch.png")));
            btnNl.setIcon(new ImageIcon(getClass().getResource("/decisions/dutch.png")));
            btnNl.setBorder(null);
            btnNl.addActionListener(e -> btnNlActionPerformed(e));
            contentPane.add(btnNl);
            btnNl.setBounds(75, 5, 70, btnNl.getPreferredSize().height);
    
            //======== scrollPane1 ========
            {
                scrollPane1.setBorder(null);
                scrollPane1.addContainerListener(new ContainerAdapter() {
                    @Override
                    public void componentAdded(ContainerEvent e) {
                        scrollPane1ComponentAdded(e);
                    }
                });
                scrollPane1.setViewportView(textAreaSQL);
            }
            contentPane.add(scrollPane1);
            scrollPane1.setBounds(605, 150, 460, 285);
            contentPane.add(JTextNomPrenom2);
            JTextNomPrenom2.setBounds(615, 100, 255, JTextNomPrenom2.getPreferredSize().height);
    
            //---- txtMois ----
            txtMois.addActionListener(e -> txtMoisActionPerformed(e));
            contentPane.add(txtMois);
            txtMois.setBounds(265, 275, 95, txtMois.getPreferredSize().height);
    
            { // compute preferred size
                Dimension preferredSize = new Dimension();
                for(int i = 0; i < contentPane.getComponentCount(); i++) {
                    Rectangle bounds = contentPane.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = contentPane.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                contentPane.setMinimumSize(preferredSize);
                contentPane.setPreferredSize(preferredSize);
            }
            pack();
            setLocationRelativeTo(getOwner());
        }// </editor-fold>//GEN-END:initComponents
    
        
        private void CmdSaveMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CmdSaveMouseClicked
        NullPointerException exp;
            setConn(Connect.ConnectDB());
    try{
      
    String sql = "Insert INTO Decisions (Id,DecId,Matr,Datedec,Numero,Debut,Fin,Pourcent,AbsType,Refus,Postpose,Post_debut,Post_fin,Lu1,Ma1,Me1,Je1,Ve1,Lu2,Ma2,Me2,Je2,Ve2,Remarques,Filiation, Nom_parent)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
    
        PreparedStatement ps = getConn().prepareStatement(sql);
    
        ps.setString(3, jTxtMatr.getText());               
                        
    
      ps.setInt(1,TxtId.getX()); // à voir si tu dois utiliser ps.setInt()
    
     //TxtDecId - Gestion de valeur Null
     //---------------------------------
     
       if (TxtDecId.getText().equals("")){
         ps.setString(2, "");
        }
         else {
            ps.setString(2, TxtDecId.getText());
        }
       
      //      ps.setString(3,jTxtMatr.getText());
    
    
    //jDateChooserDateDec- Gestion de valeur Null
    // ==========================================
     
    if ( jDateChooserDateDec.getDate() == null){ 
       ps.setDate(4,null); 
        }  else { 
        ps.setDate(4,new java.sql.Date(jDateChooserDateDec.getDate().getTime()));
        }
    
       ps.setString(5,TxtNumero.getText());
    affiche("Database Connection...OK");	
    //jDateChooserDateDebut - Gestion de valeur Null
        // ==========================================
     
        if ( jDateChooserDateDebut.getDate() == null){ 
       ps.setDate(6,null); 
        }  else { 
        ps.setDate(6,new java.sql.Date(jDateChooserDateDebut.getDate().getTime()));
        }
    
        //jDateChooserDateDebut - Gestion de valeur Null
        // =============================================
     
        if ( jDateChooserDateFin.getDate() == null){ 
       ps.setDate(7,null); 
        }  else { 
        ps.setDate(7,new java.sql.Date(jDateChooserDateFin.getDate().getTime()));
        }
        
    ps.setObject(8, jCboPcActivity.getSelectedItem());
    ps.setObject(9,jCboTypeAbsence.getSelectedItem());
    ps.setObject(10, jCheckBoxRefus.isSelected());
    ps.setObject(11, jCheckBoxPostpose.isSelected());
    
     //jDateChooser PostposeDebut - Gestion de valeur Null
     //===================================================
     
    if ( jDateChooserPostposeDebut.getDate() == null){ 
       ps.setDate(12,null); 
        }  else { 
        ps.setDate(12,new java.sql.Date(jDateChooserPostposeDebut.getDate().getTime()));
        }
    
     //jDateChooser PostposeDebut - Gestion de valeur Null
     //===================================================
     
    if ( jDateChooserPostposeFin.getDate() == null){ 
       ps.setDate(13,null); 
        }  else { 
        ps.setDate(13,new java.sql.Date(jDateChooserPostposeFin.getDate().getTime()));
        }
    
    //ps.setDate(13,new java.sql.Date(jDateChooserPostposeFin.getDate().getTime()));
    
    ps.setObject(14, jCheckBoxLun1.isSelected());
    ps.setObject(15, jCheckBoxMar1.isSelected());
    ps.setObject(16, jCheckBoxMer1.isSelected());
    ps.setObject(17, jCheckBoxJeu1.isSelected());
    ps.setObject(18, jCheckBoxVen1.isSelected());
    ps.setObject(19, jCheckBoxLun2.isSelected());
    ps.setObject(20, jCheckBoxMar2.isSelected());
    ps.setObject(21, jCheckBoxMer2.isSelected());
    ps.setObject(22, jCheckBoxJeu2.isSelected());
    ps.setObject(23, jCheckBoxVen2.isSelected());
    ps.setString(24, jTextAreaRemarques.getText());
    ps.setObject(25, jCboFiliation.getSelectedItem());
    
    // jTextNom_Parent - Gestion de valeur Null
    // ========================================
            
         if (jTextNom_Parent.getText().equals("")){
          ps.setString(26, "");
        }
        else {
           ps.setString(26, jTextNom_Parent.getText());
           ps.setString(2, JTextNomPrenom2.getText());
       }
       
     ps.execute();
    
    
              JOptionPane.showMessageDialog(null, "Saved");
                getConn().close();
    }
             catch(SQLException | HeadlessException e )
                
    { 
                JOptionPane.showMessageDialog(null, e);
                e.printStackTrace();
            }             
        }
        
    
        private void jCboPcActivityFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jCboPcActivityFocusLost
        NullPointerException exp;
            String x = String.valueOf(jCboPcActivity.getSelectedItem());
            if (x.equals("100")) {
                
              jCheckBoxLun1.setSelected(true);
              jCheckBoxMar1.setSelected(true);
              jCheckBoxMer1.setSelected(true);
              jCheckBoxJeu1.setSelected(true);
              jCheckBoxVen1.setSelected(true);
              jCheckBoxLun2.setSelected(true);
              jCheckBoxMar2.setSelected(true);
              jCheckBoxMer2.setSelected(true);
              jCheckBoxJeu2.setSelected(true);
              jCheckBoxVen2.setSelected(true);
    
            } else {
              jCheckBoxLun1.setSelected(false);
              jCheckBoxMar1.setSelected(false);
              jCheckBoxMer1.setSelected(false);
              jCheckBoxJeu1.setSelected(false);
              jCheckBoxVen1.setSelected(false);
              jCheckBoxLun2.setSelected(false);
              jCheckBoxMar2.setSelected(false);
              jCheckBoxMer2.setSelected(false);
              jCheckBoxJeu2.setSelected(false);
              jCheckBoxVen2.setSelected(false);
              
            }
        //}
    
        }//*/GEN-LAST:event_jCboPcActivityFocusLost*/
    
        private void jCheckBoxPostposeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxPostposeActionPerformed
            if (jCheckBoxPostpose.isSelected()){
            jDateChooserPostposeFin.setVisible(true);
            jDateChooserPostposeDebut.setVisible(true);
            }
            else {
            jDateChooserPostposeFin.setVisible(false);
            jDateChooserPostposeDebut.setVisible(false);
            }
        }//GEN-LAST:event_jCheckBoxPostposeActionPerformed
    
    @SuppressWarnings("empty-statement")
       
        private void jCboFiliationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCboFiliationActionPerformed
            
            String y = String.valueOf(jCboFiliation.getSelectedItem());
            
            if (y.equals("<None>")) {
                
              jTextNom_Parent.setVisible(false);
            } else 
            
            {
              jTextNom_Parent.setVisible(true);       
                                    
                      
                    
          }          // TODO add your handling code here:
        }//GEN-LAST:event_jCboFiliationActionPerformed
                            
    
        public static void main(String args[]) {
     
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(AddDecisionFrame_ok1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(AddDecisionFrame_ok1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(AddDecisionFrame_ok1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(AddDecisionFrame_ok1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            //</editor-fold>
            //</editor-fold>
            //</editor-fold>
            //</editor-fold>
            //</editor-fold>
            //</editor-fold>
            //</editor-fold>
            //</editor-fold>
     
    
            
            /* Create and display the form */
            //java.awt.EventQueue.invokeLater(new Runnable() {
            java.awt.EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    try {
                        new AddDecisionFrame_ok1().setVisible(true);
                    } catch (SQLException ex) {
                        Logger.getLogger(AddDecisionFrame_ok1.class.getName()).log(Level.SEVERE, null, ex);
                    }
    
                    
                }
    
    
            });
    }
    
        // Variables declaration - do not modify//GEN-BEGIN:variables
        // Generated using JFormDesigner non-commercial license
        private JLabel jLabel1;
        private JButton CmdSave;
        private JLabel jLabel2;
        private JTextField TxtDecId;
        private JLabel jLabel3;
        private JLabel jLabel4;
        private JTextField TxtNumero;
        private JLabel jLabel5;
        private JLabel jLabel6;
        private JLabel jLabel7;
        private JTextField jTxtMatr;
        private JLabel jLabel8;
        private JLabel jLabel9;
        private JCheckBox jCheckBoxRefus;
        private JLabel jLabel10;
        private JCheckBox jCheckBox3;
        private JCheckBox jCheckBoxPostpose;
        private JLabel jLabel12;
        private JComboBox<String> jCboPcActivity;
        private JComboBox<String> jCboTypeAbsence;
        private JCheckBox jCheckBoxVen1;
        private JTextField TxtId;
        private JDateChooser jDateChooserDateDebut;
        private JDateChooser jDateChooserDateFin;
        private JCheckBox jCheckBoxLun1;
        private JCheckBox jCheckBoxMar1;
        private JCheckBox jCheckBoxMer1;
        private JCheckBox jCheckBoxJeu1;
        private JCheckBox jCheckBoxVen2;
        private JCheckBox jCheckBoxLun2;
        private JCheckBox jCheckBoxMar2;
        private JCheckBox jCheckBoxMer2;
        private JCheckBox jCheckBoxJeu2;
        private JScrollPane jScrollPane1;
        private JTextArea jTextAreaRemarques;
        private JLabel jLabel11;
        private JComboBox<String> jCboFiliation;
        private JTextField jTextNom_Parent;
        private JDateChooser jDateChooserDateDec;
        private JDateChooser jDateChooserPostposeDebut;
        private JDateChooser jDateChooserPostposeFin;
        private JPanel panel1;
        private JPanel panel2;
        private JTextField jTxtNomPrenom;
        private JDesktopPane desktopPane1;
        private JToggleButton toggleBtnFr;
        private JToggleButton btnNl;
        private JScrollPane scrollPane1;
        private JTextArea textAreaSQL;
        private JTextField JTextNomPrenom2;
        private JTextField txtMois;
        // End of variables declaration//GEN-END:variables
    
        /**
         * @return the conn
         */
        public Connection getConn() {
            return conn;
        }
    
        /**
         * @param conn the conn to set
         */
        public void setConn(Connection conn) {
            this.conn = conn;
        }
    
        /**
         * @return the rs
         */
        public ResultSet getRs() {
            return rs;
        }
    
        /**
         * @param rs the rs to set
         */
        public void setRs(ResultSet rs) {
            this.rs = rs;
        }
    
        /**
         * @return the ps
         */
        public PreparedStatement getPs() {
            return ps;
        }
    
        /**
         * @param ps the ps to set
         */
        public void setPs(PreparedStatement ps) {
            this.ps = ps;
        }
    
    
    }
    
    My full code is :

  7. #7
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,904
    Rep Power
    30

    Default Re: Using the return value of a class in another class

    I tryed with setText() but no result.
    Does that code compile? Please be sure to copy the full text of the compiler's error messages and paste it here so we can see them and offer suggestions.

    Where did you see the API doc for the setText() method? It takes as an argument the String to be shown in the textfield.

    Your posted code has many examples of how to use the setText() method.
    If you don't understand my response, don't ignore it, ask a question.

  8. #8
    habiler is offline Member
    Join Date
    Sep 2016
    Posts
    44
    Rep Power
    0

    Default Re: Using the return value of a class in another class

    Now i have a problem with tempral and difference in length.

    Java Code:
        public void txtMoisActionPerformed(ActionEvent e) {
    
            LocalDate date1 = LocalDate.fromDateFields(jDateChooserDateDebut.getDate());
            LocalDate date2 = LocalDate.fromDateFields(jDateChooserDateFin.getDate());
            Long duree = ChronoUnit.DAYS.between(date2,date1);
            txtMois.setText() = duree.toString();
            ;
        }

  9. #9
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,904
    Rep Power
    30

    Default Re: Using the return value of a class in another class

    i have a problem with tempral and difference in length.
    Please copy the full text of the error message and paste it here. It has important info about the error.

    The code has lots of examples of how to use the setText() method. Look at them for how to code it.
    If you don't understand my response, don't ignore it, ask a question.

  10. #10
    habiler is offline Member
    Join Date
    Sep 2016
    Posts
    44
    Rep Power
    0

    Default Re: Using the return value of a class in another class

    Here the report of the errors.

    Java Code:
    C:\Users\hab\Desktop\decisions1 - Copy\src\decisions\AddDecisionFrame_ok1.java:168: error: no suitable method found for between(LocalDate,LocalDate)
            Long duree = ChronoUnit.DAYS.between(date2,date1);
        method TemporalUnit.between(Temporal,Temporal) is not applicable
          (argument mismatch; LocalDate cannot be converted to Temporal)
        method ChronoUnit.between(Temporal,Temporal) is not applicable
          (argument mismatch; LocalDate cannot be converted to Temporal)
    C:\Users\hab\Desktop\decisions1 - Copy\src\decisions\AddDecisionFrame_ok1.java:169: error: cannot find symbol
            txtMois.setString() = duree.toString();
      symbol:   method setString()
      location: variable txtMois of type JTextField
    2 errors

  11. #11
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,904
    Rep Power
    30

    Default Re: Using the return value of a class in another class

    The compiler can not find a method named: between() for the TemporalUnit class that takes two LocalDate objects.
    Look at the API doc to make sure you are using the correct arguments for the between() method.

    The compiler can not find a method named: setString() for the JTextField class.
    Look at the API doc to see what methods the JTextField class has.


    http://docs.oracle.com/javase/8/docs/api/index.html
    Last edited by Norm; 01-15-2018 at 09:47 PM.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Abstract Class return
    By Robben in forum New To Java
    Replies: 5
    Last Post: 03-12-2015, 01:03 AM
  2. Return class by name
    By dutchgold92 in forum Advanced Java
    Replies: 6
    Last Post: 04-18-2012, 03:02 PM
  3. Class constructor with boolean return possible?
    By KingdomX in forum New To Java
    Replies: 3
    Last Post: 12-21-2011, 10:16 PM
  4. Replies: 0
    Last Post: 12-07-2011, 12:55 PM
  5. accessing return values from another class
    By moaxjlou in forum New To Java
    Replies: 3
    Last Post: 10-31-2008, 03:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •