Board index » jbuilder » how to passing value from one Class to another Class
tom
JBuilder Developer |
how to passing value from one Class to another Class2005-07-14 07:42:59 AM jbuilder7 Hi, I want to be able to pass values from one class to another class. I have the following classes FCO_dataDisplay_Panel1 FCO_graphDisplay_Panel1 ... Passing the following values Sensor_ID,Date_time, Run_time from FCO_dataDisplay_Panel1 To FCO_graphDisplay_Panel1, so that it can to use the same values. Here's what I have so far... In FCO_graphDisplay_Panel1 source code, I added the following code. how would I assign each of the values to the a variable in FCO_graphDisplay_Panel1, so that it can use the same values as in FCO_dataDisplay_Panel1 ? //--get data from database-------------- private XYDataset readData() { JDBCXYDataset data = null; String beginDate, endDate = null; int sensorID = null; FCO_dataDisplay_Panel1 dataDisplay = new FCO_dataDisplay_Panel1(); //--test to see if the value passed successfully... beginDate = dataEntry.jdbTextField1.getText(); System.out.println("The sensorID is" + beginDate); try { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@dummy.company.com:1521:cdecdb02", "oradba", "oradba"); String sql ="Select date_time, value as Candidate from ressim_hourly where sensor_Id =" + sensorID + " date_time>=" + beginDate + "and run_time =" + endDate; Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(sql); data = new JDBCXYDataset(conn); data.executeQuery(sql); /* while (rset.next()) { System.out.println(rset.getString(1) + " " + (rset.getString(2))); //System.out.println(rset.getString(1)); //System.out.println(rset.getString(2)); } stmt.close(); */ } catch (SQLException ex) { System.err.print(ex.getMessage()); } return data; } Thanks, Tom |