/** * Create a default filename given the current date selection. If custom dates are selected, use * those dates; otherwise, use year and week numbers. * * @return The default filename. */ private String getDefaultFilename() { if (yearCB.getSelectedIndex() == 0 || weekCB.getSelectedIndex() == 0) return "timesheet-" + dateFormat.format(fromDate.getDate()).replaceAll("/", "") + "-" + dateFormat.format(toDate.getDate()).replaceAll("/", "") + ".txt"; return "timesheet-" + yearCB.getSelectedItem() + "wk" + weekCB.getSelectedItem() + ".txt"; }
private void setamount() { try { ResultSet rst = DBConnection.getDBConnection() .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE) .executeQuery( "SELECT Amount FROM BOOKING where Pass_No='" + combo1.getSelectedItem() + "'"); while (rst.next()) { combo8.addItem(rst.getString(1)); } } catch (Exception n) { n.printStackTrace(); } }
/** * Returns the unique ID of a week prefixed with the year. * * @return Selected week's ID. */ String getSelectedWeekID() { String weekNo = weekCB.getSelectedItem().toString(); if (weekNo.length() == 1) weekNo = "0" + weekNo; return yearCB.getSelectedItem() + "wk" + weekNo; }